Browse Source

Fixed bug where ND2s having only one channel couldn't be opened

master
Jim Rybarski 10 years ago
parent
commit
b7bc954248
1 changed files with 24 additions and 4 deletions
  1. +24
    -4
      nd2reader/service/__init__.py

+ 24
- 4
nd2reader/service/__init__.py View File

@ -156,12 +156,22 @@ class Nd2Reader(object):
"""
pattern = r""".*?T'\((\d+)\).*?"""
return int(re.match(pattern, self._dimensions).group(1))
try:
count = int(re.match(pattern, self._dimensions).group(1))
except AttributeError:
return 1
else:
return count
@property
def z_level_count(self):
pattern = r""".*?Z\((\d+)\).*?"""
return int(re.match(pattern, self._dimensions).group(1))
try:
count = int(re.match(pattern, self._dimensions).group(1))
except AttributeError:
return 1
else:
return count
@property
def field_of_view_count(self):
@ -173,12 +183,22 @@ class Nd2Reader(object):
"""
pattern = r""".*?XY\((\d+)\).*?"""
return int(re.match(pattern, self._dimensions).group(1))
try:
count = int(re.match(pattern, self._dimensions).group(1))
except AttributeError:
return 1
else:
return count
@property
def channel_count(self):
pattern = r""".*?λ\((\d+)\).*?"""
return int(re.match(pattern, self._dimensions).group(1))
try:
count = int(re.match(pattern, self._dimensions).group(1))
except AttributeError:
return 1
else:
return count
def get_raw_image_data(self, image_set_number, channel_offset):
chunk = self._label_map["ImageDataSeq|%d!" % image_set_number]


Loading…
Cancel
Save