Skip to content
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

Add MNI registered images to results zip files #29

Merged
merged 3 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,19 @@ repository.
To run the analysis using Apptainer:

```bash
apptainer run --bind "${PWD}":/data hh-enigmapd-2025/enigma-pd-wml/enigma-pd-wml:<tag>
apptainer run --bind "${PWD}":/data library://hh-enigmapd-2025/enigma-pd-wml/enigma-pd-wml:<tag>
```

where `<tag>` is the version of the image you would like to pull.

Note, the image will be downloaded from Sylabs Cloud the first time you run a particular version of the
It can sometime be slow to pull the image from Sylabs Cloud. If you would prefer to pull the Docker image
from Docker Hub and build and run a local Apptainer image, you can run the following command:

```bash
apptainer run --bind "${PWD}":/data docker://hamiedaharoon24/enigma-pd-wml:<tag>
```

Note, the image will be downloaded from Sylabs Cloud (or Docker Hub) the first time you run a particular version of the
image.

### Options
Expand Down Expand Up @@ -216,11 +223,19 @@ These zip files should contain six files:

- `results2min_lin_perivent.nii.gz`: WML segmentations (periventricular) linearly transformed to MNI space.

- `results2mni_nonlin.nii.gz`: WML segmentations non-linearly transformed to MNI space.
- `results2mni_nonlin.nii.gz`: WML segmentations non-linearly warped to MNI space.

- `results2min_nonlin_deep.nii.gz`: WML segmentations (deep white matter) non-linearly warped to MNI space.

- `results2mni_nonlin_perivent.nii.gz`: WML segmentations (periventricular) non-linearly warped to MNI space.

- `T1_biascorr_brain_to_MNI_lin.nii.gz`: T1 bias-corrected brain linearly transformed to MNI space.

- `FLAIR_biascorr_brain_to_MNI_lin.nii.gz`: FLAIR bias-corrected brain linearly transformed to MNI space.

- `results2min_nonlin_deep.nii.gz`: WML segmentations (deep white matter) non-linearly transformed to MNI space.
- `T1_biascorr_brain_to_MNI_nonlin.nii.gz`: T1 bias-corrected brain non-linearly warped to MNI space.

- `results2mni_nonlin_perivent.nii.gz`: WML segmentations (periventricular) non-linearly transformed to MNI space.
- `FLAIR_biascorr_brain_to_MNI_nonlin.nii.gz`: FLAIR bias-corrected brain non-linearly warped to MNI space.

#### Top-level zip file

Expand Down
28 changes: 27 additions & 1 deletion analysis_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ function processOutputs(){
"${data_outpath}"/output/results2mni_nonlin.nii.gz
"${data_outpath}"/output/results2mni_nonlin_deep.nii.gz
"${data_outpath}"/output/results2mni_nonlin_perivent.nii.gz
"${data_outpath}"/output/T1_biascorr_brain_to_MNI_lin.nii.gz
"${data_outpath}"/output/FLAIR_biascorr_brain_to_MNI_lin.nii.gz
"${data_outpath}"/output/T1_biascorr_brain_to_MNI_nonlin.nii.gz
"${data_outpath}"/output/FLAIR_biascorr_brain_to_MNI_nonlin.nii.gz
)
if [ "$overwrite" = false ] && allFilesExist "${output_files[@]}"
then
Expand All @@ -232,6 +236,8 @@ function processOutputs(){
cp ${data_outpath}/input/vent_dist_mapping/dwm_t1brain.nii.gz .
cp ${data_outpath}/input/vent_dist_mapping/perivent_flairbrain.nii.gz .
cp ${data_outpath}/input/vent_dist_mapping/dwm_flairbrain.nii.gz .
cp ${data_outpath}/input/t1-mni.anat/T1_biascorr_brain.nii.gz .
cp ${data_outpath}/input/flair-bet/flairvol2t1brain.nii.gz .


tree ${data_outpath}/input/
Expand Down Expand Up @@ -279,6 +285,14 @@ function processOutputs(){
-out results2mni_lin_deep \
-paddingsize 0.0 -interp nearestneighbour -ref MNI152_T1_1mm_brain.nii.gz

flirt -in T1_biascorr_brain.nii.gz -applyxfm -init T1_to_MNI_lin.mat \
-out T1_biascorr_brain_to_MNI_lin \
-paddingsize 0.0 -interp trilinear -ref MNI152_T1_1mm_brain.nii.gz

flirt -in flairvol2t1brain.nii.gz -applyxfm -init T1_to_MNI_lin.mat \
-out FLAIR_biascorr_brain_to_MNI_lin \
-paddingsize 0.0 -interp trilinear -ref MNI152_T1_1mm_brain.nii.gz


echo "STEP 05"
# run FSL's applywarp tool to nonlinearly warp WML segmentations with MNI T1
Expand All @@ -294,6 +308,14 @@ function processOutputs(){
--out=results2mni_nonlin_deep \
--interp=nn --ref=${FSLDIR}/data/standard/MNI152_T1_1mm_brain.nii.gz

applywarp --in=T1_biascorr_brain.nii.gz --warp=T1_to_MNI_nonlin_coeff.nii.gz \
--out=T1_biascorr_brain_to_MNI_nonlin \
--interp=trilinear --ref=${FSLDIR}/data/standard/MNI152_T1_1mm_brain.nii.gz

applywarp --in=flairvol2t1brain.nii.gz --warp=T1_to_MNI_nonlin_coeff.nii.gz \
--out=FLAIR_biascorr_brain_to_MNI_nonlin \
--interp=trilinear --ref=${FSLDIR}/data/standard/MNI152_T1_1mm_brain.nii.gz

echo all done!
echo
}
Expand Down Expand Up @@ -347,7 +369,11 @@ function runAnalysis (){
processOutputs

cd ${data_outpath}/output
zip -q ../${subject}_${session}_results.zip results2mni_lin*.nii.gz results2mni_nonlin*.nii.gz
zip -q ../${subject}_${session}_results.zip \
results2mni_lin*.nii.gz \
results2mni_nonlin*.nii.gz \
T1_biascorr_brain_to_MNI_*lin.nii.gz \
FLAIR_biascorr_brain_to_MNI_*lin.nii.gz

}

Expand Down
Loading