Browse Source

Merge pull request #78 from jimrybarski/77-handle-missing-attributes

resolves #77: fixes bug where an nd2 with a single cycle or z-level w…
feature/load_slices
Jim Rybarski 9 years ago
parent
commit
3b18c620ce
2 changed files with 8 additions and 2 deletions
  1. +4
    -0
      jim.py
  2. +4
    -2
      nd2reader/parser.py

+ 4
- 0
jim.py View File

@ -0,0 +1,4 @@
import nd2reader
nd2 = nd2reader.Nd2("/var/nd2s/hawkjo.nd2")
print(nd2)

+ 4
- 2
nd2reader/parser.py View File

@ -234,8 +234,10 @@ class Nd2Parser(object):
except AttributeError:
return [0]
except TypeError:
count = int(re.match(pattern, self._dimensions.decode("utf8")).group(1))
return list(range(count))
match = re.match(pattern, self._dimensions.decode("utf8"))
if not match:
return [0]
return list(range(int(match.group(1))))
else:
return list(range(count))


Loading…
Cancel
Save