You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on this (and I've verified this with LAS X) the pixel size is: (1.244e-3 m)/(1920 px) = 648 nm = 0.648 micron
Meanwhile:
>>> img.physical_pixel_sizes.X
1.542168132489842
which is 1/(pixel size)
Expected Behavior
That img.physical_pixel_sizes.X return the pixel size as advertised in the docs:
img.physical_pixel_sizes.X # returns the X dimension pixel size as found in the metadata
where 'size' means a value in the length dimension (micron, nm, m).
Reproduction
(You can access the LIF and the XML in the closed issue: #277)
To set the scale in Napari, one needs to do 1/img.physical_pixel_sizes.X to get micron/pixel.
from aicsimageio import AICSImage
import napari
import dask.array as da
# if you want in-memory
import numpy as np
from vispy.color import Colormap
img = AICSImage("../Documents/Leica DMi8/20210428/20210428_24w_L929_Ho_B2C3.lif", reconstruct_mosaic=False)
scene_stack = []
for i, scene in enumerate(img.scenes):
if i >46:
img.set_scene(i)
scene_stack.append(img.get_image_dask_data("YX"))
# scene_stack.append(img.dask_data)
scene_stack = da.stack(scene_stack)
#scene_stack = np.stack(scene_stack)
#get pixel sizes (this is px/micron)
img.physical_pixel_sizes.X
microns_per_pixel = [1/img.physical_pixel_sizes.X, 1/img.physical_pixel_sizes.X]
I_Blueish = Colormap([[1, 1, 1], [0, .4, 1], [0, 0, 0]])
viewer = napari.view_image(scene_stack, colormap=('I Blueish', I_Blueish), scale=microns_per_pixel)
viewer.scale_bar.unit = "um"
Environment
My entire python environment is Apple Silicon M1 (arm64) native.
The text was updated successfully, but these errors were encountered:
System and Software
Description
Followup from:
https://forum.image.sc/t/setting-scale-bar-units-in-other-than-pixels-real-coordinates/49158/13?u=psobolewskiphd
When importing scenes from a LIF,
img.physical_pixel_sizes.X
which should return pixel size or a value of length (micron, nm) per pixel instead returns the reciprocal: px/lengthYou can access the LIF and the XML in the closed issue:
#277
Here's a relevant part of the XML:
Based on this (and I've verified this with LAS X) the pixel size is:
(1.244e-3 m)/(1920 px) = 648 nm = 0.648 micron
Meanwhile:
which is 1/(pixel size)
Expected Behavior
That
img.physical_pixel_sizes.X
return the pixel size as advertised in the docs:where 'size' means a value in the length dimension (micron, nm, m).
Reproduction
(You can access the LIF and the XML in the closed issue:
#277)
To set the scale in Napari, one needs to do
1/img.physical_pixel_sizes.X
to get micron/pixel.Environment
My entire python environment is Apple Silicon M1 (arm64) native.
The text was updated successfully, but these errors were encountered: