Skip to content

Commit d5508de

Browse files
committed
Change to use new AtlasCentricPreprocessor
Fix typing and logic issues
1 parent d7299bb commit d5508de

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

brainles_preprocessing/cli.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from brainles_preprocessing.normalization.percentile_normalizer import (
1010
PercentileNormalizer,
1111
)
12-
from brainles_preprocessing.preprocessor import Preprocessor
12+
from brainles_preprocessing.preprocessor import AtlasCentricPreprocessor
1313

1414

1515
def version_callback(value: bool):
@@ -59,7 +59,7 @@ def main(
5959
),
6060
],
6161
output_dir: Annotated[
62-
str,
62+
str | Path,
6363
typer.Option(
6464
"-o",
6565
"--output_dir",
@@ -117,8 +117,9 @@ def main(
117117
defacing_mask_output_path=output_dir / "t1c_defacing_mask.nii.gz",
118118
)
119119

120+
moving_modalities = []
120121
for modality in ["t1", "t2", "fla"]:
121-
moving_modalities = [
122+
moving_modalities.append(
122123
Modality(
123124
modality_name=modality,
124125
input_path=eval(f"input_{modality}"),
@@ -134,18 +135,18 @@ def main(
134135
normalized_defaced_output_path=output_dir
135136
/ f"{modality}_defaced_normalized.nii.gz",
136137
)
137-
]
138+
)
138139

139-
# if the input atlas is the SRI24 BraTS atlas, set it to None, because it will be picked up through the package
140-
if input_atlas == "SRI24 BraTS atlas":
141-
input_atlas = None
140+
optional_kwargs = {}
141+
if input_atlas is not None:
142+
optional_kwargs["atlas_image_path"] = input_atlas
142143

143144
# instantiate and run the preprocessor using defaults for registration/ brain extraction/ defacing backends
144-
preprocessor = Preprocessor(
145+
preprocessor = AtlasCentricPreprocessor(
145146
center_modality=center,
146147
moving_modalities=moving_modalities,
147148
temp_folder=output_dir / "temp",
148-
input_atlas=input_atlas,
149+
**optional_kwargs,
149150
)
150151

151152
preprocessor.run()

0 commit comments

Comments
 (0)