@@ -78,6 +78,7 @@ def __init__(self, viewer: "napari.viewer.Viewer"):
7878 self .keep_on_cpu = False
7979 self .use_window_inference = False
8080 self .window_inference_size = None
81+ self .window_overlap_percentage = None
8182
8283 ###########################
8384 # interface
@@ -134,6 +135,17 @@ def __init__(self, viewer: "napari.viewer.Viewer"):
134135 self .window_infer_box .clicked .connect (self .toggle_display_window_size )
135136
136137 sizes_window = ["8" , "16" , "32" , "64" , "128" , "256" , "512" ]
138+ # (
139+ # self.window_size_choice,
140+ # self.lbl_window_size_choice,
141+ # ) = ui.make_combobox(sizes_window, label="Window size and overlap")
142+ # self.window_overlap = ui.make_n_spinboxes(
143+ # max=1,
144+ # default=0.7,
145+ # step=0.05,
146+ # double=True,
147+ # )
148+
137149 self .window_size_choice = ui .DropdownMenu (
138150 sizes_window , label = "Window size"
139151 )
@@ -146,6 +158,11 @@ def __init__(self, viewer: "napari.viewer.Viewer"):
146158 self .lbl_window_size_choice ,
147159 horizontal = False ,
148160 )
161+ # self.window_infer_params = ui.combine_blocks(
162+ # self.window_overlap,
163+ # self.window_infer_params,
164+ # horizontal=False,
165+ # )
149166
150167 ##################
151168 ##################
@@ -216,7 +233,7 @@ def __init__(self, viewer: "napari.viewer.Viewer"):
216233 "Displays the image used for inference in the viewer"
217234 )
218235 self .segres_size .setToolTip (
219- "Image size on which the SegResNet has been trained (default : 128)"
236+ "Image size on which the model has been trained (default : 128)"
220237 )
221238
222239 thresh_desc = (
@@ -234,6 +251,11 @@ def __init__(self, viewer: "napari.viewer.Viewer"):
234251 self .window_size_choice .setToolTip (
235252 "Size of the window to run inference with (in pixels)"
236253 )
254+
255+ # self.window_overlap.setToolTip(
256+ # "Amount of overlap between sliding windows"
257+ # )
258+
237259 self .keep_data_on_cpu_box .setToolTip (
238260 "If enabled, data will be kept on the RAM rather than the VRAM.\n Can avoid out of memory issues with CUDA"
239261 )
@@ -281,7 +303,10 @@ def check_ready(self):
281303 return False
282304
283305 def toggle_display_segres_size (self ):
284- if self .model_choice .currentText () == "SegResNet" :
306+ if (
307+ self .model_choice .currentText () == "SegResNet"
308+ or self .model_choice .currentText () == "SwinUNetR"
309+ ):
285310 self .segres_size .setVisible (True )
286311 else :
287312 self .segres_size .setVisible (False )
@@ -600,6 +625,7 @@ def start(self, on_layer=False):
600625 self .window_inference_size = int (
601626 self .window_size_choice .currentText ()
602627 )
628+ # self.window_overlap_percentage = self.window_overlap.value()
603629
604630 if not on_layer :
605631 self .worker = InferenceWorker (
@@ -724,8 +750,6 @@ def on_yield(data, widget):
724750
725751 zoom = widget .zoom
726752
727- # print(data["original"].shape)
728- # print(data["result"].shape)
729753
730754 viewer .dims .ndisplay = 3
731755 viewer .scale_bar .visible = True
0 commit comments