Skip to content

Commit

Permalink
added nii header modification in dipy registration
Browse files Browse the repository at this point in the history
  • Loading branch information
pjmark committed Sep 30, 2023
1 parent d34884c commit 93c6158
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion niftypet/nimpa/prc/regseg.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def affine_dipy(
rfwhm=8.,
ffwhm=8.,
verbose=True,
modify_nii=False,
):
"""
https://dipy.org/documentation/1.4.0./examples_built/affine_registration_3d/
Expand Down Expand Up @@ -237,7 +238,26 @@ def affine_dipy(
factors=factors)
# ------------------------------------------------------------------
np.save(faff, txaff)
return {'affine': txaff, 'faff': faff}

outdct = {'affine': txaff, 'faff': faff}

if modify_nii:
flo_d = imio.getnii(fflo ,output='all')

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

View workflow job for this annotation

GitHub Actions / flake8

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

E203 whitespace before ','
Raw output
niftypet/nimpa/prc/regseg.py:245:33: E203 whitespace before ','

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

View workflow job for this annotation

GitHub Actions / flake8

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

E231 missing whitespace after ','
Raw output
niftypet/nimpa/prc/regseg.py:245:34: E231 missing whitespace after ','
flo_a = flo_d['affine']
newaff = np.linalg.lstsq(txaff, flo_a)[0]
splt = fflo.name.split('.nii')
fmodi = odir/(splt[0]+'_affine-modified.nii'+splt[1])

imio.array2nii(
flo_d['im'],
newaff,
fmodi,
trnsp=flo_d['transpose'],
flip=flo_d['flip'])

outdct['fnii_mod'] = fmodi

return outdct

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

View workflow job for this annotation

GitHub Actions / flake8

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

E271 multiple spaces after keyword
Raw output
niftypet/nimpa/prc/regseg.py:260:11: E271 multiple spaces after keyword


def resample_dipy(
Expand Down

0 comments on commit 93c6158

Please sign in to comment.