Skip to content

Commit

Permalink
Merge pull request #13 from sophieloiz/sl_dart_eds
Browse files Browse the repository at this point in the history
Debug task utils with ssda parameters
  • Loading branch information
sophieloiz authored Oct 5, 2023
2 parents 71a368c + 7485013 commit c9abd6d
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions clinicadl/train/tasks/task_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,13 @@ def task_launcher(network_task: str, task_options_list: List[str], **kwargs):
/ "tensor_extraction"
/ kwargs["preprocessing_json"]
)
preprocessing_json_target = (
Path(kwargs["caps_target"])
/ "tensor_extraction"
/ kwargs["preprocessing_dict_target"]
)

if train_dict["ssda_network"]:
preprocessing_json_target = (
Path(kwargs["caps_target"])
/ "tensor_extraction"
/ kwargs["preprocessing_dict_target"]
)
else:
caps_dict = CapsDataset.create_caps_dict(
train_dict["caps_directory"], train_dict["multi_cohort"]
Expand All @@ -109,29 +111,32 @@ def task_launcher(network_task: str, task_options_list: List[str], **kwargs):
f"in {caps_dict}."
)
# To CHECK AND CHANGE
caps_target = Path(kwargs["caps_target"])
preprocessing_json_target = (
caps_target / "tensor_extraction" / kwargs["preprocessing_dict_target"]
)

if preprocessing_json_target.is_file():
logger.info(
f"Preprocessing JSON {preprocessing_json_target} found in CAPS {caps_target}."
)
json_found = True
if not json_found:
raise ValueError(
f"Preprocessing JSON {kwargs['preprocessing_json_target']} was not found for any CAPS "
f"in {caps_target}."
if train_dict["ssda_network"]:
caps_target = Path(kwargs["caps_target"])
preprocessing_json_target = (
caps_target / "tensor_extraction" / kwargs["preprocessing_dict_target"]
)

if preprocessing_json_target.is_file():
logger.info(
f"Preprocessing JSON {preprocessing_json_target} found in CAPS {caps_target}."
)
json_found = True
if not json_found:
raise ValueError(
f"Preprocessing JSON {kwargs['preprocessing_json_target']} was not found for any CAPS "
f"in {caps_target}."
)

# Mode and preprocessing
preprocessing_dict = read_preprocessing(preprocessing_json)
preprocessing_dict_target = read_preprocessing(preprocessing_json_target)
train_dict["preprocessing_dict"] = preprocessing_dict
train_dict["preprocessing_dict_target"] = preprocessing_dict_target
train_dict["mode"] = preprocessing_dict["mode"]

if train_dict["ssda_network"]:
preprocessing_dict_target = read_preprocessing(preprocessing_json_target)
train_dict["preprocessing_dict_target"] = preprocessing_dict_target

# Add default values if missing
if (
preprocessing_dict["mode"] == "roi"
Expand Down

0 comments on commit c9abd6d

Please sign in to comment.