-
Notifications
You must be signed in to change notification settings - Fork 7
P/segmethod cleanup #289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
P/segmethod cleanup #289
Conversation
78cc9cb to
64316b6
Compare
fc48ddb to
32190b1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great! I made some changes to simplify the base class and added type annotations, which have been incredibly helpful. I also added tests for Material and additional tests for SegmentationMethod.
I didn't make changes on more substantive questions I had, so I left those as comments.
When you look at these, I'll see if there are any more tests I can add so this integrates with the app
arhowe00
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional question I noticed when testing things out.
This commit is a wip based on the outcome of Peter's comments regarding the inheritance. If the 3 layer inheritance is preferred, then you will have to subclass this. OpenwaterHealth/OpenLIFU-python#289 (review)
This commit subclasses the `SegmentationMethod` configurer to account for the unique inheritance structure of `SegmentationMethods`. In brief, there are three levels of inheritance, but the last two levels are supposed to be alternative selections. Between the alternative selections, two of them (`UniformWater` and `UniformTissue`) are supposed to be the same as `UniformSegmentation` except that `ref_material` is set as water/tissue and is not intended to be mutable. The subclassing of the definition form takes all these details into account. [See the discussion on GitHub here.](OpenwaterHealth/OpenLIFU-python#289 (comment))
This class was redundant and the functionality was ill-defined. Doing a `git grep` on SlicerOpenLIFU cf446f8aa9793fbb64d1431a5b991d5740fc503e and HEAD revealed no other uses of `get_materials`.
…t` (#290) Removes string-based shortcuts to ensure type safety. Adds recursive construction of Material instances for clean, nested deserialization.
Consolidated `to_dict` implementation by moving it to the top of the class and simplifying the logic using `__dict__.copy()` with a recursive override for `materials`.
fd8993a to
21d2ba8
Compare
Note: `to_dict` should not discard `ref_material` because it is an attribute of the class. However, `from_dict` needs to be overridden to instead account for the overridden constructor which does not use `ref_material` in the construction of the derived objects `UniformTissue` and `UniformWater`.
- Also update associated JSON files to include the `ref_material` for all `SegmentationMethod`s, even if it is not intended to change.
This commit updates db_dvc by running the script scripts/standardize_database.py and adding back `ref_material` for `UniformWater` and `UniformTissue`. Furthermore, the following non-jpg files were removed from the photocollections/ in db_dvc, as photocollections should not contain files of the following kind: ```sh db_dvc/subjects/soren/sessions/test session/photocollections/Soren_repeat_2/texture_1001.exr db_dvc/subjects/soren/sessions/test session/photocollections/Soren_repeat_2/texture_1002.exr db_dvc/subjects/soren/sessions/test session/photocollections/Soren_repeat_2/texturedMesh.mtl db_dvc/subjects/soren/sessions/test session/photocollections/Soren_repeat_2/texturedMesh.obj db_dvc/subjects/soren/sessions/test session/photocollections/Soren_repeat_3/texture_1001.exr db_dvc/subjects/soren/sessions/test session/photocollections/Soren_repeat_3/texture_1002.exr db_dvc/subjects/soren/sessions/test session/photocollections/Soren_repeat_3/texturedMesh.mtl db_dvc/subjects/soren/sessions/test session/photocollections/Soren_repeat_3/texturedMesh.obj db_dvc/subjects/soren/sessions/test session/photocollections/Soren_repeat_4/texture_1001.exr db_dvc/subjects/soren/sessions/test session/photocollections/Soren_repeat_4/texture_1002.exr db_dvc/subjects/soren/sessions/test session/photocollections/Soren_repeat_4/texturedMesh.mtl db_dvc/subjects/soren/sessions/test session/photocollections/Soren_repeat_4/texturedMesh.obj db_dvc/subjects/soren/sessions/test session/photocollections/Soren_repeat_5/texture_1001.exr db_dvc/subjects/soren/sessions/test session/photocollections/Soren_repeat_5/texture_1002.exr db_dvc/subjects/soren/sessions/test session/photocollections/Soren_repeat_5/texturedMesh.mtl db_dvc/subjects/soren/sessions/test session/photocollections/Soren_repeat_5/texturedMesh.obj ```
21d2ba8 to
89f6a64
Compare
arhowe00
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I did test this branch in the extension, and the previous issues with using segmentation methods went away.
This commit subclasses the `SegmentationMethod` configurer to account for the unique inheritance structure of `SegmentationMethods`. In brief, there are three levels of inheritance, but the last two levels are supposed to be alternative selections. Between the alternative selections, two of them (`UniformWater` and `UniformTissue`) are supposed to be the same as `UniformSegmentation` except that `ref_material` is set as water/tissue and is not intended to be mutable. The subclassing of the definition form takes all these details into account. [See the discussion on GitHub here.](OpenwaterHealth/OpenLIFU-python#289 (comment))
This commit subclasses the `SegmentationMethod` configurer to account for the unique inheritance structure of `SegmentationMethods`. In brief, there are three levels of inheritance, but the last two levels are supposed to be alternative selections. Between the alternative selections, two of them (`UniformWater` and `UniformTissue`) are supposed to be the same as `UniformSegmentation` except that `ref_material` is set as water/tissue and is not intended to be mutable. The subclassing of the definition form takes all these details into account. [See the discussion on GitHub here.](OpenwaterHealth/OpenLIFU-python#289 (comment))
This commit subclasses the `SegmentationMethod` configurer to account for the unique inheritance structure of `SegmentationMethods`. In brief, there are three levels of inheritance, but the last two levels are supposed to be alternative selections. Between the alternative selections, two of them (`UniformWater` and `UniformTissue`) are supposed to be the same as `UniformSegmentation` except that `ref_material` is set as water/tissue and is not intended to be mutable. The subclassing of the definition form takes all these details into account. [See the discussion on GitHub here.](OpenwaterHealth/OpenLIFU-python#289 (comment))
Closes #290
Closes #299
This PR refactors the way SegmentationMethods work and adds a concrete example for transducer tracking in db_dvc. As in #299 , the updated data includes:
These can be found in:
These can be found in:
The corresponding photoscans and photocollections were added, and you can see the full list of references/ids in the following files:
Before merging
db_dvcfrom main and this branch.