@@ -501,7 +501,11 @@ def popFromJunctions(self, proj=None, zpos=False ):
501501 print ("Calculating the z-map to place cells in 3D" )
502502 zmap = self .calculate_zmap (proj , step_size = 200 , window_size = 250 )
503503
504- self .pop .createCellsFromMask (self .junmask , self .junstain , results , find_z = zpos , zmap = zmap , cells_direction = self .zdirection , talkative = self .verbose )
504+ if self .junstain is None :
505+ junstain = self .img [self .junchan ]
506+ else :
507+ junstain = self .junstain
508+ self .pop .createCellsFromMask (self .junmask , junstain , results , find_z = zpos , zmap = zmap , cells_direction = self .zdirection , talkative = self .verbose )
505509 ut .show_info ("Created " + str (len (self .pop .cells ))+ " cells" )
506510 return 1
507511
@@ -1129,14 +1133,17 @@ def tryTogether(self):
11291133
11301134 def calculate_zmap (self , projimg , step_size , window_size ):
11311135 """ Calculate the zmap of the cells position based on the projection """
1136+ junstain = self .junstain
11321137 if self .junstain is None :
11331138 self .check_separation ()
1139+ junstain = self .junstain
11341140 if self .junstain is None :
1141+ junstain = self .img [self .junchan ]
11351142 ut .show_warning ("Load junction staining (separated if necessary) before" )
11361143 return
11371144 zmap = np .zeros (projimg .shape , "uint8" )
11381145 for i , x in enumerate (range (0 , projimg .shape [0 ], step_size )):
1139- zmap_cur = process_x ( x , step = step_size , projimg = projimg , img = self . junstain , winsize = window_size )
1146+ zmap_cur = process_x ( x , step = step_size , projimg = projimg , img = junstain , winsize = window_size )
11401147 zmap [x :(x + step_size ),:] = zmap_cur
11411148 return zmap
11421149
0 commit comments