Skip to content

Commit dabeef4

Browse files
authored
Merge pull request #29 from UCL-ARC/paul/output-mni-registered-images
Add MNI registered images to results zip files
2 parents f7acb2c + 385031f commit dabeef4

File tree

2 files changed

+47
-6
lines changed

2 files changed

+47
-6
lines changed

README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,19 @@ repository.
138138
To run the analysis using Apptainer:
139139

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

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

146-
Note, the image will be downloaded from Sylabs Cloud the first time you run a particular version of the
146+
It can sometime be slow to pull the image from Sylabs Cloud. If you would prefer to pull the Docker image
147+
from Docker Hub and build and run a local Apptainer image, you can run the following command:
148+
149+
```bash
150+
apptainer run --bind "${PWD}":/data docker://hamiedaharoon24/enigma-pd-wml:<tag>
151+
```
152+
153+
Note, the image will be downloaded from Sylabs Cloud (or Docker Hub) the first time you run a particular version of the
147154
image.
148155

149156
### Options
@@ -216,11 +223,19 @@ These zip files should contain six files:
216223

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

219-
- `results2mni_nonlin.nii.gz`: WML segmentations non-linearly transformed to MNI space.
226+
- `results2mni_nonlin.nii.gz`: WML segmentations non-linearly warped to MNI space.
227+
228+
- `results2min_nonlin_deep.nii.gz`: WML segmentations (deep white matter) non-linearly warped to MNI space.
229+
230+
- `results2mni_nonlin_perivent.nii.gz`: WML segmentations (periventricular) non-linearly warped to MNI space.
231+
232+
- `T1_biascorr_brain_to_MNI_lin.nii.gz`: T1 bias-corrected brain linearly transformed to MNI space.
233+
234+
- `FLAIR_biascorr_brain_to_MNI_lin.nii.gz`: FLAIR bias-corrected brain linearly transformed to MNI space.
220235

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

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

225240
#### Top-level zip file
226241

analysis_script.sh

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@ function processOutputs(){
209209
"${data_outpath}"/output/results2mni_nonlin.nii.gz
210210
"${data_outpath}"/output/results2mni_nonlin_deep.nii.gz
211211
"${data_outpath}"/output/results2mni_nonlin_perivent.nii.gz
212+
"${data_outpath}"/output/T1_biascorr_brain_to_MNI_lin.nii.gz
213+
"${data_outpath}"/output/FLAIR_biascorr_brain_to_MNI_lin.nii.gz
214+
"${data_outpath}"/output/T1_biascorr_brain_to_MNI_nonlin.nii.gz
215+
"${data_outpath}"/output/FLAIR_biascorr_brain_to_MNI_nonlin.nii.gz
212216
)
213217
if [ "$overwrite" = false ] && allFilesExist "${output_files[@]}"
214218
then
@@ -232,6 +236,8 @@ function processOutputs(){
232236
cp ${data_outpath}/input/vent_dist_mapping/dwm_t1brain.nii.gz .
233237
cp ${data_outpath}/input/vent_dist_mapping/perivent_flairbrain.nii.gz .
234238
cp ${data_outpath}/input/vent_dist_mapping/dwm_flairbrain.nii.gz .
239+
cp ${data_outpath}/input/t1-mni.anat/T1_biascorr_brain.nii.gz .
240+
cp ${data_outpath}/input/flair-bet/flairvol2t1brain.nii.gz .
235241

236242

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

288+
flirt -in T1_biascorr_brain.nii.gz -applyxfm -init T1_to_MNI_lin.mat \
289+
-out T1_biascorr_brain_to_MNI_lin \
290+
-paddingsize 0.0 -interp trilinear -ref MNI152_T1_1mm_brain.nii.gz
291+
292+
flirt -in flairvol2t1brain.nii.gz -applyxfm -init T1_to_MNI_lin.mat \
293+
-out FLAIR_biascorr_brain_to_MNI_lin \
294+
-paddingsize 0.0 -interp trilinear -ref MNI152_T1_1mm_brain.nii.gz
295+
282296

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

311+
applywarp --in=T1_biascorr_brain.nii.gz --warp=T1_to_MNI_nonlin_coeff.nii.gz \
312+
--out=T1_biascorr_brain_to_MNI_nonlin \
313+
--interp=trilinear --ref=${FSLDIR}/data/standard/MNI152_T1_1mm_brain.nii.gz
314+
315+
applywarp --in=flairvol2t1brain.nii.gz --warp=T1_to_MNI_nonlin_coeff.nii.gz \
316+
--out=FLAIR_biascorr_brain_to_MNI_nonlin \
317+
--interp=trilinear --ref=${FSLDIR}/data/standard/MNI152_T1_1mm_brain.nii.gz
318+
297319
echo all done!
298320
echo
299321
}
@@ -347,7 +369,11 @@ function runAnalysis (){
347369
processOutputs
348370

349371
cd ${data_outpath}/output
350-
zip -q ../${subject}_${session}_results.zip results2mni_lin*.nii.gz results2mni_nonlin*.nii.gz
372+
zip -q ../${subject}_${session}_results.zip \
373+
results2mni_lin*.nii.gz \
374+
results2mni_nonlin*.nii.gz \
375+
T1_biascorr_brain_to_MNI_*lin.nii.gz \
376+
FLAIR_biascorr_brain_to_MNI_*lin.nii.gz
351377

352378
}
353379

0 commit comments

Comments
 (0)