|
@ -1,9 +1,7 @@ |
|
|
# -*- coding: utf-8 -*- |
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
|
|
|
import array |
|
|
import array |
|
|
from datetime import datetime |
|
|
|
|
|
import numpy as np |
|
|
import numpy as np |
|
|
import re |
|
|
|
|
|
import struct |
|
|
import struct |
|
|
import six |
|
|
import six |
|
|
from nd2reader.model.image import Image |
|
|
from nd2reader.model.image import Image |
|
@ -59,7 +57,7 @@ class V3ImageReader(object): |
|
|
|
|
|
|
|
|
""" |
|
|
""" |
|
|
channel_offset = {} |
|
|
channel_offset = {} |
|
|
for n, channel in enumerate(self._channels): |
|
|
|
|
|
|
|
|
for n, channel in enumerate(self._metadata.channels): |
|
|
channel_offset[channel] = n |
|
|
channel_offset[channel] = n |
|
|
return channel_offset |
|
|
return channel_offset |
|
|
|
|
|
|
|
@ -86,7 +84,7 @@ class V3ImageReader(object): |
|
|
# The images for the various channels are interleaved within the same array. For example, the second image |
|
|
# 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 |
|
|
# 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. |
|
|
# a data structure that way, please send the author of this library a message. |
|
|
image_data = np.reshape(image_group_data[image_data_start::len(self.channels)], (height, width)) |
|
|
|
|
|
|
|
|
image_data = np.reshape(image_group_data[image_data_start::len(self._metadata.channels)], (height, width)) |
|
|
# Skip images that are all zeros! This is important, since NIS Elements creates blank "gap" images if you |
|
|
# 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 |
|
|
# don't have the same number of images each cycle. We discovered this because we only took GFP images every |
|
|
# other cycle to reduce phototoxicity, but NIS Elements still allocated memory as if we were going to take |
|
|
# other cycle to reduce phototoxicity, but NIS Elements still allocated memory as if we were going to take |
|
|