Browse Source

refactored a bit

feature/load_slices
jim 10 years ago
parent
commit
4c894fb21f
3 changed files with 9 additions and 3 deletions
  1. +1
    -0
      .gitignore
  2. +2
    -2
      nd2reader/__init__.py
  3. +6
    -1
      nd2reader/service/__init__.py

+ 1
- 0
.gitignore View File

@ -4,6 +4,7 @@ run.py
__pycache__/
*.py[cod]
.idea/
*.idea/*
# C extensions
*.so


+ 2
- 2
nd2reader/__init__.py View File

@ -30,11 +30,11 @@ class Nd2(BaseNd2):
if image.is_valid:
yield image
def image_sets(self, field_of_view, timepoints=None, channels=None, z_levels=None):
def image_sets(self, field_of_view, time_indices=None, channels=None, z_levels=None):
"""
Gets all the images for a given field of view and
"""
timepoint_set = xrange(self.timepoint_count) if timepoints is None else timepoints
timepoint_set = xrange(self.timepoint_count) if time_indices is None else time_indices
channel_set = [channel.name for channel in self.channels] if channels is None else channels
z_level_set = xrange(self.z_level_count) if z_levels is None else z_levels


+ 6
- 1
nd2reader/service/__init__.py View File

@ -69,7 +69,12 @@ class BaseNd2(object):
NIS Elements can figure it out, but we haven't found it yet.
"""
return sum(self._metadata['ImageMetadata']['SLxExperiment']['ppNextLevelEx'][''][0]['pItemValid'])
try:
valid_fovs = self._metadata['ImageMetadata']['SLxExperiment']['ppNextLevelEx'][''][0]['pItemValid']
except KeyError:
# if nothing was deleted, there won't be a 0 key
valid_fovs = self._metadata['ImageMetadata']['SLxExperiment']['ppNextLevelEx']['']['pItemValid']
return sum(valid_fovs)
@property
def channel_count(self):


Loading…
Cancel
Save