Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile on scaled images not working #22

Open
grinic opened this issue Dec 13, 2022 · 0 comments
Open

Profile on scaled images not working #22

grinic opened this issue Dec 13, 2022 · 0 comments

Comments

@grinic
Copy link

grinic commented Dec 13, 2022

Hi @haesleinhuepf ,
not sure if this is expected, but I am observing a weird behavior when trying to make a plot profile after adding this image to the viewer:

from napari.viewer import Viewer
from aicsimageio import AICSImage
from aicsimageio.readers import BioformatsReader

fname = 'path-to-tif-file'
image = AICSImage(fname, reader=BioformatsReader)

napari_viewer = Viewer()
napari_viewer.add_image( image.data, name='image', colormap='blue')
napari_viewer.add_image( image.data,  
                         name='image_scaled', 
                         scale=(
                            image.physical_pixel_sizes.Z/image.physical_pixel_sizes.X,
                            1,
                            1
                         )
                         colormap='green'
                       )

All I did in the second image, is scale the Z dimension to account for the anisotropy.

test_napari_plot_profile

As you can see, the blue and green profiles are different. I had a look at this solved issue but could not find a straightforward solution.

On a similar note, when adding the image to the viewer to take into account the XYZ voxel size:

from napari.viewer import Viewer
from aicsimageio import AICSImage
from aicsimageio.readers import BioformatsReader

fname = 'path-to-tif-file'
image = AICSImage(fname, reader=BioformatsReader)

napari_viewer = Viewer()
napari_viewer.add_image( image.data,  
                         name='image_scaled', 
                         scale=image.physical_pixel_sizes,
                         colormap='blue'
                       )

I do not obtain any plot profile:

test_napari_plot_profile_2

Thanks so much for any help/suggestion!


EDIT:
I realize the first example is not ideal because, in the same viewer, the planes visualized are not the same due to the different Z scaling. So, here is a better example:

from napari.viewer import Viewer
from aicsimageio import AICSImage
from aicsimageio.readers import BioformatsReader

fname = 'path-to-tif-file'
image = AICSImage(fname, reader=BioformatsReader)

napari_viewer1 = Viewer()
napari_viewer1.add_image( image.data, name='image', colormap='blue')
napari_viewer2 = Viewer()
napari_viewer2.add_image( image.data,  
                         name='image_scaled', 
                         scale=(
                            image.physical_pixel_sizes.Z/image.physical_pixel_sizes.X,
                            1,
                            1
                         )
                         colormap='green'
                       )

Which produces those two different plot profiles (now looking at the same Z plane).

test_napari_plot_profile_not_scaled
test_napari_plot_profile_scaled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant