@@ -152,11 +152,12 @@ def _on_model_name_changed(model_name: str):
152
152
widget_unet_predictions .model_name .tooltip = f'Select a pretrained model. Current model description: { description } '
153
153
154
154
155
- def _compute_multiple_predictions (image , patch_size , device ):
155
+ def _compute_multiple_predictions (image , patch_size , device , use_custom_models = True ):
156
156
out_layers = []
157
- for i , model_name in enumerate (list_models ()):
157
+ model_list = list_models (use_custom_models = use_custom_models )
158
+ for i , model_name in enumerate (model_list ):
158
159
159
- napari_formatted_logging (f'Running UNet Predictions: { model_name } { i } /{ len (list_models () )} ' ,
160
+ napari_formatted_logging (f'Running UNet Predictions: { model_name } { i } /{ len (model_list )} ' ,
160
161
thread = 'UNet Grid Predictions' )
161
162
162
163
out_name = create_layer_name (image .name , model_name )
@@ -182,15 +183,19 @@ def _compute_multiple_predictions(image, patch_size, device):
182
183
patch_size = {'label' : 'Patch size' ,
183
184
'tooltip' : 'Patch size use to processed the data.' },
184
185
device = {'label' : 'Device' ,
185
- 'choices' : ALL_DEVICES }
186
+ 'choices' : ALL_DEVICES },
187
+ use_custom_models = {'label' : 'Use custom models' ,
188
+ 'tooltip' : 'If True, custom models will also be used.' }
186
189
)
187
190
def widget_test_all_unet_predictions (image : Image ,
188
191
patch_size : Tuple [int , int , int ] = (80 , 170 , 170 ),
189
- device : str = ALL_DEVICES [0 ]) -> Future [List [LayerDataTuple ]]:
192
+ device : str = ALL_DEVICES [0 ],
193
+ use_custom_models : bool = True ) -> Future [List [LayerDataTuple ]]:
190
194
func = thread_worker (partial (_compute_multiple_predictions ,
191
195
image = image ,
192
196
patch_size = patch_size ,
193
- device = device ))
197
+ device = device ,
198
+ use_custom_models = use_custom_models ,))
194
199
195
200
future = Future ()
196
201
0 commit comments