Qsiprep "freesurfer data is required to make HSVS 5tt image"... does anyone know what these "files" that are needed are?

I am trying the run the pre-configured reconstruction pipeline : mrtrix_multishell_msmt_ACT-hsvs (Reconstruction — qsiprep version documentation)

Because I am using data that was already preprocessed, I only need to do reconstruction. However, I realized that when I ran it, the error code, FreeSurfer data is required to make HSVS 5tt image. popped up.

Because I did not use FreeSurfer for preprocessing, I do not know what files freesurfer gives and hence do not know which files have to be inside of the freesurfer directory in order to make the reconstruction work… Does anyone know what kind of data I need and how I can get it?

Thank you!!!

Hi,

You would need to run recon-all from FreeSurfer on the subject’s T1 image.

Best,
Steven

1 Like

Thank you! I’ll try that:)

I had same problem.

  1. Is there specific file format about recon-all data files?

  2. Can I make recon-all file by using qsiprep Preprocessing pipeline?

If someone helps me, it will be really helpful for me.

Thank you.
Joseph

Yes, there is very specific folder and file naming conventions. It would not be worth the effort trying to make it manually based on files you may or may not have.

Yes, you can add --do-reconall to your qsiprep command.

1 Like

Thanks, Steven!

I’ll try it. Have a nice day! :grinning:

Update some information for people who may need it:

“–do-reconall” have been removed from qsiprep 0.15.0 because it took up a ton of space in the docker image .

More information can found in:

Our group usually runs freesurfer as part of fmriprep and then uses its output for the 5tt hsvs workflow in qsiprep. Almost any normal run of recon-all will produce everything you need for 5tt hsvs

Hi,
I‘d like to ask if it’s possible to use T1w images preprocessed by qsiprep directly with recon-all? Does the original qsiprep pipeline (with the --do-reconall parameter) operate this way? I’m a bit uncertain whether some of the overlapping preprocessing steps, like bias field correction, between recon-all and qsiprep might have a significant negative impact on the final 5tt file generated. Thank you very much in advance for your guidance.

Hi @Shanbin_Zhang,

No I would not recommend using the preprocessed qsiprep t1 in recon-all, because steps like bias correction would be repeated. Is there a reason you don’t want to use the raw T1?

Best,
Steven

Hi Steven,

Thank you for your response. The reason I was considering using the preprocessed QSIPrep T1 in recon-all is that my subsequent reconstruction work is not being performed with QSIRECON. Therefore, I need a 5TT image that is aligned with the DWI. If I were to use the raw T1, I would need to perform an additional registration step to align it with the DWI.

It seems that using the QSIPrep output T1 for recon-all is not recommended. In that case, I’ll proceed with manual registration instead. Alternatively, would it be feasible to specify the -nonuintensitycor option when calling recon-all to address this issue?

Best ,
Shanbin

Hi @Shanbin_Zhang, the following is adapted from the qsirecon workflows to calculate the FreeSurfer to DWI registration:

#!/bin/bash -l
## Define important paths
bids="/path/to/bids/" # replace with your own BIDS dataset
workdir="/path/to/scratch/space/" # working directory, scratch space e.g., /tmp
qsiprep_IMG="/path/to/qsiprep_container.img" # Software container
subject="sub-01" # Replace with your own subject ID
mkdir -p "${workdir}/${subject}"
export SUBJECTS_DIR="${bids}/derivatives/freesurfer/" # Where FreeSurfer outputs are

## We can use the software in the QSIPrep container to run the commands below
run_qsiprep_cmd="singularity exec --containall -e -B ${bids},${workdir} ${qsiprep_IMG}" # Alias for easy invocation of QSIPrep container

# Convert from FreeSurfer .mgz file format to NIFTI
${run_qsiprep_cmd} mrconvert -strides -1,-2,3 \
    ${SUBJECTS_DIR}/${subject}/mri/brain.mgz ${workdir}/${subject}/fs_brain.nii

# Register FreeSurfer brain to QSIPrep T1w
${run_qsiprep_cmd} antsRegistration --collapse-output-transforms 1 \
    --dimensionality 3 --float 0 \
    --initial-moving-transform [ ${bids}/derivatives/qsiprep/${subject}/anat/${subject}_desc-preproc_T1w.nii, ${workdir}/${subject}/fs_brain.nii, 1 ] \
    --initialize-transforms-per-stage 0 --interpolation BSpline \
    --output [ ${workdir}/${subject}/transform, ${workdir}/${subject}/transform_Warped.nii.gz ] \
    --transform Rigid[ 0.1 ] \
    --metric Mattes[ ${bids}/derivatives/qsiprep/${subject}/anat/${subject}_desc-preproc_T1w.nii, ${workdir}/${subject}/fs_brain.nii, 1, 32, Random, 0.25 ] \
    --convergence [ 1000x500x250x100, 1e-06, 10 ] \
    --smoothing-sigmas 3.0x2.0x1.0x0.0mm --shrink-factors 8x4x2x1 \
    --use-histogram-matching 0 \
    --masks [ ${bids}/derivatives/qsiprep/${subject}/anat/${subject}_desc-brain_mask.nii.gz, NULL ] \
    --winsorize-image-intensities [ 0.002, 0.998 ] \
    --write-composite-transform 0

# Convert ANTs .mat transform to .txt, and rename it
${run_qsiprep_cmd} ConvertTransformFile 3 \
    ${workdir}/${subject}/transform0GenericAffine.mat \
    ${workdir}/${subject}/${subject}_from-FS_to-T1wACPC_mode-image_xfm.txt

# Convert ANTs transform to MRTrix compatible transform 
${run_qsiprep_cmd} transformconvert \
    ${workdir}/${subject}/${subject}_from-FS_to-T1wACPC_mode-image_xfm.txt \
    itk_import \
${bids}/derivatives/qsirecon/${subject}/anat/${subject}_from-FS_to-T1wACPC_mode-image_xfm.txt

Best,
Steven

1 Like

Hi @Steven! Thank you for your replies!
At what stage would you incorporate/use this transformation? I have a similar problem:

  • I performed QSIPrep on raw T1w and dwMRI
  • Someone performed FS reconstruction on raw T1w

I wanna get structural connectomes, but: I get all atlases sorted using FreeSurfer’s output, and I do tractography using QSIPrep output. As a result, my atlases are not aligned with QSIPrep-ed T1w/DWI.
I did CSD outside of QSIRecon because I used a ‘custom-made’ pipeline. Now I am unsure at what stage I need to align FreeSurfer’s and QSIPrep’s outputs.

Hi @Irina1,

Would it be possible to change one of the recon-specs to do whatever custom pipeline you did? Then you can run everything in qsirecon, and is what I would suggest first to keep everything as reproducible and clean as possible.

If that is not a possibility, understand that the FreeSurfer inputs are just used to make the 5TT HSVS image for anatomically constrained tractography. It just needs to be done at some point before tractography. You should definitely not be moving the DWI to FreeSurfer space (don’t want to deal with interpolation of DWI and rotating the gradient table).

Best,
Steven

1 Like

Thank you so much! I am now trying to incorporate all steps in QSIRrecon, but face some issues here too because the pipeline is a bit too complicated. The trick is that I also use FS outputs to align/produce parcellations as well, so I also use lh/rh.pial/white/etc from /surf, so it seems that the issue goes beyond 5tt only. I think it would be better to sacrifice the pipeline reproduction but try to do all in qsirecon.