edickie / ciftify

The tools of the Human Connectome Project (HCP) adapted for working with non-HCP datasets
https://edickie.github.io/ciftify/
MIT License
111 stars 156 forks source link

ciftify_recon_all skipping dlabel creation #140

Closed srai00 closed 3 years ago

srai00 commented 3 years ago

Hi,

I'm having a problem with ciftify_recon_all and then ciftify_subject_fmri as well. I ran recon-all in FS version 7.1.0 and used the outputs of that for ciftify_recon_all, and I get this error:

_label file /var/folders/jp/z6g2dx8d6pd4qydlfrbpvl6m0000gn/T/tmpjragkk4h/MNINonLinear/native/sub-MSC01.L.BA.native.label.gii does not exist. Skipping dlabel creation. label file /var/folders/jp/z6g2dx8d6pd4qydlfrbpvl6m0000gn/T/tmpjragkk4h/164k_fs_LR/sub-MSC01.L.BA.164k_fs_LR.label.gii does not exist. Skipping dlabel creation. label file /var/folders/jp/z6g2dx8d6pd4qydlfrbpvl6m0000gn/T/tmpjragkk4h/32k_fs_LR/sub-MSC01.L.BA.32k_fsLR.label.gii does not exist. Skipping dlabel creation.

The cifti_vis_recon_all outputs seem to be in order, but running ciftify_subject_fmri fails with this error:

_WARNING: volume label file has empty definition of 'ACCUMBENS_LEFT', skipping

WARNING: volume label file has empty definition of 'ACCUMBENS_RIGHT', skipping

WARNING: volume label file has empty definition of 'AMYGDALA_LEFT', skipping

WARNING: volume label file has empty definition of 'AMYGDALA_RIGHT', skipping

WARNING: volume label file has empty definition of 'BRAIN_STEM', skipping

WARNING: volume label file has empty definition of 'CAUDATE_LEFT', skipping

WARNING: volume label file has empty definition of 'CAUDATE_RIGHT', skipping

WARNING: volume label file has empty definition of 'CEREBELLUM_LEFT', skipping

WARNING: volume label file has empty definition of 'CEREBELLUM_RIGHT', skipping

WARNING: volume label file has empty definition of 'DIENCEPHALON_VENTRAL_LEFT', skipping

WARNING: volume label file has empty definition of 'DIENCEPHALON_VENTRAL_RIGHT', skipping

WARNING: volume label file has empty definition of 'HIPPOCAMPUS_LEFT', skipping

WARNING: volume label file has empty definition of 'PUTAMEN_LEFT', skipping

WARNING: volume label file has empty definition of 'THALAMUS_LEFT', skipping

WARNING: volume label file has empty definition of 'THALAMUS_RIGHT', skipping

cmd: wbcommand -cifti-resample /var/folders/jp/z6g2dx8d6pd4qydlfrbpvl6m0000gn/T/tmpczfjd3l/temp_subjectdilate.dtseries.nii COLUMN /var/folders/jp/z6g2dx8d6pd4qydlfrbpvl6m0000gn/T/tmpczfjd3l/temp_template.dlabel.nii COLUMN ADAP_BARYAREA CUBIC /var/folders/jp/z6g2dx8d6pd4qydlfrbpvl6m0000gn/T/tmpczfjd3l/temp_atlas.dtseries.nii -volume-predilate 10 Failed with returncode 255

While running: /Applications/workbench/bin_macosx64/../macosx64_apps/wb_command.app/Contents/MacOS/wbcommand -cifti-resample /var/folders/jp/z6g2dx8d6pd4qydlfrbpvl6m0000gn/T/tmpczfjd3l/temp_subjectdilate.dtseries.nii COLUMN /var/folders/jp/z6g2dx8d6pd4qydlfrbpvl6m0000gn/T/tmpczfjd3l/temp_template.dlabel.nii COLUMN ADAP_BARYAREA CUBIC /var/folders/jp/z6g2dx8d6pd4qydlfrbpvl6m0000gn/T/tmpczfjd3l/temp_atlas.dtseries.nii -volume-predilate 10

ERROR: AccumbensLeft volume model missing from input cifti_

benWozak commented 3 years ago

I'm having the same issue.

ciftify_subject_fmri fails because it's looking for those dlabel files that don't exist. Is there a workaround for this issue?

Any help would be greatly appreciated!!

Thanks @edickie @DESm1th

srai00 commented 3 years ago

Looking at the BA label step in recon-all from the newer versions the outputs are: label/?h.BA_exvivo.label Whereas versions 5.3 and lower the outputs are: label/?h.BA.label

I'm wondering if this issue is due to using Freesurfer version 7.1.1?

edickie commented 3 years ago

Sorry for the late response. Yes, different versions of freesurfer will output different "BA" annotions, and I haven't adjusted for Freesurfer 7.1.1 - so that explains the issues. However, anything with the "BA" dlabels should be warnings that don't impact the overall pipeline.

The one file that is required (for generation of hte brainmask file and for a white matter mask used in the fmri step is the "wmparc" file. Is that one not present in your freesurfer outputs? Sometimes it is created late in the freesurfer pipeline so it could be missing if the pipeline didn't finish properly.

srai00 commented 3 years ago

Hi Erin!

That makes sense about the BA labels.

I do have a wmparc.mgz file in my MRI output from FreeSurfer. And when I look at where ciftify_subject_fmri isn't working, it seems to be the step when it creates dense time series and I think the problem may be the ROIs.2.nii.gz file.

ROIs.2.nii.gz

srai00 commented 3 years ago

I believe in ciftify recon-all the wmparc file is being used for this step to get the volume labels: -volume-label-import /Users/sr/Desktop/hcp-output/sub-MSC05/T1w/wmparc.nii.gz /Users/sr/opt/anaconda3/lib/python3.7/site-packages/ciftify/data/hcp_config/FreeSurferAllLut.txt /Users/sr/Desktop/hcp-output/sub-MSC05/T1w/wmparc.nii.gz -drop-unused-labels

edickie commented 3 years ago

Yes!

The error it seems to be complaining about missing subcortical structures in the wmparc file? Are hte freesurfer 7 wmparc different in some way (i.e. different colour lookup table?)

srai00 commented 3 years ago

I think the lookup table is different...In the ciftify site packages the Lut for left cerebral is:

LEFT-CEREBRAL-EXTERIOR 1 70 130 180 255

But in FS 7 the Lut for left cerebral is:

No. Label Name: R G B A

1 Left-Cerebral-Exterior 70 130 180 0

edickie commented 3 years ago

Those look the same - other than connectome-workbench lookup table --> FS lookup table formating differences.

i.e. in both cases "Left-Cerebral-Exterior" has an integer label of 1.

The original error complained about "ERROR: AccumbensLeft volume model missing from input cifti_" (is the "Accumbens Left" still being parcellated the same way?)

srai00 commented 3 years ago

ROIs.2_original.nii.gz ROIs_terminal.nii.gz

Could it be related to this somehow...

When I use this step in cifti_recon_all as written it gives me the ROI file I uploaded:

Running: wb_command -logging SEVERE -volume-label-import /var/folders/jp/z6g2dx8d6pd4qydlfrbpvl6m0000gn/T/tmp62qqmgl7/wmparc.2.nii.gz /Users/sr/opt/anaconda3/lib/python3.7/site-packages/ciftify/data/hcp_config/FreeSurferSubcorticalLabelTableLut.txt /Users/sr/Desktop/hcp-output/sub-MSC05/MNINonLinear/ROIs/ROIs.2.nii.gz -discard-others

But when I do this step separately in terminal using the wmparc file in the T1 folder as below, I get a different ROI file. So I'm wondering if the issue is the wmparc.2.nii.gz from the temp folder?

wb_command -logging SEVERE -volume-label-import /Users/sr/Desktop/hcp-output/sub-MSC05/T1w/wmparc.nii.gz /Users/sr/opt/anaconda3/lib/python3.7/site-packages/ciftify/data/hcp_config/FreeSurferSubcorticalLabelTableLut.txt /Users/sr/Desktop/hcp-output/sub-MSC05/MNINonLinear/ROIs/ROIs.2.nii.gz -discard-others

srai00 commented 3 years ago

Resolved the issue by reverting to FS 6.

Using FS 7 definitely has some effect on the ROIs.2.nii.gz file that causes the error in Ciftify. Could be related to segmentation issues in FS (http://freesurfer.net/fswiki/ThalamicNuclei) or with changes in the new lookup table (https://github.com/MRtrix3/mrtrix3/issues/2065), I'm not 100% sure.

marcelzwiers commented 2 years ago

@srai00 I am having the same issue with Freesurfer 6.0 (i.e. ciftify_recon_all gave no error but ciftify_subject_fmri gave the same error as you had), what ciftify and workbench version were you using?

srai00 commented 2 years ago

@marcelzwiers I believe my original issue was with using FreeSurfer 7.0. My versions for the programs are as follows:

FreeSurfer version 6.0 Python version 3.7.9 Connectome Workbench version 1.4.2 Ciftify version 2.3.3 FSL version 6.0.4

Hopefully it's just a version issue for you as well!

AlexLin95-Neurosurg commented 2 years ago

Same error as encountered by @marcelzwiers. I'm using the output of fmriprep (21.0.2) who uses freesurfer 6.0.1 for surface reconstruction. ciftify_recon_all gave no error but ciftify_subject_fmri gave the same error. The python version is 3.8.0, the connectome workbench version 1.5.0, ciftify version 2.3.3, and fsl version 6.0.5.1.

AlexLin95-Neurosurg commented 2 years ago

Update: I noticed that although the version of the freesurfer in fmriprep docker image is 6.0, i installed actually freesurfer version 7.2.0 in my computer (Ubuntu 18.04). Issue was resolved after changing to freesurfer 6.0 for the ciftify.

My version for the programs are as follows: fmriprep docker version 21.0.2 (implemented with freesurfrer 6.0.1) Freesurfer version 6.0.0 (The only update in 6.0.1 is the ability to point to an external license using the FS_LICENSE environment variable) Python version 3.8.0 Connectome workbench version 1.4.2 (Both version 1.5.0 and 1.3.2 give warnings.) Ciftify version 2.3.3 FSL version 6.0.5.1

marcelzwiers commented 2 years ago

I managed in the end, indeed with some warnings, e.g.:

[..]
WARNING: conflicting key value for label 'R_entorhinal_exvivo' reassigned to key 28
[..]
label file /data/marzwi/46886544.dccn-l029.dccn.nl/tmpndqcssr0/164k_fs_LR/sub-003.L.BA.164k_fs_LR.label.gii does not exist. Skipping dlabel creation

I think these do not affect the end result

Here's what I did: