Skip to content

Commit 9706c1e

Browse files
committed
fix: update to new Estimator object and dw mentions
1 parent d5b63d0 commit 9706c1e

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/nifreeze/cli/run.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from pathlib import Path
2626

2727
from nifreeze.cli.parser import parse_args
28-
from nifreeze.data.dmri import DWI
28+
from nifreeze.data.base import BaseDataset
2929
from nifreeze.estimator import Estimator
3030

3131

@@ -40,12 +40,12 @@ def main(argv=None) -> None:
4040
args = parse_args(argv)
4141

4242
# 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)
4444

4545
estimator: Estimator = Estimator()
4646

47-
_ = estimator.estimate(
48-
dwi_dataset,
47+
_ = estimator.run(
48+
dataset,
4949
align_kwargs=args.align_config,
5050
models=args.models,
5151
omp_nthreads=args.nthreads,
@@ -58,7 +58,7 @@ def main(argv=None) -> None:
5858
output_path: Path = Path(args.output_dir) / output_filename
5959

6060
# Save the DWI dataset to the output path
61-
dwi_dataset.to_filename(output_path)
61+
dataset.to_filename(output_path)
6262

6363

6464
if __name__ == "__main__":

test/test_integration.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,26 +70,25 @@ def test_proximity_estimator_trivial_model(datadir, tmp_path):
7070
brainmask=dwdata.brainmask,
7171
)
7272

73-
estimator = Estimator()
74-
em_affines = estimator.estimate(
73+
estimator = Estimator(dwi_motion, model="b0")
74+
estimator.run(
7575
data=dwi_motion,
7676
models=("b0",),
7777
seed=None,
7878
align_kwargs={
79-
"fixed_modality": "b0",
80-
"moving_modality": "b0",
79+
"config_file": "b0-to-b0_level0.json",
8180
"num_threads": min(cpu_count(), 8),
8281
},
8382
)
8483

8584
# Uncomment to see the realigned dataset
8685
nt.linear.LinearTransformsMapping(
87-
em_affines,
86+
dwi_motion.motion_affines,
8887
reference=b0nii,
8988
).apply(moved_nii).to_filename(tmp_path / "realigned.nii.gz")
9089

9190
# For each moved b0 volume
92-
for i, est in enumerate(em_affines):
91+
for i, est in enumerate(dwi_motion.motion_affines):
9392
assert (
9493
displacements_within_mask(
9594
masknii,

0 commit comments

Comments
 (0)