-
Notifications
You must be signed in to change notification settings - Fork 2
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
hc-leipzig-7t-mp2rage graphs #76
Draft
KaterinaKrejci231054
wants to merge
10
commits into
main
Choose a base branch
from
kk/hc-leipzig-7t-mp2rage_graphs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c8fc1c5
New script for nnUNet training-logs visualization
KaterinaKrejci231054 0625376
Update training/hc-leipzig-7t-mp2rage/plot_nnunet_different_training_…
KaterinaKrejci231054 0b9c6e1
Update training/hc-leipzig-7t-mp2rage/plot_nnunet_different_training_…
KaterinaKrejci231054 352831d
Chaged description and help
KaterinaKrejci231054 1ffd52a
New script for train-val split for nnUNet splits_final.json file
KaterinaKrejci231054 5345ad2
New script for train-val-test split - saved as .csv file
KaterinaKrejci231054 239bb4d
New file for train-val split for mp2rage models
KaterinaKrejci231054 662fddc
Final train-val-test splits for mp2rage models (5 fold cross-val)
KaterinaKrejci231054 b7f5e65
Merge branch 'main' into kk/hc-leipzig-7t-mp2rage_graphs
valosekj 53b3da3
Changed settings of plots
KaterinaKrejci231054 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
257 changes: 257 additions & 0 deletions
257
training/hc-leipzig-7t-mp2rage/hc-leipzig-7t-mp2rage_fold_splits.json
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,257 @@ | ||
[ | ||
{ | ||
"train": [ | ||
"SCDATA_18_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_18_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_18_UNIT1", | ||
"SCDATA_19_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_19_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_19_UNIT1", | ||
"SCDATA_20_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_20_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_20_UNIT1", | ||
"SCDATA_22_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_22_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_22_UNIT1", | ||
"SCDATA_23_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_23_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_23_UNIT1", | ||
"SCDATA_27_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_27_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_27_UNIT1", | ||
"SCDATA_28_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_28_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_28_UNIT1", | ||
"SCDATA_30_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_30_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_30_UNIT1", | ||
"SCDATA_38_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_38_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_38_UNIT1", | ||
"SCDATA_39_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_39_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_39_UNIT1", | ||
"SCDATA_40_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_40_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_40_UNIT1", | ||
"SCDATA_41_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_41_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_41_UNIT1" | ||
], | ||
"val": [ | ||
"SCDATA_25_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_25_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_25_UNIT1", | ||
"SCDATA_29_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_29_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_29_UNIT1", | ||
"SCDATA_36_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_36_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_36_UNIT1" | ||
] | ||
}, | ||
{ | ||
"train": [ | ||
"SCDATA_19_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_19_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_19_UNIT1", | ||
"SCDATA_22_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_22_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_22_UNIT1", | ||
"SCDATA_23_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_23_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_23_UNIT1", | ||
"SCDATA_25_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_25_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_25_UNIT1", | ||
"SCDATA_27_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_27_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_27_UNIT1", | ||
"SCDATA_28_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_28_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_28_UNIT1", | ||
"SCDATA_29_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_29_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_29_UNIT1", | ||
"SCDATA_30_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_30_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_30_UNIT1", | ||
"SCDATA_36_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_36_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_36_UNIT1", | ||
"SCDATA_38_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_38_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_38_UNIT1", | ||
"SCDATA_40_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_40_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_40_UNIT1", | ||
"SCDATA_41_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_41_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_41_UNIT1" | ||
], | ||
"val": [ | ||
"SCDATA_18_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_18_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_18_UNIT1", | ||
"SCDATA_20_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_20_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_20_UNIT1", | ||
"SCDATA_39_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_39_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_39_UNIT1" | ||
] | ||
}, | ||
{ | ||
"train": [ | ||
"SCDATA_18_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_18_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_18_UNIT1", | ||
"SCDATA_20_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_20_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_20_UNIT1", | ||
"SCDATA_22_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_22_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_22_UNIT1", | ||
"SCDATA_23_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_23_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_23_UNIT1", | ||
"SCDATA_25_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_25_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_25_UNIT1", | ||
"SCDATA_27_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_27_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_27_UNIT1", | ||
"SCDATA_28_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_28_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_28_UNIT1", | ||
"SCDATA_29_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_29_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_29_UNIT1", | ||
"SCDATA_30_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_30_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_30_UNIT1", | ||
"SCDATA_36_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_36_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_36_UNIT1", | ||
"SCDATA_38_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_38_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_38_UNIT1", | ||
"SCDATA_39_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_39_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_39_UNIT1" | ||
], | ||
"val": [ | ||
"SCDATA_19_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_19_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_19_UNIT1", | ||
"SCDATA_40_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_40_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_40_UNIT1", | ||
"SCDATA_41_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_41_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_41_UNIT1" | ||
] | ||
}, | ||
{ | ||
"train": [ | ||
"SCDATA_18_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_18_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_18_UNIT1", | ||
"SCDATA_19_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_19_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_19_UNIT1", | ||
"SCDATA_20_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_20_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_20_UNIT1", | ||
"SCDATA_23_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_23_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_23_UNIT1", | ||
"SCDATA_25_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_25_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_25_UNIT1", | ||
"SCDATA_27_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_27_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_27_UNIT1", | ||
"SCDATA_29_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_29_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_29_UNIT1", | ||
"SCDATA_30_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_30_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_30_UNIT1", | ||
"SCDATA_36_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_36_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_36_UNIT1", | ||
"SCDATA_39_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_39_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_39_UNIT1", | ||
"SCDATA_40_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_40_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_40_UNIT1", | ||
"SCDATA_41_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_41_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_41_UNIT1" | ||
], | ||
"val": [ | ||
"SCDATA_22_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_22_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_22_UNIT1", | ||
"SCDATA_28_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_28_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_28_UNIT1", | ||
"SCDATA_38_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_38_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_38_UNIT1" | ||
] | ||
}, | ||
{ | ||
"train": [ | ||
"SCDATA_18_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_18_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_18_UNIT1", | ||
"SCDATA_19_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_19_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_19_UNIT1", | ||
"SCDATA_20_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_20_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_20_UNIT1", | ||
"SCDATA_22_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_22_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_22_UNIT1", | ||
"SCDATA_25_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_25_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_25_UNIT1", | ||
"SCDATA_28_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_28_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_28_UNIT1", | ||
"SCDATA_29_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_29_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_29_UNIT1", | ||
"SCDATA_36_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_36_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_36_UNIT1", | ||
"SCDATA_38_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_38_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_38_UNIT1", | ||
"SCDATA_39_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_39_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_39_UNIT1", | ||
"SCDATA_40_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_40_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_40_UNIT1", | ||
"SCDATA_41_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_41_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_41_UNIT1" | ||
], | ||
"val": [ | ||
"SCDATA_23_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_23_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_23_UNIT1", | ||
"SCDATA_27_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_27_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_27_UNIT1", | ||
"SCDATA_30_inv-1_part-mag_MP2RAGE", | ||
"SCDATA_30_inv-2_part-mag_MP2RAGE", | ||
"SCDATA_30_UNIT1" | ||
] | ||
} | ||
] |
26 changes: 26 additions & 0 deletions
26
training/hc-leipzig-7t-mp2rage/hc-leipzig-7t-mp2rage_with_folds.csv
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 @@ | ||
Subject,Train/Test,Fold_1,Fold_2,Fold_3,Fold_4,Fold_5 | ||
sub-17,Test,Test,Test,Test,Test,Test | ||
sub-18,Train,Train,Validation,Train,Train,Train | ||
sub-19,Train,Train,Train,Validation,Train,Train | ||
sub-20,Train,Train,Validation,Train,Train,Train | ||
sub-21,Excluded,Excluded,Excluded,Excluded,Excluded,Excluded | ||
sub-22,Train,Train,Train,Train,Validation,Train | ||
sub-23,Train,Train,Train,Train,Train,Validation | ||
sub-24,Test,Test,Test,Test,Test,Test | ||
sub-25,Train,Validation,Train,Train,Train,Train | ||
sub-26,Excluded,Excluded,Excluded,Excluded,Excluded,Excluded | ||
sub-27,Train,Train,Train,Train,Train,Validation | ||
sub-28,Train,Train,Train,Train,Validation,Train | ||
sub-29,Train,Validation,Train,Train,Train,Train | ||
sub-30,Train,Train,Train,Train,Train,Validation | ||
sub-31,Test,Test,Test,Test,Test,Test | ||
sub-32,Excluded,Excluded,Excluded,Excluded,Excluded,Excluded | ||
sub-33,Excluded,Excluded,Excluded,Excluded,Excluded,Excluded | ||
sub-34,Excluded,Excluded,Excluded,Excluded,Excluded,Excluded | ||
sub-35,Excluded,Excluded,Excluded,Excluded,Excluded,Excluded | ||
sub-36,Train,Validation,Train,Train,Train,Train | ||
sub-37,Test,Test,Test,Test,Test,Test | ||
sub-38,Train,Train,Train,Train,Validation,Train | ||
sub-39,Train,Train,Validation,Train,Train,Train | ||
sub-40,Train,Train,Train,Validation,Train,Train | ||
sub-41,Train,Train,Train,Validation,Train,Train |
70 changes: 70 additions & 0 deletions
70
training/hc-leipzig-7t-mp2rage/nnUNetv2_mp2rage_random_train_val_split_to_json.py
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,70 @@ | ||
import pandas as pd | ||
import numpy as np | ||
from sklearn.model_selection import KFold | ||
import json | ||
|
||
# Load the data from the CSV file | ||
train_test_dataframe = pd.read_csv('hc-leipzig-7t-mp2rage_train-test_split.csv') | ||
|
||
# Get the training data only | ||
train_dataframe = train_test_dataframe[train_test_dataframe['Train/Test'] == 'Train'] | ||
|
||
# Extract unique subjects and rename them to SCDATA_<number> | ||
subjects = train_dataframe['Subject'].unique()[:] | ||
|
||
# Get only number from the subject name | ||
subjects = [int(subj.split('-')[1]) for subj in subjects] | ||
|
||
# Rename the subjects | ||
renamed_subjects = [f"SCDATA_{subj}" for subj in subjects] | ||
|
||
# Define the possible contrasts for each subject | ||
contrasts = ["inv-1_part-mag_MP2RAGE", "inv-2_part-mag_MP2RAGE", "UNIT1"] | ||
|
||
# Expand subjects to include all contrasts | ||
expanded_subjects = [] | ||
for subject in renamed_subjects: | ||
for contrast in contrasts: | ||
expanded_subjects.append(f"{subject}_{contrast}") | ||
|
||
# Convert expanded_subjects into a numpy array for indexing | ||
expanded_subjects = np.array(expanded_subjects) | ||
|
||
# Initialize 5-fold cross-validation | ||
kf = KFold(n_splits=5, shuffle=True, random_state=7) | ||
|
||
# Prepare the dataframe for CSV and a list for JSON | ||
folded_dataframe = pd.DataFrame({"Subject": expanded_subjects}) | ||
fold_splits = [] | ||
|
||
# Add columns for each fold | ||
for fold, (train_index, val_index) in enumerate(kf.split(renamed_subjects), start=1): | ||
# Get the train and validation subjects | ||
train_subjects = [renamed_subjects[idx] for idx in train_index] | ||
val_subjects = [renamed_subjects[idx] for idx in val_index] | ||
|
||
# Expand train and validation subjects with all contrasts | ||
train_expanded = [f"{subj}_{contrast}" for subj in train_subjects for contrast in contrasts] | ||
val_expanded = [f"{subj}_{contrast}" for subj in val_subjects for contrast in contrasts] | ||
|
||
# Save the split for JSON | ||
fold_splits.append({ | ||
"train": train_expanded, | ||
"val": val_expanded | ||
}) | ||
|
||
# Add a new column to the dataframe indicating fold membership | ||
fold_column = f'Fold_{fold}' | ||
folded_dataframe[fold_column] = 'Excluded' # Initialize with 'Excluded' | ||
folded_dataframe.loc[folded_dataframe['Subject'].isin(train_expanded), fold_column] = 'Train' | ||
folded_dataframe.loc[folded_dataframe['Subject'].isin(val_expanded), fold_column] = 'Validation' | ||
|
||
# Save the splits to a JSON file | ||
with open('hc-leipzig-7t-mp2rage_fold_splits.json', 'w') as json_file: | ||
json.dump(fold_splits, json_file, indent=4) | ||
|
||
# Print confirmation message | ||
print("Renamed and expanded fold splits saved to 'hc-leipzig-7t-mp2rage_fold_splits_expanded_renamed.json'") | ||
|
||
# Display the first few rows of the updated dataframe | ||
print(folded_dataframe.head()) |
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.
do we need to do this renaming? by doing it, the output
csv
file containssub-
but the outputjson
file containsSCDATA
. this is confusing. I would stick with the original filenames:sub-