-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #115 from BrainLesion/config
Config
- Loading branch information
Showing
26 changed files
with
919 additions
and
273 deletions.
There are no files selected for viewing
This file contains 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 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 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,26 @@ | ||
import cProfile | ||
|
||
from auxiliary.nifti.io import read_nifti | ||
from auxiliary.turbopath import turbopath | ||
|
||
from panoptica import Panoptica_Evaluator | ||
|
||
directory = turbopath(__file__).parent | ||
|
||
reference_mask = read_nifti(directory + "/spine_seg/matched_instance/ref.nii.gz") | ||
prediction_mask = read_nifti(directory + "/spine_seg/matched_instance/pred.nii.gz") | ||
|
||
evaluator = Panoptica_Evaluator.load_from_config_name( | ||
"panoptica_evaluator_unmatched_instance" | ||
) | ||
|
||
|
||
with cProfile.Profile() as pr: | ||
if __name__ == "__main__": | ||
results = evaluator.evaluate(prediction_mask, reference_mask, verbose=False) | ||
for groupname, (result, debug) in results.items(): | ||
print() | ||
print("### Group", groupname) | ||
print(result) | ||
|
||
pr.dump_stats(directory + "/instance_example.log") |
This file contains 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 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
14 changes: 14 additions & 0 deletions
14
panoptica/configs/SegmentationClassGroups_example_unmatchedinstancepair.yaml
This file contains 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,14 @@ | ||
!SegmentationClassGroups | ||
groups: | ||
endplate: !LabelGroup | ||
single_instance: false | ||
value_labels: [201, 202, 203, 204, 205, 206, 207, 208, 209, 210] | ||
ivd: !LabelGroup | ||
single_instance: false | ||
value_labels: [101, 102, 103, 104, 105, 106, 107, 108, 109, 110] | ||
sacrum: !LabelGroup | ||
single_instance: true | ||
value_labels: [26] | ||
vertebra: !LabelGroup | ||
single_instance: false | ||
value_labels: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] |
42 changes: 42 additions & 0 deletions
42
panoptica/configs/panoptica_evaluator_unmatched_instance.yaml
This file contains 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,42 @@ | ||
!Panoptica_Evaluator | ||
decision_metric: !Metric DSC | ||
decision_threshold: 0.5 | ||
edge_case_handler: !EdgeCaseHandler | ||
empty_list_std: !EdgeCaseResult NAN | ||
listmetric_zeroTP_handling: | ||
!Metric DSC: !MetricZeroTPEdgeCaseHandling {empty_prediction_result: !EdgeCaseResult ZERO, | ||
empty_reference_result: !EdgeCaseResult ZERO, no_instances_result: !EdgeCaseResult NAN, | ||
normal: !EdgeCaseResult ZERO} | ||
!Metric clDSC: !MetricZeroTPEdgeCaseHandling {empty_prediction_result: !EdgeCaseResult ZERO, | ||
empty_reference_result: !EdgeCaseResult ZERO, no_instances_result: !EdgeCaseResult NAN, | ||
normal: !EdgeCaseResult ZERO} | ||
!Metric IOU: !MetricZeroTPEdgeCaseHandling {empty_prediction_result: !EdgeCaseResult ZERO, | ||
empty_reference_result: !EdgeCaseResult ZERO, no_instances_result: !EdgeCaseResult NAN, | ||
normal: !EdgeCaseResult ZERO} | ||
!Metric ASSD: !MetricZeroTPEdgeCaseHandling {empty_prediction_result: !EdgeCaseResult INF, | ||
empty_reference_result: !EdgeCaseResult INF, no_instances_result: !EdgeCaseResult NAN, | ||
normal: !EdgeCaseResult INF} | ||
!Metric RVD: !MetricZeroTPEdgeCaseHandling {empty_prediction_result: !EdgeCaseResult NAN, | ||
empty_reference_result: !EdgeCaseResult NAN, no_instances_result: !EdgeCaseResult NAN, | ||
normal: !EdgeCaseResult NAN} | ||
eval_metrics: [!Metric DSC, !Metric IOU] | ||
expected_input: !InputType UNMATCHED_INSTANCE | ||
instance_approximator: null | ||
instance_matcher: !NaiveThresholdMatching {allow_many_to_one: false, matching_metric: !Metric IOU, | ||
matching_threshold: 0.5} | ||
log_times: true | ||
segmentation_class_groups: !SegmentationClassGroups | ||
groups: | ||
endplate: !LabelGroup | ||
single_instance: false | ||
value_labels: [201, 202, 203, 204, 205, 206, 207, 208, 209, 210] | ||
ivd: !LabelGroup | ||
single_instance: false | ||
value_labels: [101, 102, 103, 104, 105, 106, 107, 108, 109, 110] | ||
sacrum: !LabelGroup | ||
single_instance: true | ||
value_labels: [26] | ||
vertebra: !LabelGroup | ||
single_instance: false | ||
value_labels: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | ||
verbose: false |
This file contains 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 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 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.