readlif icon indicating copy to clipboard operation
readlif copied to clipboard

Convenience function for retrieving numpy arrays?

Open haesleinhuepf opened this issue 2 years ago • 0 comments

Hi @nimne ,

I was just using your readlif library and I was wondering if there is a way for retrieving a 3D stack from a .lif file in a convenient way. I wrote this function:

def lif_to_numpy_stack(lif_image):
    num_slices = lif_image.info['dims'].z
    
    return np.asarray([np.array(lif_image.get_frame(z=0)) for z in range(num_slices)])

And I'm now wondering if readlif already contains such a convenience function and/or if I should send a pull-request with it. Otherwise, might it make sense to add an example for reading a 3D stack to the readme?

Thanks!

Best, Robert

haesleinhuepf avatar Dec 18 '22 11:12 haesleinhuepf