Closed xingyu-liu closed 2 months ago
I also have tried to extract the 4D mat in .npz and save it as nii.gz, the data format was then recognizable, but no effect of applying it by antsApplyTransforms.
Hi @xingyu-liu, we are working on this and will keep you in the loop.
@xingyu-liu Hi, We have changed the step of applying the transformation matrix into a separate executable script. The specific steps are:
Pull the 112-the-usage-of-xfm-files branch
Rebuild an image with an empty entrypoint,the Dockerfile can be referenced as follows:
FROM pbfslab/deepprep:23.1.0 ENTRYPOINT []
To mount the code of the new branch in the docker container, you can refer to:
docker run -it --rm --gpus all -v /workspace/DeepPrep/deepprep:/opt/DeepPrep/deepprep -v /license/license.txt:/opt/freesurfer/license.txt new_image /bin/bash
If you want to apply a transformation matrix on T1w you can do the following:
export FREESURFER_HOME=/opt/freesurfer && python3 /opt/DeepPrep/deepprep/nextflow/bin/apply_trans_matrix_from_t1_to_MNI.py --t1_native2mm /DeepPrep_workdir/BOLD/sub-01/anat/sub-01_space-T1w_res-2mm_desc-skull_T1w.nii.gz --trans_vox /DeepPrep_workdir/BOLD/sub-01/anat/sub-01_from-T1w_to_MNI152NLin6Asym_desc-nonlinear_xfm.npz --template_space MNI152NLin6Asym --template_resolution 02 --synth_script /opt/DeepPrep/deepprep/SynthMorph/mri_bold_apply_synthmorph.py --anat_file /DeepPrep_workdir/BOLD/sub-01/anat/sub-01_space-T1w_res-2mm_desc-skull_T1w.nii.gz --anat_output /DeepPrep_workdir/BOLD/sub-01/anat/sub-01_space-MNI152NLin6Asym_res-02_desc-skull_T1w.nii.gz
If you want to apply a transformation matrix on bold you can do the following:
export FREESURFER_HOME=/opt/freesurfer && python3 /opt/DeepPrep/deepprep/nextflow/bin/apply_trans_matrix_from_t1_to_MNI.py --bold_file /DeepPrep_workdir/BOLD/sub-01/ses-01/func/sub-01_ses-01_task-rest_run-01_space-T1w_desc-preproc_bold.nii.gz --fframe_bold_output /DeepPrep_workdir/BOLD/sub-01/ses-01/func/sub-01_ses-01_task-rest_run-01_space-MNI152NLin6Asym_res-02_boldref.nii.gz --orig_bold /DeepPrep_workdir/BIDS/sub-01/ses-01/func/sub-01_ses-01_task-rest_run-01_bold.nii.gz --t1_native2mm /DeepPrep_workdir/BOLD/sub-01/anat/sub-01_space-T1w_res-2mm_desc-skull_T1w.nii.gz --trans_vox /DeepPrep_workdir/BOLD/sub-01/anat/sub-01_from-T1w_to_MNI152NLin6Asym_desc-nonlinear_xfm.npz --template_space MNI152NLin6Asym --template_resolution 02 --work_dir /DeepPrep_workdir/tmp --synth_script /opt/DeepPrep/deepprep/SynthMorph/mri_bold_apply_synthmorph.py --bold_output /DeepPrep_workdir/BOLD/sub-01/ses-01/func/sub-01_ses-01_task-rest_run-01_space-MNI152NLin6Asym_res-02_desc-preproc_bold.nii.gz
Hope it can help you!
Hi, I have a couple of questions regarding the usage of xfm filed provided in anat dir.
Could you elaborate me on how to apply the transformation from a image in T1w space to MNI sapce using the 'sub-01_from-T1w_to_MNI152NLin2009cAsym_desc-nonlinear_xfm.npz'? I've tried antsApplyTransforms, it couldn't recognize the .npz file type.
I'm also not sure how to use the 'sub-01_from-T1w_to-MNI152NLin2009cAsym_desc-affine_xfm.txt' correctly. when I tried '
flirt -in t1w_data -ref MNI_data -applyxfm -init sub-01_from-T1w_to-MNI152NLin2009cAsym_desc-affine_xfm.txt
, the output image was in a weird space other than the MNI space.A minor typo: a '_' was in the nonlinear_xfm.npz file name where it should be '-'. e.g.,
Thank you so much!