Skip to content

FIX: DTITK nonlinear workflow origin reslicing #2561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 24, 2018

Conversation

kesshijordan
Copy link
Contributor

I was testing the workflow on some more difficult registrations (e.g. child-to-adult from different datasets) and found that the reslicing can cause problems when images have origins far from 0,0,0. This is just a few lines addition to the workflow to move all images to origin zero prior to any reslicing.

Fixes #2514 .

Changes proposed in this pull request

  • Move all images to origin zero prior to reslicing for the nonlinear tensor registration DTITK workflow

@kesshijordan
Copy link
Contributor Author

Note: in the reslice option you can specify the origin, which is how we had it before. This doesn't solve the problem, though... the workflow must have the origin moved to zero outside of the reslicing node or some images are missing slices when they are resliced.

@kesshijordan
Copy link
Contributor Author

@effigies and @satra is it possible to get this in to the 1.0.3 or is it too late?

@effigies
Copy link
Member

effigies commented Apr 29, 2018 via email

@effigies effigies added this to the 1.0.4 milestone Apr 30, 2018
@effigies
Copy link
Member

As a non-DTI-TK user, this looks fine to me.

My main question would be whether you want to restore the origin at the end of the pipeline, for viewing. (I'm assuming that (0, 0, 0) is in voxel space, not RAS.)

@kesshijordan
Copy link
Contributor Author

For viewing purposes, I think the important thing is that it matches the fixed image. Now that you mention it, I should probably reslice the moving image/move origin to match the original fixed image (the fixed image has to be resliced to a dimension of power 2 to use the diffeomorphic registration). That way the registered volume would match the fixed image input, instead of having two resliced images (fixed & moving) as output that do not match the input fixed image.

Before reslicing/move origin
NIFTI Intent Code: NIFTI_INTENT_SYMMATRIX
NIFTI Orientation Code: RPI
Volume Info of /Users/kesshijordan/ref_data/test_tensors/child2_SC_EC_tensor.nii.gz
size: 110x110x69, voxel size: 2x2x2, origin: [-55.5361, 48.0527, 28.5598]

After reslicing/move origin
NIFTI Intent Code: NIFTI_INTENT_SYMMATRIX
NIFTI Orientation Code: LPI
Volume Info of resliced/fixed/child1_SC_EC_tensor_avs_resampled.nii.gz
size: 128x128x64, voxel size: 2.2x2.2x2.2, origin: [0, 0, 0]

@effigies
Copy link
Member

effigies commented May 3, 2018

I should probably reslice the moving image/move origin to match the original fixed image

Cool, that makes sense to me.

@effigies
Copy link
Member

Hi @kesshijordan, sorry to bother you, but is there any chance of finishing this one up this week or next?

@kesshijordan
Copy link
Contributor Author

No worries, @effigies... thanks for the reminder. I'll put it on my list for this week.

@effigies
Copy link
Member

Hi @kesshijordan just a bump. We're going to try to freeze by Friday, if you want to try to get this in by then.

@kesshijordan
Copy link
Contributor Author

Hi, @effigies. I was trying to add a workflow for applying the diffeomorphic transform (since the origin has to be moved and image resliced, applying the saved transform is not a matter of simply using the saved .df.nii file), but I'm having trouble figuring out why it isn't working. I have the other points we discussed fixed here and took out the apply_transform workflow; I'll put it back in when I manage to debug it. For now I just have a note that you need to reslice/move origin on any new images if you want to apply the workflow transform to another volume.

Copy link
Member

@effigies effigies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I assume you've checked the registration of the inputs/outputs, manually?

@codecov-io
Copy link

codecov-io commented May 24, 2018

Codecov Report

Merging #2561 into master will decrease coverage by 3.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2561      +/-   ##
==========================================
- Coverage   67.13%   64.08%   -3.06%     
==========================================
  Files         333      334       +1     
  Lines       42539    42642     +103     
  Branches     5265     5274       +9     
==========================================
- Hits        28559    27325    -1234     
- Misses      13278    14284    +1006     
- Partials      702     1033     +331
Flag Coverage Δ
#smoketests ?
#unittests 64.08% <100%> (-0.4%) ⬇️
Impacted Files Coverage Δ
nipype/interfaces/dcm2nii.py 48.13% <ø> (+0.93%) ⬆️
nipype/workflows/dmri/dtitk/tensor_registration.py 100% <100%> (ø) ⬆️
nipype/interfaces/nilearn.py 40% <0%> (-56.67%) ⬇️
nipype/utils/spm_docs.py 25.92% <0%> (-44.45%) ⬇️
nipype/interfaces/nitime/analysis.py 43.15% <0%> (-34.74%) ⬇️
nipype/algorithms/rapidart.py 35.39% <0%> (-29.21%) ⬇️
nipype/utils/provenance.py 55.73% <0%> (-28.99%) ⬇️
nipype/interfaces/spm/base.py 58.41% <0%> (-28.39%) ⬇️
nipype/interfaces/fsl/model.py 55.26% <0%> (-25.17%) ⬇️
nipype/interfaces/freesurfer/base.py 49.59% <0%> (-23.58%) ⬇️
... and 63 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9333ff8...9545859. Read the comment docs.

@effigies effigies merged commit b547aa7 into nipy:master May 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants