@@ -81,19 +81,21 @@ def reset_ops(self):
8181 def create_buttons (self ):
8282 self .intkeys = ['nplanes' , 'nchannels' , 'functional_chan' , 'align_by_chan' , 'nimg_init' ,
8383 'batch_size' , 'max_iterations' , 'nbinned' ,'inner_neuropil_radius' ,
84- 'min_neuropil_pixels' , 'spatial_scale' , 'do_registration' ]
84+ 'min_neuropil_pixels' , 'spatial_scale' , 'do_registration' , 'anatomical_only' ]
8585 self .boolkeys = ['delete_bin' , 'move_bin' ,'do_bidiphase' , 'reg_tif' , 'reg_tif_chan2' ,
8686 'save_mat' , 'save_NWB' 'combined' , '1Preg' , 'nonrigid' ,
8787 'connected' , 'roidetect' , 'neuropil_extract' ,
8888 'spikedetect' , 'keep_movie_raw' , 'allow_overlap' , 'sparse_mode' ]
89+ self .stringkeys = ['pretrained_model' ]
8990 tifkeys = ['nplanes' ,'nchannels' ,'functional_chan' ,'tau' ,'fs' ,'do_bidiphase' ,'bidiphase' , 'multiplane_parallel' , 'ignore_flyback' ]
9091 outkeys = ['preclassify' ,'save_mat' ,'save_NWB' ,'combined' ,'reg_tif' ,'reg_tif_chan2' ,'aspect' ,'delete_bin' ,'move_bin' ]
9192 regkeys = ['do_registration' ,'align_by_chan' ,'nimg_init' ,'batch_size' ,'smooth_sigma' , 'smooth_sigma_time' ,'maxregshift' ,'th_badframes' ,'keep_movie_raw' ,'two_step_registration' ]
9293 nrkeys = [['nonrigid' ,'block_size' ,'snr_thresh' ,'maxregshiftNR' ], ['1Preg' ,'spatial_hp_reg' ,'pre_smooth' ,'spatial_taper' ]]
93- cellkeys = ['roidetect' , 'denoise' , 'anatomical_only' , 'diameter' , 'spatial_scale' , 'threshold_scaling' , 'max_overlap' ,'max_iterations' ,'high_pass' ]
94+ cellkeys = ['roidetect' , 'denoise' , 'spatial_scale' , 'threshold_scaling' , 'max_overlap' ,'max_iterations' ,'high_pass' ,'spatial_hp_detect' ]
95+ anatkeys = ['anatomical_only' , 'diameter' , 'cellprob_threshold' , 'flow_threshold' , 'pretrained_model' , 'spatial_hp_cp' ]
9496 neudeconvkeys = [['neuropil_extract' , 'allow_overlap' ,'inner_neuropil_radius' ,'min_neuropil_pixels' ], ['soma_crop' ,'spikedetect' ,'win_baseline' ,'sig_baseline' ,'neucoeff' ]]
95- keys = [tifkeys , outkeys , regkeys , nrkeys , cellkeys , neudeconvkeys ]
96- labels = ['Main settings' ,'Output settings' ,'Registration' ,['Nonrigid' ,'1P' ],'ROI detection' , ['Extraction/Neuropil' ,'Classification/Deconvolution ' ]]
97+ keys = [tifkeys , outkeys , regkeys , nrkeys , cellkeys , anatkeys , neudeconvkeys ]
98+ labels = ['Main settings' ,'Output settings' ,'Registration' ,['Nonrigid' ,'1P' ],'Functional detect' , 'Anat detect' , ['Extraction/Neuropil' ,'Classify/Deconv ' ]]
9799 tooltips = ['each tiff has this many planes in sequence' ,
98100 'each tiff has this many channels per plane' ,
99101 'this channel is used to extract functional ROIs (1-based)' ,
@@ -130,15 +132,20 @@ def create_buttons(self):
130132 'window for spatial high-pass filtering before registration' ,
131133 'whether to smooth before high-pass filtering before registration' ,
132134 "how much to ignore on edges (important for vignetted windows, for FFT padding do not set BELOW 3*smooth_sigma)" ,
133- 'if 1, run cell (ROI) detection' ,
135+ 'if 1, run cell (ROI) detection (either functional or anatomical if anatomical_only > 0) ' ,
134136 'if 1, run PCA denoising on binned movie to improve cell detection' ,
135- 'run cellpose to get masks on 1: max_proj / mean_img; 2: mean_img; or 3: mean_img enhanced' ,
136- 'if anatomical_only>0, input average diameter of ROIs in recording (can give a list e.g. 6,9)' ,
137- 'if anatomical_only=0, choose size of ROIs: 0 = multi-scale; 1 = 6 pixels, 2 = 12, 3 = 24, 4 = 48' ,
137+ 'choose size of ROIs: 0 = multi-scale; 1 = 6 pixels, 2 = 12, 3 = 24, 4 = 48' ,
138138 'adjust the automatically determined threshold for finding ROIs by this scalar multiplier' ,
139139 'ROIs with greater than this overlap as a fraction of total pixels will be discarded' ,
140140 'maximum number of iterations for ROI detection' ,
141- 'running mean subtraction with window of size "high_pass" (use low values for 1P)' ,
141+ 'temporal running mean subtraction with window of size "high_pass" (use low values for 1P)' ,
142+ 'spatial high-pass filter size (used to remove spatially-correlated neuropil)' ,
143+ 'run cellpose to get masks on 1: max_proj / mean_img; 2: mean_img; 3: mean_img enhanced, 4: max_proj' ,
144+ 'input average diameter of ROIs in recording (can give a list e.g. 6,9 if aspect not equal), if set to 0 auto-determination run by Cellpose' ,
145+ 'cellprob_threshold for cellpose' ,
146+ 'flow_threshold for cellpose (throws out masks, if getting too few masks, set to 0)' ,
147+ 'high-pass image spatially by a multiple of the diameter (if field is non-uniform, a value of ~2 is recommended' ,
148+ 'model type string from Cellpose (can be a built-in model or a user model that is added to the Cellpose GUI)' ,
142149 'whether or not to extract neuropil; if 0, Fneu is set to 0' ,
143150 'allow shared pixels to be used for fluorescence extraction from overlapping ROIs (otherwise excluded from both ROIs)' ,
144151 'number of pixels between ROI and neuropil donut' ,
@@ -147,7 +154,8 @@ def create_buttons(self):
147154 'if 1, run spike detection (deconvolution)' ,
148155 'window for maximin' ,
149156 'smoothing constant for gaussian filter' ,
150- 'neuropil coefficient' ]
157+ 'neuropil coefficient' ,
158+ ]
151159
152160 bigfont = QtGui .QFont ("Arial" , 10 , QtGui .QFont .Bold )
153161 qlabel = QLabel ('File paths' )
@@ -263,7 +271,7 @@ def create_buttons(self):
263271 self .layout .addWidget (self .binlabel ,19 ,0 ,1 ,cw )
264272 self .runButton = QPushButton ('RUN SUITE2P' )
265273 self .runButton .clicked .connect (self .run_S2P )
266- n0 = 21
274+ n0 = 22
267275 self .layout .addWidget (self .runButton ,n0 ,0 ,1 ,1 )
268276 self .runButton .setEnabled (False )
269277 self .textEdit = QTextEdit ()
@@ -289,7 +297,7 @@ def create_buttons(self):
289297 self .cleanButton .clicked .connect (self .clean_script )
290298 self .cleanLabel = QLabel ('' )
291299 self .layout .addWidget (self .cleanLabel ,n0 ,4 ,1 ,12 )
292- n0 += 1
300+ # n0+=1
293301 self .listOps = QPushButton ('save settings and\n add more (batch)' )
294302 self .listOps .clicked .connect (self .add_batch )
295303 self .layout .addWidget (self .listOps ,n0 ,12 ,1 ,2 )
@@ -357,7 +365,7 @@ def add_ops(self):
357365
358366 def compile_ops_db (self ):
359367 for k ,key in enumerate (self .keylist ):
360- self .ops [key ] = self .editlist [k ].get_text (self .intkeys , self .boolkeys )
368+ self .ops [key ] = self .editlist [k ].get_text (self .intkeys , self .boolkeys , self . stringkeys )
361369 self .db = {}
362370 self .db ['data_path' ] = self .data_path
363371 self .db ['subfolders' ] = []
@@ -606,7 +614,7 @@ def __init__(self,k,key,parent=None):
606614 self .key = key
607615 #self.textEdited.connect(lambda: self.edit_changed(parent.ops, k))
608616
609- def get_text (self ,intkeys ,boolkeys ):
617+ def get_text (self ,intkeys ,boolkeys , stringkeys ):
610618 key = self .key
611619 if key == 'diameter' or key == 'block_size' :
612620 diams = self .text ().replace (' ' ,'' ).split (',' )
@@ -625,6 +633,8 @@ def get_text(self,intkeys,boolkeys):
625633 okey = int (float (self .text ()))
626634 elif key in boolkeys :
627635 okey = bool (int (self .text ()))
636+ elif key in stringkeys :
637+ okey = self .text ()
628638 else :
629639 okey = float (self .text ())
630640 return okey
0 commit comments