vibbits / nis2pyr

Python utility and library for converting Nikon .nd2 files to pyramidal OME TIFF.
BSD 3-Clause "New" or "Revised" License
8 stars 1 forks source link

Crash in nd2reader while reading 8-bit RGB image #2

Closed SilverViking closed 3 years ago

SilverViking commented 3 years ago

python nis2pyr.py "g:\NISMakePyramidal\Testfiles\SlideExpressJaneDoe\Slide2-17-1_ChannelBrightfield_Seq0079.nd2" e:\temp\

gives

E:\Anaconda3\envs\nis\lib\site-packages\pims\base_frames.py:472: UserWarning: Please call FramesSequenceND.__init__() at the start of thethe reader initialization.
  warn("Please call FramesSequenceND.__init__() at the start of the"
ND2 file: #frames=1, #components=3, #planes=1, bits per component=8, is RGB=True, pixel size=0.48 um, frames.sizes={'x': 79200, 'y': 26829, 'c': 3}
Reading image
Traceback (most recent call last):
  File "nis2pyr.py", line 100, in <module>
    image, metadata = read_nd2(args.nd2_filename)
  File "E:\xx\xx\xx\xx\reader.py", line 34, in read_nd2
    image = frames[0]
  File "E:\Anaconda3\envs\nis\lib\site-packages\slicerator\__init__.py", line 188, in __getitem__
    return self._get(indices)
  File "E:\Anaconda3\envs\nis\lib\site-packages\pims\base_frames.py", line 98, in __getitem__
    return self.get_frame(key)
  File "E:\Anaconda3\envs\nis\lib\site-packages\pims\base_frames.py", line 592, in get_frame
    result = self._get_frame_wrapped(**coords)
  File "E:\Anaconda3\envs\nis\lib\site-packages\pims\base_frames.py", line 252, in get_frame_T
    return get_frame(**ind).transpose(transposition)
  File "E:\Anaconda3\envs\nis\lib\site-packages\pims\base_frames.py", line 265, in get_frame_bundled
    frame = get_frame(**ind)
  File "E:\Anaconda3\envs\nis\lib\site-packages\pims\base_frames.py", line 303, in get_frame_dropped
    result = get_frame(**ind)
  File "E:\Anaconda3\envs\nis\lib\site-packages\pims_nd2\nd2reader.py", line 194, in get_frame_2D
    h.Lim_FileGetImageData(self._handle, i, self._buf_p, self._buf_md)
OSError: exception: access violation writing 0x00000271BF0DB000
SilverViking commented 3 years ago

Note that .nd2 RGB images in general can be converted just fine, the crash happens for this specific image. Wild guess: is it an out-of-memory issue, the image is quite large.

SilverViking commented 3 years ago

Solved (in nis2pyr >= v0.4.0) by switching from pims_nd2 to the more robust nd2 library for reading ND2 files.