-
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
Merged
Merged
P/segmethod cleanup #289
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
033706f
Refactor SegmentationMethod (#290)
peterhollender 8d88400
Re-added dataclass to fix unit tests (#290)
peterhollender 2a82e21
Fix ABC, add tests (#290)
peterhollender 4d8610e
Update db_dvc.dvc (#290)
peterhollender 687e678
Remove `get_materials` from Material class (#290)
arhowe00 4ef1b6c
Add tests for Material class (#290)
arhowe00 195bab4
Correct `seg_method` tests (#290)
arhowe00 5260d5e
Simplify and enforce structured input in `SegmentationMethod.from_dic…
arhowe00 12c9e29
Move and simplify `SegmentationMethod.to_dict` (#290)
arhowe00 5ea4cf4
Improve type safety of `_segment` (#290)
arhowe00 1a36770
Accepting ruff to update dvc again (#290)
peterhollender 0b7f8e9
Remove extraneous explicit class attribute in uniform to_dict (#290)
peterhollender b151fc9
Remove `to_dict` overrides in seg methods and improve type safety (#290)
arhowe00 73035be
Modify `SegmentationMethod.from_dict` to handle water/tissue (#290)
arhowe00 89f6a64
Update db_dvc (#290)
arhowe00 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| outs: | ||
| - md5: bf109e310734c61c0eecff737562b425.dir | ||
| nfiles: 257 | ||
| - md5: b7b8aea2669121775f0de4df5d046d6e.dir | ||
| nfiles: 797 | ||
| hash: md5 | ||
| path: db_dvc | ||
| size: 933880511 | ||
| size: 2357261179 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,9 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from . import seg_method | ||
| from .seg_method import SegmentationMethod, UniformSegmentation | ||
| from .tissue import Tissue | ||
| from .water import Water | ||
| from .uniform import UniformSegmentation, UniformTissue, UniformWater | ||
|
|
||
| __all__ = [ | ||
| "seg_method", | ||
| "SegmentationMethod", | ||
| "UniformSegmentation", | ||
| "Water", | ||
| "Tissue", | ||
| "UniformWater", | ||
| "UniformTissue", | ||
| ] |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import xarray as xa | ||
|
|
||
| from openlifu.seg.material import MATERIALS, Material | ||
| from openlifu.seg.seg_method import SegmentationMethod | ||
|
|
||
|
|
||
| class UniformSegmentation(SegmentationMethod): | ||
| def _segment(self, volume: xa.DataArray): | ||
| return self._ref_segment(volume.coords) | ||
|
|
||
| class UniformTissue(UniformSegmentation): | ||
| """ Assigns the tissue material to all voxels in the volume. """ | ||
| def __init__(self, materials: dict[str, Material] | None = None): | ||
| if materials is None: | ||
| materials = MATERIALS.copy() | ||
| super().__init__(materials=materials, ref_material="tissue") | ||
|
|
||
| class UniformWater(UniformSegmentation): | ||
| """ Assigns the water material to all voxels in the volume. """ | ||
| def __init__(self, materials: dict[str, Material] | None = None): | ||
| if materials is None: | ||
| materials = MATERIALS.copy() | ||
| super().__init__(materials=materials, ref_material="water") | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.