Skip to content

Commit c5a31dc

Browse files
committed
zmap when there are more than 255 Zs
1 parent e9aa17f commit c5a31dc

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/fish_feats/MainImage.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ def updateCellsZPos( self, step_size=100, window_size=150, save=False ):
522522
self.pop.updateCellsZPosFromMap(zmap)
523523
if save:
524524
filename = self.get_filename( endname="_zmap.tif" )
525-
self.save_image( zmap, filename, hasZ=False, imtype="uint8" )
525+
self.save_image( zmap, filename, hasZ=False, imtype=zmap.dtype )
526526

527527
def updateCellZPos(self, cell_label, zpos, img=None):
528528
""" Update the position of the given cell """
@@ -1141,7 +1141,10 @@ def calculate_zmap(self, projimg, step_size, window_size):
11411141
junstain = self.image[self.junchan]
11421142
ut.show_warning("Load junction staining (separated if necessary) before")
11431143
return
1144-
zmap = np.zeros(projimg.shape, "uint8")
1144+
if self.imshape[0] > 255:
1145+
zmap = np.zeros(projimg.shape, "uint16")
1146+
else:
1147+
zmap = np.zeros(projimg.shape, "uint8")
11451148
for i, x in enumerate(range(0, projimg.shape[0], step_size)):
11461149
zmap_cur = process_x( x, step=step_size, projimg=projimg, img=junstain, winsize=window_size )
11471150
zmap[x:(x+step_size),:] = zmap_cur

0 commit comments

Comments
 (0)