Skip to content

[RTM] ENH: Merge T1w images to unbiased template if N < 3 or --longitudinal is passed #591

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 9 commits into from
Jul 29, 2017

Conversation

effigies
Copy link
Member

Not running against CircleCI at this point because we'll need to test outside of CI against datasets with multiple T1w images before we merge this. This is a placeholder PR until then.

I'd also like to go ahead and use mri_robust_register to align any T2w images (see #474).

Note that this could break alignment between result images from previous FMRIPREP versions. Should probably be put into release notes.

Closes #310

@effigies
Copy link
Member Author

This adds serious run time to the t1_merge node for ds031, which merges 9 T1w images (testing after rebasing on top of #601). We could make it an option (--longitudinal?) with a note that runtime may be increased.

Also, I think we can use OpenMP, so I'll give that a shot.

@chrisgorgo
Copy link
Contributor

how serious?

@effigies
Copy link
Member Author

It's taken over half an hour. Before I think it took ~10min, but I'll run both versions tonight with less other things going on the system to get a difference.

Once I was sure it was a major slowdown, I killed it to try to play with OpenMP. Just to verify that it does actually parallelize.

@effigies
Copy link
Member Author

effigies commented Jul 27, 2017

For ds031/sub-01 (9 images):

Alignment OMP_NUM_THREADS Time
Aligning to first image 16m
Aligning to first image 7 5m
Unbiased template 1h46m
Unbiased template 7 1h21m

For ds114/sub-07 (2 images):

Alignment OMP_NUM_THREADS Time
Aligning to first image 1m13s
Aligning to first image 7 1m03s
Unbiased template 1m15s
Unbiased template 7 1m06s

@effigies
Copy link
Member Author

Re: ds031, it's unclear whether we'd get a better speed-up profile if the number of images matched the number of threads; it could be that the parallel sections are going from 9 to 2. But even if so, it looks like the serial component for constructing an unbiased template is ~74min, and maximum concurrency might bring us down to 77-78min.

Similarly, for a simple alignment, it looks like we have a serial section of ~2.5min with maximum concurrency reducing to 3.6-3.7min.

I would say it makes sense to parallelize to min(num_images, omp_nthreads), which keeps small merges from eating up all the cores to little benefit, and to make unbiased templates optional. Given the low additional cost for a small number of input images, it could also make sense to make unbiased templates the default for fewer than N images (and I'll work out what a reasonable N is).

@chrisgorgo
Copy link
Contributor

chrisgorgo commented Jul 27, 2017 via email

@effigies
Copy link
Member Author

Sounds good. Then this will depend on nipy/nipype#2130, which make the number of threads an input trait, so it can be set like so:

wf.connect([(t1_conform, t1_merge, [(('t1w_list', len), 'num_threads')])])

(Replacing len with a more correct function.)

@effigies
Copy link
Member Author

Haha, wow. N=2. Going from 2 to 3 images increases from <2min to ~25min. I do not need to see the curve badly enough to keep going.

@effigies effigies changed the title [WIP] ENH: Merge T1w images without biasing to first image [WIP] ENH: Merge T1w images to unbiased template if N < 3 or --longitudinal is passed Jul 27, 2017
@effigies effigies changed the title [WIP] ENH: Merge T1w images to unbiased template if N < 3 or --longitudinal is passed [WIP] ENH: Merge T1w images to unbiased template if N < 3 or --longitudinal is passed Jul 27, 2017
@effigies effigies changed the title [WIP] ENH: Merge T1w images to unbiased template if N < 3 or --longitudinal is passed [RTM] ENH: Merge T1w images to unbiased template if N < 3 or --longitudinal is passed Jul 28, 2017
Copy link
Contributor

@chrisgorgo chrisgorgo left a comment

Choose a reason for hiding this comment

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

Code looks ok, but please look into the failing tests.

@effigies
Copy link
Member Author

It's the stochastic ICA-AROMA bug. If it pops up again, I'll merge #611 before running another round of tests.

@effigies effigies merged commit a9f1b8f into nipreps:master Jul 29, 2017
@effigies effigies deleted the enh/t1_template branch July 29, 2017 02:25
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