Skip to content

Commit 5b994f5

Browse files
committed
TODO cleanup
1 parent ed865a9 commit 5b994f5

File tree

8 files changed

+23
-39
lines changed

8 files changed

+23
-39
lines changed

napari_cellseg3d/code_models/instance_segmentation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def run_method(self, image):
9999

100100
def _make_list_from_channels(
101101
self, image
102-
): # TODO(cyril) : adapt to batch dimension
102+
): # TODO(cyril) : adapt to batch dimension (needed ?)
103103
if len(image.shape) > 4:
104104
raise ValueError(
105105
f"Image has {len(image.shape)} dimensions, but should have at most 4 dimensions (CHWD)"

napari_cellseg3d/code_models/worker_training.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,7 @@ def train(self):
282282
size = self.config.sample_size if do_sampling else check
283283

284284
PADDING = utils.get_padding_dim(size)
285-
model = model_class( # FIXME check if correct
286-
input_img_size=PADDING, use_checkpoint=True
287-
)
285+
model = model_class(input_img_size=PADDING, use_checkpoint=True)
288286
model = model.to(self.config.device)
289287

290288
epoch_loss_values = []
@@ -570,7 +568,7 @@ def get_loader_func(num_samples):
570568
if outputs.shape[1] > 1:
571569
outputs = outputs[
572570
:, 1:, :, :
573-
] # FIXME fix channel number
571+
] # TODO(cyril): adapt if additional channels
574572
if len(outputs.shape) < 4:
575573
outputs = outputs.unsqueeze(0)
576574
loss = self.config.loss_function(outputs, labels)
@@ -632,17 +630,15 @@ def get_loader_func(num_samples):
632630
)
633631
except Exception as e:
634632
self.raise_error(e, "Error during validation")
633+
635634
logger.debug(
636635
f"val_outputs shape : {val_outputs.shape}"
637636
)
638637
# val_outputs = model(val_inputs)
639638

640639
pred = decollate_batch(val_outputs)
641-
642640
labs = decollate_batch(val_labels)
643-
644641
# TODO : more parameters/flexibility
645-
646642
post_pred = Compose(
647643
[
648644
RemapTensor(new_max=1, new_min=0),
@@ -668,15 +664,15 @@ def get_loader_func(num_samples):
668664

669665
# logger.debug(len(val_outputs))
670666
# logger.debug(len(val_labels))
671-
dice_test = np.array( # TODO(cyril): remove
672-
[
673-
utils.dice_coeff(i, j)
674-
for i, j in zip(val_outputs, val_labels)
675-
]
676-
)
677-
logger.debug(
678-
f"TEST VALIDATION Dice score : {dice_test.mean()}"
679-
)
667+
# dice_test = np.array(
668+
# [
669+
# utils.dice_coeff(i, j)
670+
# for i, j in zip(val_outputs, val_labels)
671+
# ]
672+
# )
673+
# logger.debug(
674+
# f"TEST VALIDATION Dice score : {dice_test.mean()}"
675+
# )
680676

681677
dice_metric(y_pred=val_outputs, y=val_labels)
682678

napari_cellseg3d/code_plugins/plugin_base.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,6 @@ def _build(self):
220220
"""Method to be defined by children classes"""
221221
raise NotImplementedError("To be defined in child classes")
222222

223-
# def _show_filetype_choice(self): # TODO(cyril): remove?
224-
# """Method to show/hide the filetype choice when "loading as folder" is (de)selected"""
225-
# show = self.load_as_stack_choice.isChecked()
226-
# if show is not None:
227-
# self.filetype_choice.setVisible(show)
228-
# # self.lbl_ft.setVisible(show)
229-
230223
def _show_file_dialog(self):
231224
"""Open file dialog and process path for a single file"""
232225
# if self.load_as_stack_choice.isChecked():

napari_cellseg3d/code_plugins/plugin_crop.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __init__(self, viewer: "napari.viewer.Viewer", parent=None):
3737
"""
3838

3939
super().__init__(viewer)
40-
self.docked_widgets = [] # TODO add remove on close
40+
self.docked_widgets = []
4141
self.results_path = Path.home() / Path("cellseg3d/cropped")
4242

4343
self.btn_start = ui.Button("Start", self._start)
@@ -266,9 +266,6 @@ def _start(self):
266266
"""Launches cropping process by loading the files from the chosen folders,
267267
and adds control widgets to the napari Viewer for moving the cropped volume.
268268
"""
269-
# TODO maybe implement proper reset function so multiple runs can be done without closing napari
270-
# maybe use singletons or make docked widgets attributes that are hidden upon opening
271-
272269
if not self._check_ready():
273270
logger.warning("Please select at least one valid layer !")
274271
return
@@ -355,7 +352,7 @@ def add_isotropic_layer(
355352
self,
356353
layer,
357354
colormap="inferno",
358-
contrast_lim=(200, 1000), # TODO generalize ?
355+
contrast_lim=(200, 1000),
359356
opacity=0.7,
360357
visible=True,
361358
):

napari_cellseg3d/code_plugins/plugin_model_inference.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ def __init__(self, viewer: "napari.viewer.Viewer", parent=None):
124124

125125
self.anisotropy_wdgt = ui.AnisotropyWidgets(
126126
self,
127-
default_x=1.5,
128-
default_y=1.5,
129-
default_z=5, # TODO change default
127+
default_x=1,
128+
default_y=1,
129+
default_z=1,
130130
)
131131

132132
# self.worker_config.post_process_config.zoom.zoom_values = [

napari_cellseg3d/code_plugins/plugin_model_training.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ def __init__(
167167
self.validation_values = []
168168

169169
# self.model_choice.setCurrentIndex(0)
170-
################### # TODO(cyril) : disable if we implement WNet training
170+
###################
171+
# TODO(cyril) : disable if we implement WNet training
171172
wnet_index = self.model_choice.findText("WNet")
172173
self.model_choice.removeItem(wnet_index)
173-
174174
################################
175175
# interface
176176

@@ -911,7 +911,7 @@ def _set_worker_config(self) -> config.TrainingWorkerConfig:
911911
sample_size=patch_size,
912912
do_augmentation=self.augment_choice.isChecked(),
913913
deterministic_config=deterministic_config,
914-
) # TODO(cyril) continue to put params in config
914+
)
915915

916916
return self.worker_config
917917

napari_cellseg3d/code_plugins/plugin_review.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,7 @@ def _build(self):
144144
# self._show_io_element(self.results_filewidget)
145145

146146
self.results_filewidget.text_field.setText(
147-
str(
148-
Path.home() / Path("cellseg3d/review")
149-
) # TODO(cyril) : check proper behaviour
147+
str(Path.home() / Path("cellseg3d/review"))
150148
)
151149

152150
csv_param_w.setLayout(csv_param_l)

napari_cellseg3d/interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,7 @@ def combine_blocks( # TODO FIXME PLEASE this is a horrible design
13601360
b=11,
13611361
):
13621362
"""Combines two QWidget objects and puts them side by side (first on the left/top and second on the right/bottom depending on "horizontal")
1363-
Weird argument names due the initial implementation of it. # TODO maybe fix arg names
1363+
Weird argument names due the initial implementation of it. # TODO maybe fix arg names or refactor
13641364
13651365
Args:
13661366
left_or_above (QWidget): First widget, to be added on the left/above of "second"

0 commit comments

Comments
 (0)