Skip to content

Commit

Permalink
Merge branch 'master' of github.com:josegcpa/adell-mri
Browse files Browse the repository at this point in the history
  • Loading branch information
josegcpa committed Jul 1, 2024
2 parents 38ebf66 + c523693 commit 9b68832
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions adell_mri/entrypoints/classification/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def main(arguments):
"image_masking",
"image_crop_from_mask",
"filter_on_keys",
"fill_missing_with_placeholder",
"possible_labels",
"positive_labels",
"label_groups",
Expand Down Expand Up @@ -82,6 +83,7 @@ def main(arguments):
clinical_feature_keys = args.clinical_feature_keys

data_dict = Dataset(args.dataset_json, rng=rng, verbose=True)
data_dict.fill_missing_with_value(args.fill_missing_with_placeholder)
presence_keys = args.image_keys + [args.label_keys] + clinical_feature_keys
if args.mask_key is not None:
presence_keys.append(args.mask_key)
Expand Down
2 changes: 2 additions & 0 deletions adell_mri/entrypoints/classification/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def main(arguments):
"subsample_size",
"subsample_training_data",
"filter_on_keys",
"fill_missing_with_placeholder",
"val_from_train",
"config_file",
"dev",
Expand Down Expand Up @@ -128,6 +129,7 @@ def main(arguments):
n_devices = 1 if isinstance(devices, str) else n_devices

data_dict = Dataset(args.dataset_json, rng=rng)
data_dict.fill_missing_with_value(args.fill_missing_with_placeholder)

if args.clinical_feature_keys is None:
clinical_feature_keys = []
Expand Down
2 changes: 2 additions & 0 deletions adell_mri/entrypoints/classification_deconfounder/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def main(arguments):
"image_masking",
"image_crop_from_mask",
"filter_on_keys",
"fill_missing_with_placeholder",
"possible_labels",
"positive_labels",
"label_groups",
Expand Down Expand Up @@ -86,6 +87,7 @@ def main(arguments):
clinical_feature_keys = args.clinical_feature_keys

data_dict = Dataset(args.dataset_json, rng=rng, verbose=True)
data_dict.fill_missing_with_value(args.fill_missing_with_placeholder)
presence_keys = args.image_keys + [args.label_keys] + clinical_feature_keys
if args.mask_key is not None:
presence_keys.append(args.mask_key)
Expand Down
2 changes: 2 additions & 0 deletions adell_mri/entrypoints/classification_deconfounder/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def main(arguments):
"cat_confounder_keys",
"cont_confounder_keys",
"exclude_surrogate_variables",
"fill_missing_with_placeholder",
"n_features_deconfounder",
"mask_key",
"image_masking",
Expand Down Expand Up @@ -131,6 +132,7 @@ def main(arguments):
n_devices = 1 if isinstance(devices, str) else n_devices

data_dict = Dataset(args.dataset_json, rng=rng)
data_dict.fill_missing_with_value(args.fill_missing_with_placeholder)

if args.excluded_ids_from_training_data is not None:
excluded_ids_from_training_data = parse_ids(
Expand Down
2 changes: 2 additions & 0 deletions adell_mri/entrypoints/classification_ensemble/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def main(arguments):
"positive_labels",
"label_groups",
"filter_on_keys",
"fill_missing_with_placeholder",
"excluded_ids",
"cache_rate",
"target_spacing",
Expand Down Expand Up @@ -74,6 +75,7 @@ def main(arguments):
output_file = open(args.metric_path, "w")

data_dict = json.load(open(args.dataset_json, "r"))
data_dict.fill_missing_with_value(args.fill_missing_with_placeholder)

if args.clinical_feature_keys is None:
clinical_feature_keys = []
Expand Down
2 changes: 2 additions & 0 deletions adell_mri/entrypoints/classification_ensemble/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def main(arguments):
"t2_keys",
"adc_keys",
"filter_on_keys",
"fill_missing_with_placeholder",
"possible_labels",
"positive_labels",
"label_groups",
Expand Down Expand Up @@ -130,6 +131,7 @@ def main(arguments):
output_file = open(args.metric_path, "w")

data_dict = Dataset(args.dataset_json, rng=rng)
data_dict.fill_missing_with_value(args.fill_missing_with_placeholder)

if args.clinical_feature_keys is None:
clinical_feature_keys = []
Expand Down
2 changes: 2 additions & 0 deletions adell_mri/entrypoints/classification_mil/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def main(arguments):
"adc_keys",
"label_keys",
"filter_on_keys",
"fill_missing_with_placeholder",
"possible_labels",
"positive_labels",
"label_groups",
Expand Down Expand Up @@ -79,6 +80,7 @@ def main(arguments):
accelerator, devices, strategy = get_devices(args.dev)

data_dict = Dataset(args.dataset_json, rng=rng, verbose=True)
data_dict.fill_missing_with_value(args.fill_missing_with_placeholder)
if args.excluded_ids is not None:
data_dict.subsample_dataset(excluded_key_list=args.excluded_ids)

Expand Down
4 changes: 3 additions & 1 deletion adell_mri/entrypoints/classification_mil/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def main(arguments):
"t2_keys",
"label_keys",
"filter_on_keys",
"fill_missing_with_placeholder",
"possible_labels",
"positive_labels",
"label_groups",
Expand Down Expand Up @@ -126,6 +127,7 @@ def main(arguments):
output_file = open(args.metric_path, "w")

data_dict = Dataset(args.dataset_json, rng=rng)
data_dict.fill_missing_with_value(args.fill_missing_with_placeholder)

if args.excluded_ids_from_training_data is not None:
excluded_ids_from_training_data = parse_ids(
Expand Down Expand Up @@ -208,7 +210,7 @@ def main(arguments):
transforms_common = get_transforms("pre", **transform_arguments)
transforms_train = monai.transforms.Compose(
[
get_augmentations(**augment_arguments),
get_augmentations(**augment_arguments, mask_key=None),
*get_transforms("post", **transform_arguments),
EinopsRearranged("image", "c h w d -> 1 h w (d c)"),
ScaleIntensityAlongDimd("image", dim=-1),
Expand Down

0 comments on commit 9b68832

Please sign in to comment.