-
Notifications
You must be signed in to change notification settings - Fork 5
Labelingupdate #53
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
Labelingupdate #53
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9bb4585
update labeling to VERIDAH methodology
Hendrik-code dab2aed
update to main
Hendrik-code 3deb012
bugfixes
Hendrik-code 62bd697
fixed a small bug where IVDs for T13 would not work
Hendrik-code b2e76f6
add doc string; ignore c1 for missing ivd print out
robert-graf 1235bbf
Merge branch 'labelingupdate' of github.com:Hendrik-code/spineps into…
robert-graf 8baf390
detect_and_solve_merged_vertebra: uses corpus and arcus for COM calcu…
Hendrik-code 67a0325
Merge branch 'labelingupdate' of github.com:Hendrik-code/spineps into…
Hendrik-code 915f8a8
updated readme, fixed some minor labeling things
Hendrik-code c61eabc
fixed lab_model default value
Hendrik-code 0480ed3
Update spineps/phase_labeling.py
Hendrik-code 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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -383,6 +383,12 @@ class SubjectInfo: | |||||
| first_lwk: int = 20 | ||||||
| double_entries: list[int] = field(default_factory=list) | ||||||
|
|
||||||
| @property | ||||||
| def has_tea(self) -> bool: | ||||||
| if not self.has_anomaly_entry: | ||||||
| return None | ||||||
| return self.anomaly_entry["T11"] or self.anomaly_entry["T13"] | ||||||
|
|
||||||
| @property | ||||||
| def block(self) -> int: | ||||||
| return int(str(self.subject_name)[:3]) | ||||||
|
|
@@ -393,15 +399,17 @@ def get_subject_info( | |||||
| subject_name: str | int, | ||||||
| anomaly_dict: dict, | ||||||
| vert_subfolders_int: list[int], | ||||||
| anomaly_factor_condition: int = 0, | ||||||
| subject_name_int: bool = True, | ||||||
| ): | ||||||
| if subject_name_int: | ||||||
| subject_name = int(subject_name) | ||||||
| double_entries = [] | ||||||
| labelmap = {} | ||||||
| has_anomaly_entry = False | ||||||
| anomaly_entry = {} | ||||||
| deleted_label = [] | ||||||
| is_remove = False | ||||||
| if int(subject_name) in anomaly_dict: | ||||||
| if subject_name in anomaly_dict: | ||||||
| anomaly_entry = anomaly_dict[subject_name] | ||||||
| has_anomaly_entry = True | ||||||
| if anomaly_entry["DeleteLabel"] is not None: | ||||||
|
|
@@ -411,22 +419,43 @@ def get_subject_info( | |||||
|
|
||||||
| if bool(anomaly_entry["T11"]): | ||||||
| labelmap = {i: i + 1 for i in range(19, 26)} | ||||||
| double_entries = [17, 18, 20, 21] | ||||||
| elif bool(anomaly_entry["T13"]): | ||||||
| labelmap = {20: 28, 21: 20, 22: 21, 23: 22, 24: 23, 25: 24} | ||||||
| double_entries = [19, 28, 20, 21] | ||||||
| elif anomaly_factor_condition == 0: | ||||||
| double_entries = [18, 19, 20, 21] | ||||||
|
|
||||||
| if "LabelOverride" in anomaly_entry and anomaly_entry["LabelOverride"] is not None: | ||||||
| assert len(anomaly_entry["LabelOverride"]) == len(vert_subfolders_int), ( | ||||||
| f"len({anomaly_entry['LabelOverride']}) != len({vert_subfolders_int})" | ||||||
| ) | ||||||
| vert_subfolders_sorted = sorted(vert_subfolders_int, key=lambda x: x if x != 28 else 19.5) | ||||||
| labelmap = {i: k for i, k in zip(vert_subfolders_sorted, anomaly_entry["LabelOverride"], strict=False)} # noqa: C416 | ||||||
|
|
||||||
| actual_labels = [labelmap.get(v, v) for v in vert_subfolders_int] | ||||||
|
|
||||||
| if 28 in actual_labels and 19 not in actual_labels: | ||||||
| print(f"{subject_name}: 28 in {actual_labels} but no 19") | ||||||
|
||||||
| print(f"{subject_name}: 28 in {actual_labels} but no 19") | |
| logger.print(f"{subject_name}: 28 in {actual_labels} but no 19") |
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.
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.
The has_tea property returns None when has_anomaly_entry is False, but the return type annotation indicates bool. This should return False or the annotation should be bool | None.