Skip to content

[RTM] RF: Miscellaneous registration refactorings #741

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 5 commits into from
Oct 6, 2017

Conversation

effigies
Copy link
Member

@effigies effigies commented Oct 6, 2017

Because I have three PRs (#694, #733, #740) all working in the same areas of code, to work on one almost invariably causes collisions with the others. This PR simply tracks what I think are uncontroversial changes that have come up while working in one that don't impact the functioning of the others.

  • Cleans up unused workflow inputs/outputs
  • Makes fs_2_t1_transform follow the t1_2_<space>_(forward|reverse)_transform convention
  • Moves ITK affine matrix creation into the BBR workflows
    • In the case of FreeSurfer's bbregister, uses FreeSurfer's native LTA format until ready to convert to ITK

If this list grows, I will rebase the other PRs against it.

@effigies effigies force-pushed the fsfix_common branch 3 times, most recently from 4d74d34 to ece6657 Compare October 6, 2017 18:47
@effigies effigies changed the title RF: Miscellaneous registration refactorings [RTM] RF: Miscellaneous registration refactorings Oct 6, 2017
Copy link
Member

@oesteban oesteban left a comment

Choose a reason for hiding this comment

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

These changes are almost urgent. It is great that without having talked about, we both were thinking towards the same direction :).

I'm considering to create a new workflows.bold folder to split the humongous module we have now. In a different PR, that's for sure. WDYT?

@@ -542,6 +543,7 @@ def init_surface_recon_wf(omp_nthreads, hires, name='surface_recon_wf'):
fs_transform = pe.Node(
fs.Tkregister2(fsl_out='freesurfer2subT1.mat', reg_header=True),
name='fs_transform')
fsl2lta = pe.Node(fs.utils.LTAConvert(out_lta=True), name='fsl2lta')
Copy link
Member

Choose a reason for hiding this comment

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

I would imagine that we don't need FSL transforms because we are not chaining them? (we resample in T1 space, I assume). Is this correct?

Copy link
Member

Choose a reason for hiding this comment

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

Answered below, thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm doing this right now because nipype doesn't have LTA outputs from tkregister enabled. See nipy/nipype#2217. (Though it also doesn't matter in the long run, since we drop tkregister in #733.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Ugh. Actually just realized I'm missing two inputs to fsl2lta. Hold off on merging.


# BOLD to T1 transform matrix is from fsl, using c3 tools to convert to
# something ANTs will like.
fsl2itk_fwd = pe.Node(c3.C3dAffineTool(fsl2ras=True, itk_transform=True),
Copy link
Member

Choose a reason for hiding this comment

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

Great, I was about to propose this change. This is to move c3d into the actual (bbregister or BBR) registration algorithm pipeline, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

c3d is being used in the FLIRT-BBR workflow to translate from FSL to ITK.

lta_convert is being used in the bbregister workflow to translate from LTA to ITK. LTA is FreeSurfer's format, and there's no real need to spend time in FSL's space.

@effigies
Copy link
Member Author

effigies commented Oct 6, 2017

I've been thinking about splitting workflows/bold.py into a directory for a while, but it hadn't gotten urgent enough to do with everything else needing doing.

@@ -572,12 +574,15 @@ def init_surface_recon_wf(omp_nthreads, hires, name='surface_recon_wf'):
# reoriented image
(inputnode, fs_transform, [('t1w', 'target_image')]),
(autorecon1, fs_transform, [('T1', 'moving_image')]),
(inputnode, fsl2lta, [('t1w', 'target_file')]),
(autorecon1, fsl2lta, [('T1', 'source_file')]),
(fs_transform, fsl2lta, [('fsl_file', 'in_fsl')]),
Copy link
Member Author

Choose a reason for hiding this comment

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

@oesteban These are the new lines. lta_convert needs to know the source and target to create a new LTA affine.

Copy link
Member

Choose a reason for hiding this comment

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

LGTM!

@effigies
Copy link
Member Author

effigies commented Oct 6, 2017

Sounds good. Feel free to merge when tests pass, or I will if I see it first. (Merge with [skip ci] to avoid the hellishly slow Circle queue, since this branch forks from current master.)

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.

2 participants