99from 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
1515def 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,11 +117,14 @@ def main(
117117 defacing_mask_output_path = output_dir / "t1c_defacing_mask.nii.gz" ,
118118 )
119119
120- for modality in ["t1" , "t2" , "fla" ]:
121- moving_modalities = [
120+ moving_modalities = []
121+ for input_path , modality in zip (
122+ [input_t1 , input_t2 , input_fla ], ["t1" , "t2" , "fla" ]
123+ ):
124+ moving_modalities .append (
122125 Modality (
123126 modality_name = modality ,
124- input_path = eval ( f"input_ { modality } " ) ,
127+ input_path = input_path ,
125128 normalizer = percentile_normalizer ,
126129 # specify the output paths for the raw and normalized images of each step - here only for atlas registered and brain extraction
127130 raw_skull_output_path = output_dir / f"{ modality } _skull_raw.nii.gz" ,
@@ -134,18 +137,18 @@ def main(
134137 normalized_defaced_output_path = output_dir
135138 / f"{ modality } _defaced_normalized.nii.gz" ,
136139 )
137- ]
140+ )
138141
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
142+ optional_kwargs = {}
143+ if input_atlas is not None :
144+ optional_kwargs [ "atlas_image_path" ] = input_atlas
142145
143146 # instantiate and run the preprocessor using defaults for registration/ brain extraction/ defacing backends
144- preprocessor = Preprocessor (
147+ preprocessor = AtlasCentricPreprocessor (
145148 center_modality = center ,
146149 moving_modalities = moving_modalities ,
147150 temp_folder = output_dir / "temp" ,
148- input_atlas = input_atlas ,
151+ ** optional_kwargs ,
149152 )
150153
151154 preprocessor .run ()
0 commit comments