Skip to content

Commit 97e61c3

Browse files
committedJan 23, 2025··
fix: pacify mypy
1 parent 254a27e commit 97e61c3

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed
 

‎src/nifreeze/cli/run.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,17 @@ def main(argv=None) -> None:
4242
# Open the data with the given file path
4343
dataset: BaseDataset = BaseDataset.from_filename(args.input_file)
4444

45-
estimator: Estimator = Estimator()
45+
prev_model: Estimator | None = None
46+
for model in args.models:
47+
estimator: Estimator = Estimator(
48+
args.model,
49+
prev=prev_model,
50+
)
51+
prev_model = estimator
4652

4753
_ = estimator.run(
4854
dataset,
4955
align_kwargs=args.align_config,
50-
models=args.models,
5156
omp_nthreads=args.nthreads,
5257
njobs=args.njobs,
5358
seed=args.seed,

‎src/nifreeze/estimator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def run(self, dataset: BaseDataset, **kwargs):
137137

138138
# fit the model
139139
test_set = dataset[i]
140-
predicted = self._model.fit_predict(
140+
predicted = self._model.fit_predict( # type: ignore[union-attr]
141141
i,
142142
n_jobs=n_jobs,
143143
)

‎src/nifreeze/registration/ants.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ def _prepare_registration_data(
130130
131131
"""
132132
clip = clip or "none"
133-
134133
predicted_path = Path(dirname) / f"predicted_{vol_idx:05d}.nii.gz"
135134
sample_path = Path(dirname) / f"sample_{vol_idx:05d}.nii.gz"
136135
_to_nifti(
@@ -151,7 +150,7 @@ def _prepare_registration_data(
151150
ImageGrid = namedtuple("ImageGrid", ("shape", "affine"))
152151
reference = ImageGrid(shape=sample.shape[:3], affine=affine)
153152
initial_xform = Affine(matrix=init_affine, reference=reference)
154-
init_path = dirname / f"init_{vol_idx:05d}.mat"
153+
init_path = Path(dirname) / f"init_{vol_idx:05d}.mat"
155154
initial_xform.to_filename(init_path, fmt="itk")
156155

157156
return predicted_path, sample_path, init_path

0 commit comments

Comments
 (0)
Please sign in to comment.