File tree 2 files changed +10
-11
lines changed 2 files changed +10
-11
lines changed Original file line number Diff line number Diff line change 25
25
from pathlib import Path
26
26
27
27
from nifreeze .cli .parser import parse_args
28
- from nifreeze .data .dmri import DWI
28
+ from nifreeze .data .base import BaseDataset
29
29
from nifreeze .estimator import Estimator
30
30
31
31
@@ -40,12 +40,12 @@ def main(argv=None) -> None:
40
40
args = parse_args (argv )
41
41
42
42
# Open the data with the given file path
43
- dwi_dataset : DWI = DWI .from_filename (args .input_file )
43
+ dataset : BaseDataset = BaseDataset .from_filename (args .input_file )
44
44
45
45
estimator : Estimator = Estimator ()
46
46
47
- _ = estimator .estimate (
48
- dwi_dataset ,
47
+ _ = estimator .run (
48
+ dataset ,
49
49
align_kwargs = args .align_config ,
50
50
models = args .models ,
51
51
omp_nthreads = args .nthreads ,
@@ -58,7 +58,7 @@ def main(argv=None) -> None:
58
58
output_path : Path = Path (args .output_dir ) / output_filename
59
59
60
60
# Save the DWI dataset to the output path
61
- dwi_dataset .to_filename (output_path )
61
+ dataset .to_filename (output_path )
62
62
63
63
64
64
if __name__ == "__main__" :
Original file line number Diff line number Diff line change @@ -70,26 +70,25 @@ def test_proximity_estimator_trivial_model(datadir, tmp_path):
70
70
brainmask = dwdata .brainmask ,
71
71
)
72
72
73
- estimator = Estimator ()
74
- em_affines = estimator .estimate (
73
+ estimator = Estimator (dwi_motion , model = "b0" )
74
+ estimator .run (
75
75
data = dwi_motion ,
76
76
models = ("b0" ,),
77
77
seed = None ,
78
78
align_kwargs = {
79
- "fixed_modality" : "b0" ,
80
- "moving_modality" : "b0" ,
79
+ "config_file" : "b0-to-b0_level0.json" ,
81
80
"num_threads" : min (cpu_count (), 8 ),
82
81
},
83
82
)
84
83
85
84
# Uncomment to see the realigned dataset
86
85
nt .linear .LinearTransformsMapping (
87
- em_affines ,
86
+ dwi_motion . motion_affines ,
88
87
reference = b0nii ,
89
88
).apply (moved_nii ).to_filename (tmp_path / "realigned.nii.gz" )
90
89
91
90
# For each moved b0 volume
92
- for i , est in enumerate (em_affines ):
91
+ for i , est in enumerate (dwi_motion . motion_affines ):
93
92
assert (
94
93
displacements_within_mask (
95
94
masknii ,
You can’t perform that action at this time.
0 commit comments