Browse Source

#2 added reprs

zolfa-add_slices_loading
jim 10 years ago
parent
commit
ffb3f43f7f
2 changed files with 14 additions and 1 deletions
  1. +1
    -1
      nd2reader/__init__.py
  2. +13
    -0
      nd2reader/model/__init__.py

+ 1
- 1
nd2reader/__init__.py View File

@ -16,7 +16,7 @@ class Nd2(Nd2Parser):
self._filename = filename
def __repr__(self):
return "\n".join(["ND2: %s" % self._filename,
return "\n".join(["<ND2 %s>" % self._filename,
"Created: %s" % self._absolute_start.strftime("%Y-%m-%d %H:%M:%S"),
"Image size: %sx%s (HxW)" % (self.height, self.width),
"Image cycles: %s" % self._time_index_count,


+ 13
- 0
nd2reader/model/__init__.py View File

@ -16,6 +16,15 @@ class Image(object):
self._width = width
self._data = None
def __repr__(self):
return "\n".join(["<ND2 Image>",
"%sx%s (HxW)" % (self._height, self._width),
"Timestamp: %s" % self.timestamp,
"Field of View: %s" % self.field_of_view,
"Channel: %s" % self.channel,
"Z-Level: %s" % self.z_level,
])
@property
def field_of_view(self):
return self._field_of_view
@ -56,6 +65,10 @@ class ImageSet(object):
def __init__(self):
self._images = collections.defaultdict(dict)
def __repr__(self):
return "\n".join(["<ND2 Image Set>",
"Image count: %s" % len(self)])
def get(self, channel="", z_level=0):
"""
Retrieve an image with a given channel and z-level. For most users, z_level will always be 0.


Loading…
Cancel
Save