KitwareMedical / SlicerNNUnet

3D Slicer nnUNet integration to streamline usage for nnUNet based AI extensions.
BSD 3-Clause "New" or "Revised" License
12 stars 1 forks source link

Clicking Reload does not reload SlicerNNUNetLib #4

Closed lassoan closed 6 months ago

lassoan commented 6 months ago

It is very inconvenient to debug SlicerNNUnet module because you need to restart the application, load input data, etc. when scripts in SlicerNNUNetLib folders are changed. See an example how to reload a Python library here.

Thibault-Pelletier commented 6 months ago

Thank you for the link. I have implemented it.

Personally, I'm not a fan of the reloading. I usually do my testing / debug using Unit Tests and the PythonTestRunner module (by filtering the tests to run).

If you place the training weights in the Testing/Data folder, you should be able to run the test_widget_can_run_nn_unet_segmentation_logic integration test (see options below).

image

image

lassoan commented 6 months ago

Great, thank you!

If you only need to test some logic scripts in a separate executable then you can do away without reloading, but reloading is still needed for testing and troubleshooting of the full module.

I've noticed that you used glob for getting the filenames, which provides filenames in quasi random order. You need to reload files in the order based on their dependencies (starting with files that don't depend on others). If you reload files in different order then you usually need to reload several times until everything gets updated.

Thibault-Pelletier commented 6 months ago

Thank you for the feedback! I just changed the implementation to set the order by hand.