Open-Science-Tools / nd2reader

Pure Python library for reading NIS Elements ND2 images and metadata
http://www.lighthacking.nl/nd2reader
GNU General Public License v3.0
46 stars 29 forks source link

wrong number of z plane / time points #46

Open jboulanger opened 3 years ago

jboulanger commented 3 years ago

Hello, I might be missing something but a file with 1419 images planes as a 2D time sequence is decoded as an image with 1419 z planes and 1419 time points.

from nd2reader import ND2Reader

with ND2Reader('../data/example.nd2') as images:
  print('Image size:', images.sizes)
  print("Number of images: ", len(images))

gives:

Image size: {'x': 512, 'y': 512, 't': 1419, 'z': 1419} Number of images: 1419

The iter axe is also misidentify as being z instead of t..

from nd2reader import ND2Reader

with ND2Reader('../data/example.nd2') as images:
    images.iter_axes = 'z' # instead  of 't'
    plt.imshow(images[3])
rbnvrw commented 3 years ago

Thank you for your report @jboulanger. The iter_axes attribute is something you can change yourself to determine over which axes to iterate, see this documentation: http://soft-matter.github.io/pims/v0.5/multidimensional.html

The size issue is a bit more challenging. Can you post a screenshot of what it is supposed to be in the ND2 software?

jboulanger commented 3 years ago

Thank you for looking into this.

I agree it is possible to change the iter_axes but still one would expect to have to use 't' for a time sequence and 'z' for a 3D image stack.

Here are screenshot of the image window in NIS Elements:

image

And here is the field in 'Description' field of the image properties:

Metadata: Dimensions: T(1419) Camera Name: Flash4.0, SN:100266 Numerical Aperture: 0.75 Refractive Index: 1 Name: DIC Camera Component Count: 1 Modality: Brightfield Camera Settings: Exposure: 3 ms Binning: 1x1 Scan Mode: Fast Microscope Settings: Microscope: Ti2 Microscope DIC Prism, position: In Bertrand Lens, position: Out Nikon Ti2, FilterChanger(Turret-Lo): 1 (GFP-L) Nikon Ti2, Shutter(FL-Lo): Opened Nikon Ti2, Shutter(DIA LED): Active Nikon Ti2, Illuminator(DIA): On Nikon Ti2, Illuminator(DIA) Iris intensity: 84.2 LightPath: L100 Analyzer Slider: Extracted PFS, state: Off PFS, offset: 8838 PFS, mirror: Inserted PFS, Dish Type: Glass Zoom: 1.50x Sutter Lambda 10-3, FilterChanger(Filter C): 8 (Analyser) Sutter Lambda 10-3, Shutter(DIA): Opened Sutter Lambda 10-3, Shutter(DIA) mode: Fast Spectra/AuraII, Shutter(NIJI): Closed Spectra/AuraII, MultiLaser(Spectra): Line:1; ExW:395; Power: 25.0; Off Line:2; ExW:445; Power: 10.0; Off Line:3; ExW:470; Power: 14.0; Off Line:4; ExW:510; Power: 12.0; Off Line:5; ExW:550; Power: 10.0; Off Line:6; ExW:635; Power: 10.0; Off

Time Loop: 1419