SCIInstitute / ShapeWorks

ShapeWorks
http://sciinstitute.github.io/ShapeWorks/
Other
100 stars 32 forks source link

Studio DeepSSM Phase 2/3 #2181

Closed akenmorris closed 5 months ago

akenmorris commented 6 months ago

Refactor deep_ssm.py script into DeepSSMUtils, switch to using ShapeWorks Project files directly for all steps, allowing it to be used more easily by Studio. The results are similar to before but not identical because some steps are a little bit different. For example, Grooming using ShapeWorks Groom library uses center of mass rather than just the mesh bounding box center.

Implement DeepSSM Phase 2 and 3 in Studio. Single prep button performs all steps except augmentation, training, test. Does not require that any grooming or optimization has been done.

image

I had started by replicating all the steps from the phase 2 deep_ssm.py script, but then realized I would either need to integrate C++ Elastix into ShapeWorks, or call out to Python for that step. At that point I realized it would be a better idea to simply call out to Python for almost everything. This necessitated refactoring deep_ssm.py script into DeepSSMUtils using ShapeWorks project objects rather than lists of filenames. It utilizes the new exclude functionality in ShapeWorks projects to mark the validation and test subjects as excluded for the first grooming and optimization steps. Then the training data is marked as fixed and the validation subjects are marked un-excluded for grooming and optimization. The image grooming steps are mostly the same, but now read/write from the project file. I added the image registration transforms as extra columns in the table for later use.

This approach should allow the Python, Studio and Cloud versions of DeepSSM to share the vast majority of code.

This PR also supports Phase 3 by allowing subjects to have only an image. These subjects will be assigned as test separately from the train/val/test split assignment.

You can also add images to a completed DeepSSM model and manual mark them as test and re-run only the testing phase. The new images just won't have a distance map or average error (as there is no ground truth mesh)

image
akenmorris commented 5 months ago

@jadie1 @zahidemon @JakeWags , the docs have been updated with the new LA dataset. Have a look. I believe this is ready to merge.