-
Notifications
You must be signed in to change notification settings - Fork 24
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
ENH: b0 reference and skullstrip workflow #25
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had a first pass. I still need to go through the workflow.
I'll modify the workflow to use the new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good. I particularly like that you documented the workflows very well. Some further comments:
- Please consider the more robust calculation of the final B0 map that I suggested.
- We need to add some tests
- We need to generate the reportlet so that we can refer future contributors to this PR when they ask about the reports system.
:abbr:`INU (intensity non-uniformity)` bias field and calculates a signal | ||
mask. | ||
|
||
Steps of this workflow are: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been thinking about this, and I would like to hear opinions (@arokem, @jelleveraart) about a more robust b0 computation:
Using the rough mask (I'll call it pre_mask
) calculated before, what about recalculating the reference as follows:
bzeros = dwi_data[..., b0vals_mask]
bzeros = 1000 * bzeros / bzeros[pre_mask, ...].mean(axis=-1) # Normalize to have mean intensity of 1000 within mask
b0map = np.median(bzeros, axis=-1) # median should be more robust than average, esp. with few bzeros
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first rescaling is to deal with the average signal decay you generally see when b zeros are distributed along the scan. We could also store the average signal series (that bzeros[pre_mask, ...].mean(axis=-1)
) to have an estimation of signal drop and maybe allow some exponential decay fitting down the line.
We could also robustify that calculation using median instead of mean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it also be worth registering each b0 to the first in case there is significant motion between them? I'm not sure what opinions are on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I would start by registering all the b0 to each other, and then registering the others to the mean of these registered b0 volumes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've temporarily gotten FSL mcflirt setup but would this be something handled by antsMultivariateTemplateConstruction?
@josephmje can you rebase to |
Hello @josephmje, Thank you for updating! Cheers! There are no style issues detected in this Pull Request. 🍻 To test for issues locally, Comment last updated at 2019-12-16 16:38:28 UTC |
mmm this doesn't look quite right, how have you done the rebase? |
I used:
|
can you post: |
|
Weird, did you have to force-push? |
Nope, I pushed normally. But I see now, it's including everything, not just my changes. |
Can you add me as a collaborator to your fork? |
I'm going to push to your branch. Before any kind of git-fetch or git-pull, could you follow these steps after I push?
|
1a9ed45
to
e6f9eb9
Compare
Thanks @oesteban . Looks much better. What was the solution (for future reference)? |
I believe you undid the rebase at some point, and merged some other branch in. |
Codecov Report
@@ Coverage Diff @@
## master #25 +/- ##
===========================================
- Coverage 40.57% 24.16% -16.41%
===========================================
Files 9 11 +2
Lines 589 662 +73
Branches 92 94 +2
===========================================
- Hits 239 160 -79
- Misses 349 501 +152
Partials 1 1
Continue to review full report at Codecov.
|
Best reviewed: commit by commit
Optimal code review plan (3 warnings)
|
8608605
to
18b6a56
Compare
@josephmje the addition of documentation is starting to give us good feedback. The build_docs job is failing because some of the connections in the workflow are wrong:
I've force-pushed to your branch after rebasing. I believe that:
should work for you. |
initial port from niworkflows add initial pre-mask step fix doc add pre_mask address review comments add period extract b0s first fix function name typo initial port from niworkflows add initial pre-mask step fix doc add pre_mask address review comments add period extract b0s first fix function name typo remove MatchHeader
Co-Authored-By: Oscar Esteban <[email protected]>
Co-Authored-By: Oscar Esteban <[email protected]>
Co-Authored-By: Oscar Esteban <[email protected]>
e076051
to
215e936
Compare
Okay, it seems to make more sense now: I'll check why THP002 is failing. |
My previous workflow used MRtrix's
dwibiascorrect
but for some images,dwi2mask
, which is called bydwibiascorrect
would produce a mask around the cerebellum and only that region would be enhanced. This PR adaptsinit_bold_reference_wf
fromniworkflows
.However, I noticed that the mask produced by
BET
in theskullstrip_first_pass
node includes every voxel. The output is fine but not sure if this is also a problem in niworkflows.