pnlbwh / pnlNipype

PNL pipeline for NIFTI images
Other
10 stars 15 forks source link

Final mask from `pnlNipype/exec/fsl_topup_epi_eddy` #46

Closed njhunsak closed 4 years ago

njhunsak commented 4 years ago

If my primary image was dwi_acq-AP and my secondary image is dwi_acq-PA. It isn't obvious to me what file would be my final mask:

-rw-rw-r-- 1 intj5 intj5   9121098 Dec 11 05:50 primaryMasked.nii.gz
-rw-rw-r-- 1 intj5 intj5   9280486 Dec 11 05:50 secondaryMasked.nii.gz
-rw-rw-r-- 1 intj5 intj5    175619 Dec 11 05:50 B0_PA.nii.gz
-rw-rw-r-- 1 intj5 intj5      1533 Dec 11 05:50 B0_PA_AP_merged.topup_log
-rw-rw-r-- 1 intj5 intj5    353775 Dec 11 05:50 B0_PA_AP_merged.nii.gz
-rw-rw-r-- 1 intj5 intj5    178428 Dec 11 05:50 B0_AP.nii.gz
-rw-rw-r-- 1 intj5 intj5        33 Dec 11 05:50 acqp_topup.txt
-rw-rw-r-- 1 intj5 intj5        38 Dec 11 05:52 topup_results_movpar.txt
-rw-rw-r-- 1 intj5 intj5       204 Dec 11 05:52 topup_results_fieldcoef.nii.gz
-rw-rw-r-- 1 intj5 intj5     16697 Dec 11 05:52 topup_mask.nii.gz
-rw-rw-r-- 1 intj5 intj5       260 Dec 11 05:52 index.txt
-rw-rw-r-- 1 intj5 intj5      7564 Dec 11 05:52 combinedBvecs.txt
-rw-rw-r-- 1 intj5 intj5       903 Dec 11 05:52 combinedBvals.txt
-rw-rw-r-- 1 intj5 intj5  18402017 Dec 11 05:52 combinedData.nii.gz
-rw-rw-r-- 1 intj5 intj5       797 Dec 11 09:34 dwi_acq-AP_xc_Ep_Ed.eddy_post_eddy_shell_alignment_parameters
-rw-rw-r-- 1 intj5 intj5     32654 Dec 11 09:42 dwi_acq-AP_xc_Ep_Ed.eddy_parameters
-rw-rw-r-- 1 intj5 intj5       899 Dec 11 09:42 dwi_acq-AP_xc_Ep_Ed.eddy_outlier_report
-rw-rw-r-- 1 intj5 intj5     55176 Dec 11 09:42 dwi_acq-AP_xc_Ep_Ed.eddy_outlier_n_stdev_map
-rw-rw-r-- 1 intj5 intj5     57340 Dec 11 09:42 dwi_acq-AP_xc_Ep_Ed.eddy_outlier_n_sqr_stdev_map
-rw-rw-r-- 1 intj5 intj5     15537 Dec 11 09:42 dwi_acq-AP_xc_Ep_Ed.eddy_outlier_map
-rw-rw-r-- 1 intj5 intj5 311763042 Dec 11 09:44 dwi_acq-AP_xc_Ep_Ed.nii.gz
-rw-rw-r-- 1 intj5 intj5      5610 Dec 11 09:44 dwi_acq-AP_xc_Ep_Ed.eddy_rotated_bvecs
-rw-rw-r-- 1 intj5 intj5      3676 Dec 11 09:45 dwi_acq-AP_xc_Ep_Ed.eddy_movement_rms
-rw-rw-r-- 1 intj5 intj5      3664 Dec 11 09:46 dwi_acq-AP_xc_Ep_Ed.eddy_restricted_movement_rms
-rw-rw-r-- 1 intj5 intj5      5610 Dec 11 09:46 dwi_acq-AP_xc_Ep_Ed.bvec
-rw-rw-r-- 1 intj5 intj5       322 Dec 11 09:47 dwi_acq-AP_xc_Ep_Ed.bval
tashrifbillah commented 4 years ago

topup_mask.nii.gz

See this if-else logic.

njhunsak commented 4 years ago

The topup_mask.nii.gz looks really bad.

Screen Shot 2019-12-11 at 4 14 45 PM

For reference here's what I included when I ran this step:

~/build/pnlNipype/exec/fsl_topup_epi_eddy \
--acqp acqparams.txt \
--numb0 -1 \
--whichVol 1,2 \
--bvals dwi_acq-AP_xc.bval,dwi_acq-PA_xc.bval \
--bvecs dwi_acq-AP_xc.bvec,dwi_acq-PA_xc.bvec \
--config /fslhome/intj5/build/pnlNipype/scripts/eddy_config.txt \
--imain dwi_acq-AP_xc.nii.gz,dwi_acq-PA_xc.nii.gz \
--mask dwi_acq-AP_mask.nii.gz,dwi_acq-PA_mask.nii.gz \
--out dwi_epi
tashrifbillah commented 4 years ago

How good were --mask dwi_acq-AP_mask.nii.gz,dwi_acq-PA_mask.nii.gz ? Did they have a thin separate boundary outside the brain like we see in the derived topup_mask.nii.gz?

It's either topup or applytopup that isn't doing a good job here. How do the dwi_acq-AP_xc_Ep_Ed.nii.gz look? Do you think that has been properly eddy/epi corrected?

njhunsak commented 4 years ago

The masks look OK.

Screen Shot 2019-12-12 at 10 34 41 AM Screen Shot 2019-12-12 at 10 35 14 AM

Eddy worked just fine, but I don't think topup worked too well.

Screen Shot 2019-12-12 at 11 07 54 AM

On the left (volume 1 is the AP scan) and on the right (volume 66 is the PA scan). You can still see the AP-PA distortion on the images since the blue crosshair is placed at the same spot for both images. There's still a lot of frontal lobe distortion on the PA scan (right).

tashrifbillah commented 4 years ago

Your annotation of left/right and AP/PA don't appear to be completely harmonious. Can you use "above" and "below" to explicitly refer to the figures? You can edit and I'll follow.

tashrifbillah commented 4 years ago

But in the big picture, given your findings of bad mask, I may have to resort to obtaining mask in the simpler way (averaging and bet of topup b0s) as suggested in eddy documentation.

In contrast, note that we also applytopup on the given masks to obtain a presumably better mask.

cc @sbouix

tashrifbillah commented 4 years ago

@njhunsak

Eddy worked just fine, but I don't think topup worked too well.

For avoiding over-fitting, we would have to play with advanced parameters of eddy_openmp as shown in example commands here.

The topup_mask.nii.gz looks really bad.

Mask issue should be fixed now (see https://github.com/pnlbwh/pnlNipype/commit/cd6f1a4dea3f22129914460398a446b23b8bcb36).

Finally, my recent changes to pnlNipype can be pulled as follows

cd pnlNipype
mv scripts/fs2dwi.py .
git checkout -- scripts/fs2dwi.py
git pull origin master
mv fs2dwi.py scripts/
cd pnlNipype
git checkout -- scripts/fs2dwi.py
git pull origin master