-
Notifications
You must be signed in to change notification settings - Fork 2
ENH: Movement evaluation workflow and end-to-end tutorials 11-13 #120
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
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
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
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
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,73 @@ | ||
| ========================================== | ||
| Scoring a Mesh-Stage Model Against Images | ||
| ========================================== | ||
|
|
||
| .. module:: physiotwin4d.workflow_evaluate_movement | ||
| .. currentmodule:: physiotwin4d | ||
|
|
||
| A mm error against the surfaces a registration produced says how well the | ||
| network reproduces that registration. :class:`WorkflowEvaluateMovement` asks the | ||
| other question: how close are the size and shape of the inferred anatomy to the | ||
| anatomy that was actually imaged, structure by structure. See Tutorial 11 in | ||
| :doc:`../../tutorials`. | ||
|
|
||
| For every gated time point it carries the reference frame's labelmap into that | ||
| time point with the network's own deformation, and compares the result to the | ||
| labelmap of the frame that was acquired: volume difference, Dice and surface | ||
| RMSE per lung lobe or per heart chamber. | ||
|
|
||
| Per-structure scoring | ||
| ===================== | ||
|
|
||
| .. autoclass:: WorkflowEvaluateMovement | ||
| :members: | ||
| :undoc-members: | ||
| :show-inheritance: | ||
|
|
||
| Example | ||
| ======= | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| from physiotwin4d import ( | ||
| WorkflowEvaluateMovement, | ||
| WorkflowInferMovement, | ||
| WorkflowInferPhysicsNeMo, | ||
| ) | ||
|
|
||
| evaluate = WorkflowEvaluateMovement( | ||
| movement_workflow=WorkflowInferMovement( | ||
| WorkflowInferPhysicsNeMo(model_directory=model_dir) | ||
| ), | ||
| label_names={28: "lung_upper_lobe_left", 29: "lung_lower_lobe_left"}, | ||
| ) | ||
| result = evaluate.process( | ||
| case_id="Case1Pack", | ||
| shape_parameters=pca_coefficients_file, | ||
| reference_mesh=ssm_surface_file, | ||
| reference_labelmap=reference_labelmap, | ||
| ground_truth_labelmaps={0.0: frame_00, 0.1: frame_10}, | ||
| output_directory=out_dir, | ||
| ) | ||
| print(result["report_file"], result["csv_file"]) | ||
|
|
||
| Notes | ||
| ===== | ||
|
|
||
| **Why labelmaps rather than the model's surface.** The lung shape model carries | ||
| its five lobes as per-cell labels, but the heart model is a single structure --- | ||
| the whole heart minus its chamber cavities --- so its chambers exist only in the | ||
| acquired labelmaps. Warping those labelmaps scores every structure the | ||
| acquisition contains, whether or not the shape model represents it separately. | ||
|
|
||
| **The evaluation grid.** Everything is measured on one isotropic grid built | ||
| around the reference anatomy, so a case whose gated frames carry different slice | ||
| pitches is still scored on a single, stated voxel volume. Its pitch sets both | ||
| that voxel volume and the memory the per-stage deformation fields take, which | ||
| grows with its cube. | ||
|
|
||
| See Also | ||
| ======== | ||
|
|
||
| * :doc:`infer` | ||
| * :doc:`train` |
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
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.