Skip to content

Commit

Permalink
improved pipeline composition for affine reg using dipy
Browse files Browse the repository at this point in the history
  • Loading branch information
pjmark committed Sep 27, 2023
1 parent 5302436 commit b55221a
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions niftypet/nimpa/prc/regseg.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,16 @@ def affine_dipy(
factors=None,
outpath=None,
faffine=None,
pipeline=[center_of_mass, translation, rigid],
pipeline=['center_of_mass', 'translation', 'rigid'],

Check failure on line 151 in niftypet/nimpa/prc/regseg.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] niftypet/nimpa/prc/regseg.py#L151

B006 Do not use mutable data structures for argument defaults. They are created during function definition time. All calls to the function reuse this one instance of that data structure, persisting changes between them.
Raw output
niftypet/nimpa/prc/regseg.py:151:14: B006 Do not use mutable data structures for argument defaults.  They are created during function definition time. All calls to the function reuse this one instance of that data structure, persisting changes between them.
pickname='ref',
fcomment='',
rfwhm=8.,
ffwhm=8.,
verbose=True,
):
"""
https://dipy.org/documentation/1.4.0./examples_built/affine_registration_3d/
Perform affine 3-stage image registration using DIPY.
Arguments:
Expand All @@ -164,7 +166,22 @@ def affine_dipy(
fflo: file path to the floating image to be registered to the
reference image.
outpath: folder path for the output
pipeline: pick what goes to the pipeline:

Check failure on line 169 in niftypet/nimpa/prc/regseg.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] niftypet/nimpa/prc/regseg.py#L169

W291 trailing whitespace
Raw output
niftypet/nimpa/prc/regseg.py:169:48: W291 trailing whitespace
center_of_mass, translation, rigid, affine
(default is without affine, which is rigid-body only)
"""

# > go through possible piplenie components
ppln = []
if 'center_of_mass' in pipeline:
ppln.append(center_of_mass)
if 'translation' in pipeline:
ppln.append(translation)
if 'rigid' in pipeline:
ppln.append(rigid)
if 'affine' in pipeline:
ppln.append(affine)

if level_iters is None:
level_iters = [10000, 1000, 200]
if sigmas is None:
Expand Down Expand Up @@ -210,7 +227,7 @@ def affine_dipy(

# ------------------------------------------------------------------
txim, txaff = affine_registration(fmoving, fstatic, nbins=nbins, metric=metric,
pipeline=pipeline, level_iters=level_iters, sigmas=sigmas,
pipeline=ppln, level_iters=level_iters, sigmas=sigmas,
factors=factors)
# ------------------------------------------------------------------
np.save(faff, txaff)
Expand Down

0 comments on commit b55221a

Please sign in to comment.