def convert2voxels(x_um_rw, imExtends, voxelSize):
    """
    Converting from real world um coordinates to 0 origin voxel.

    :param x_um_rw: coordinates in real world frame, dimensions in um
    :param imExtends (list of lists): the first list are the initial extends of the image, and the second list the
     final ones. Dimensions are um and they are used to localize the image in the real world frame
    :param voxelSize: voxel size
    :return: coordinates in 0 centered frame, dimensions in voxels
    """

    # First we bring the coordinates origin to 0
    x_um_0 = x_um_rw - imExtends[0]
    # And then we transform the dimensions to voxels
    X_voxel_0 = x_um_0 / voxelSize
    return X_voxel_0