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
I came across a bug in the read_txrm function related to slicing, as well as a type issue. I'll start with the bug. If you try to read out a portion of the images you get an exception due to a bug in the code.
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-4-7cc0a3c63f99> in <module>
----> 1 reader.read_txm(file_path, slice_range=(slice(10, 11, None), slice(None), slice(None)))
C:\Anaconda\envs\py37\lib\site-packages\dxchange\reader.py in read_txm(file_name, slice_range)
357 """
358
--> 359 return read_txrm(file_name, slice_range)
360
361
C:\Anaconda\envs\py37\lib\site-packages\dxchange\reader.py in read_txrm(file_name, slice_range)
322 img_string = "ImageData{}/Image{}".format(
323 int(np.ceil((i + 1) / 100.0)), int(i + 1))
--> 324 array_of_images[i] = _read_ole_image(ole, img_string, metadata)[slice_range[1:]]
325
326 reference = metadata['reference']
IndexError: index 10 is out of bounds for axis 0 with size 1
This issue is that the index i is 10 while the size of the array_of_images is just one in this case. Because of this it is not possible to use slices on the first axis, except if you start at 0 and step with 1.
There's also a smaller issue related to the data type. The array_of_images is always created using float32, so even though the _read_ole_image function correctly returns data as uint16 in my case, it is changed changed to float32 before being returned, which is actually very significant when working with +30GB data files.
The text was updated successfully, but these errors were encountered:
Hey,
I came across a bug in the
read_txrm
function related to slicing, as well as a type issue. I'll start with the bug. If you try to read out a portion of the images you get an exception due to a bug in the code.Example:
Throws:
This issue is that the index
i
is 10 while the size of thearray_of_images
is just one in this case. Because of this it is not possible to use slices on the first axis, except if you start at 0 and step with 1.There's also a smaller issue related to the data type. The
array_of_images
is always created usingfloat32
, so even though the_read_ole_image
function correctly returns data asuint16
in my case, it is changed changed tofloat32
before being returned, which is actually very significant when working with +30GB data files.The text was updated successfully, but these errors were encountered: