From 5f60c5d533be1e9194dd5c9ee9d1c594c1773fba Mon Sep 17 00:00:00 2001 From: Ruben Verweij Date: Fri, 24 Aug 2018 14:48:36 +0200 Subject: [PATCH] Fix error --- nd2reader/parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nd2reader/parser.py b/nd2reader/parser.py index 20b2095..8a71b0b 100644 --- a/nd2reader/parser.py +++ b/nd2reader/parser.py @@ -265,11 +265,11 @@ class Parser(object): # The images for the various channels are interleaved within the same array. For example, the second image # of a four image group will be composed of bytes 2, 6, 10, etc. If you understand why someone would design # a data structure that way, please send the author of this library a message. - number_of_true_channels = int(len(image_group_data[image_data_start:]) / (height * width)) + number_of_true_channels = int(len(image_group_data[4:]) / (height * width)) try: image_data = np.reshape(image_group_data[image_data_start::number_of_true_channels], (height, width)) except ValueError: - image_data = np.reshape(image_group_data[image_data_start::number_of_true_channels], (height, int(len(image_group_data[image_data_start::number_of_true_channels])/height))) + image_data = np.reshape(image_group_data[image_data_start::number_of_true_channels], (height, int(round(len(image_group_data[image_data_start::number_of_true_channels])/height)))) # Skip images that are all zeros! This is important, since NIS Elements creates blank "gap" images if you # don't have the same number of images each cycle. We discovered this because we only took GFP images every