Skip to content

Commit e8f1a01

Browse files
Fix method for string representation
1 parent ed87e58 commit e8f1a01

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

src/imcflibs/imagej/bioformats.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def __repr__(self):
110110
)
111111

112112

113-
class StageMetadata:
113+
class StageMetadata(object):
114114
"""A class to store stage coordinates and calibration metadata for a set of images.
115115
116116
Attributes
@@ -171,11 +171,10 @@ def __init__(
171171

172172
def __repr__(self):
173173
"""Return a string representation of the object."""
174-
return "<StageMetadata(dimensions={}, calibration_unit='{}', ...)>".format(
175-
self.dimensions, self.calibration_unit
174+
return "<StageMetadata({})>".format(
175+
", ".join("{}={}".format(k, v) for k, v in self.__dict__.items())
176176
)
177177

178-
179178
def import_image(
180179
filename,
181180
color_mode="color",
@@ -467,6 +466,7 @@ def get_metadata_from_file(path_to_image):
467466
unit_width=ome_meta.getPixelsPhysicalSizeX(0),
468467
unit_height=ome_meta.getPixelsPhysicalSizeY(0),
469468
unit_depth=ome_meta.getPixelsPhysicalSizeZ(0),
469+
unit=ome_meta.getPixelsPhysicalSizeX(0).unit().symbol,
470470
pixel_width=ome_meta.getPixelsSizeX(0),
471471
pixel_height=ome_meta.getPixelsSizeY(0),
472472
slice_count=ome_meta.getPixelsSizeZ(0),
@@ -562,9 +562,12 @@ def get_stage_coords(filenames):
562562
else:
563563
series_names.append(str(image))
564564

565-
current_position_x = getattr(ome_meta.getPlanePositionX(series, 0), "value", lambda: 0)()
566-
current_position_y = getattr(ome_meta.getPlanePositionY(series, 0), "value", lambda: 0)()
567-
current_position_z = getattr(ome_meta.getPlanePositionZ(series, 0), "value", lambda: 1.0)()
565+
current_position_x = getattr(ome_meta.getPlanePositionX(series, 0), "value",
566+
lambda: 0)()
567+
current_position_y = getattr(ome_meta.getPlanePositionY(series, 0), "value",
568+
lambda: 0)()
569+
current_position_z = getattr(ome_meta.getPlanePositionZ(series, 0), "value",
570+
lambda: 1.0)()
568571

569572
max_phys_size_x = max(max_phys_size_x, ome_meta.getPixelsPhysicalSizeX(series).value())
570573
max_phys_size_y = max(max_phys_size_y, ome_meta.getPixelsPhysicalSizeY(series).value())

0 commit comments

Comments
 (0)