Skip to content

Commit 007a2ba

Browse files
author
Thomas Fish
committed
Changed back whitespace changes, plus changed cases for consistency
The current style seems to mostly be upper-case with lower-case values for any class instances when there may be multiple copies (e.g. image). Channel and Plane are two breaks from that style, so they have been given a second lower-case name to allow either to work. Change-Id: I9bafcec2bbdad8d9e3d05352fbf7706896d34cdb
1 parent 5e224cd commit 007a2ba

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

bioformats/omexml.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,10 @@ def set_DeltaT(self, value):
618618
DeltaT = property(get_DeltaT, set_DeltaT)
619619

620620
def get_ExposureTime(self, value):
621-
return self.node.get("ExposureTime")
621+
exposure_time = self.node.get("ExposureTime")
622+
if exposure_time is not None:
623+
return float(exposure_time)
624+
return None
622625

623626
def set_ExposureTime(self, value):
624627
'''Units are seconds. Duration of acquisition????'''
@@ -835,7 +838,8 @@ def Channel(self, index=0):
835838
'''Get the indexed channel from the Pixels element'''
836839
channel = self.node.findall(qn(self.ns['ome'], "Channel"))[index]
837840
return OMEXML.Channel(channel)
838-
841+
channel = Channel
842+
839843
def get_plane_count(self):
840844
'''The number of planes in the image
841845
@@ -869,7 +873,8 @@ def Plane(self, index=0):
869873
'''Get the indexed plane from the Pixels element'''
870874
plane = self.node.findall(qn(self.ns['ome'], "Plane"))[index]
871875
return OMEXML.Plane(plane)
872-
876+
plane = Plane
877+
873878
def get_tiffdata_count(self):
874879
return len(self.node.findall(qn(self.ns['ome'], "TiffData")))
875880

@@ -884,7 +889,7 @@ def set_tiffdata_count(self, value):
884889

885890
tiffdata_count = property(get_tiffdata_count, set_tiffdata_count)
886891

887-
def TiffData(self, index=0):
892+
def tiffdata(self, index=0):
888893
data = self.node.findall(qn(self.ns['ome'], "TiffData"))[index]
889894
return OMEXML.TiffData(data)
890895

@@ -1425,6 +1430,8 @@ def get_Color(self):
14251430

14261431
def set_Color(self, value):
14271432
self.node.set("Color", str(value))
1433+
1434+
Color = property(get_Color, set_Color)
14281435

14291436
class WellSampleDucktype(list):
14301437
'''The WellSample elements in a well
@@ -1574,6 +1581,10 @@ def set_roi_count(self, value):
15741581
new_Rectangle.set_y(0)
15751582

15761583
roi_count = property(get_roi_count, set_roi_count)
1584+
1585+
def roi(self, index=0):
1586+
'''Return an ROI node by index'''
1587+
return self.ROI(self.root_node.findall(qn(self.ns['ome'], "ROI"))[index])
15771588

15781589
class ROI(object):
15791590

@@ -1607,17 +1618,13 @@ def Union(self):
16071618
'''The OME/ROI/Union element.'''
16081619
return OMEXML.Union(self.node.find(qn(self.ns['ome'], "Union")))
16091620

1610-
def roi(self, index=0):
1611-
'''Return an ROI node by index'''
1612-
return self.ROI(self.root_node.findall(qn(self.ns['ome'], "ROI"))[index])
1613-
16141621
class Union(object):
16151622

16161623
def __init__(self, node):
16171624
self.node = node
16181625
self.ns = get_namespaces(self.node)
16191626

1620-
def Rectangle(self, index=0):
1627+
def rectangle(self, index=0):
16211628
'''The OME/ROI/Union element. Currently only rectangle ROIs are available.'''
16221629
return OMEXML.Rectangle(self.node.find(qn(self.ns['ome'], "Rectangle")))
16231630

0 commit comments

Comments
 (0)