File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
src/segmentation_skeleton_metrics/utils Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -167,22 +167,30 @@ class TiffReader(ImageReader):
167167 Class that reads an image with the Tifffile library.
168168 """
169169
170- def __init__ (self , img_path ):
170+ def __init__ (self , img_path , swap_axes = True ):
171171 """
172172 Instantiates a TiffReader image reader.
173173
174174 Parameters
175175 ----------
176176 img_path : str
177177 Path to a TIFF image.
178+ swap_axes : bool, optional
179+ Indication of whether to swap axes 0 and 2. Default is True.
178180 """
181+ # Call parent class
179182 super ().__init__ (img_path )
180183
184+ # Instance attributes
185+ self .swap_axes = swap_axes
186+
181187 def _load_image (self ):
182188 """
183189 Loads image using the Tifffile library.
184190 """
185191 self .img = imread (self .img_path )
192+ if self .swap_axes :
193+ self .img = np .swapaxes (self .img , 0 , 2 )
186194
187195
188196# --- Miscellaneous ---
You can’t perform that action at this time.
0 commit comments