Browse Source

fixed indicies - I think they might vary depending on file so this could cause problems

feature/load_slices
jim 10 years ago
parent
commit
0bd231086b
2 changed files with 10 additions and 4 deletions
  1. +8
    -2
      nd2reader/model/__init__.py
  2. +2
    -2
      nd2reader/service/__init__.py

+ 8
- 2
nd2reader/model/__init__.py View File

@ -62,13 +62,19 @@ class Image(object):
@property
def timestamp(self):
# TODO: Convert to datetime object
"""
The number of seconds after the beginning of the acquisition that the image was taken. Note that for a given field
of view and z-level offset, if you have images of multiple channels, they will all be given the same timestamp.
No, this doesn't make much sense. But that's how ND2s are structured, so if your experiment depends on millisecond
accuracy, you need to find an alternative imaging system.
"""
return self._timestamp / 1000.0
@property
def data(self):
if self._data is None:
self._data = np.reshape(self._raw_data, (self._height, self._width))
self._data = np.reshape(self._raw_data, (self._height, self._width)).astype(np.float64)
return self._data
@property


+ 2
- 2
nd2reader/service/__init__.py View File

@ -29,7 +29,7 @@ class BaseNd2(object):
def channels(self):
metadata = self._metadata['ImageMetadataSeq']['SLxPictureMetadata']['sPicturePlanes']
try:
validity = self._metadata['ImageMetadata']['SLxExperiment']['ppNextLevelEx']['']['ppNextLevelEx']['']['pItemValid']
validity = self._metadata['ImageMetadata']['SLxExperiment']['ppNextLevelEx'][''][0]['ppNextLevelEx'][''][0]['pItemValid']
except KeyError:
# If none of the channels have been deleted, there is no validity list, so we just make one
validity = [True for i in metadata]
@ -69,7 +69,7 @@ class BaseNd2(object):
NIS Elements can figure it out, but we haven't found it yet.
"""
return sum(self._metadata['ImageMetadata']['SLxExperiment']['ppNextLevelEx']['']['pItemValid'])
return sum(self._metadata['ImageMetadata']['SLxExperiment']['ppNextLevelEx'][''][0]['pItemValid'])
@property
def channel_count(self):


Loading…
Cancel
Save