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

Any special steps needed for MNI152NLin2009cAsym? #63

Open oricon opened 6 years ago

oricon commented 6 years ago

I preprocessed my data using fmriprep. I'd like to use the data that's transformed to the MNI Asymmetric template and been denoised with AROMA (e.g., *bold_space-MNI152NLin2009cAsym_variant-smoothAROMAnonaggr_preproc.nii.gz). For ciftify_subject_fmri I used the --already-in-MNI flag, but would I need to do anything differently in terms of processing the T1w? I'm assuming not since the ciftify_recon_all step just uses the freesurfer outputs, but I wanted to check.

Thanks!

oricon commented 6 years ago

I tried running ciftify_subject_fmri using the *bold_space-MNI152NLin2009cAsym_variant-smoothAROMAnonaggr_preproc.nii.gz data and I get an error:

While running: /apps/psyc/workbench/1.3.1/bin_rh_linux64/../exe_rh_linux64/wb_command -cifti-create-dense-timeseries /tmp/SLURM_21418914_20078/tmpoggbctu1/t emp_subject.dtseries.nii -volume /fdata/scratch/joseph.orr/adaptcog/fmri/hcp/sub-M80318505/MNINonLinear/Results/task-ritl_acq-MB_run-01/task- ritl_acq-MB_run-01.nii.gz /fdata/scratch/joseph.orr/adaptcog/fmri/hcp/sub-M80318505/MNINonLinear/ROIs/ROIs.2.nii.gz

ERROR: label volume has a different volume space than data volume

The ROI file (subcortex) lines up well on the functional volume (see below), so I'm not sure what is causing this error.

screen shot 2018-06-15 at 2 50 01 pm
edickie commented 6 years ago

I think it has to do with the functional file being a different voxel resolution than the labels..although ciftify_subject_fmri is suppose to account for this internally so I think it's a bug on my end.. will fix ASAP.

The issue with using the MNI space outputs from fMRIprep is that ciftify_recon_all does a FNIRT based MNI registration of the surfaces. So if your functional data and the cortical surfaces might not be well aligned in regions of the brain where FSL and ANTS perform differently.

I totally agree that using the MNI space ICA AROMA outputs is the ideal use case. It's definitely something I would like to do myself soon. I'll try to figure out a better solution to this issue soon. (Ideally by using the fmriprep ANTS warps inside ciftify).

Thanks for letting me know, Erin

On Fri, Jun 15, 2018 at 3:52 PM, Joseph M. Orr notifications@github.com wrote:

I tried running ciftify_subject_fmri using the *bold_space- MNI152NLin2009cAsym_variant-smoothAROMAnonaggr_preproc.nii.gz data and I get an error:

While running: /apps/psyc/workbench/1.3.1/bin_rh_linux64/../exe_rh_linux64/wb_command -cifti-create-dense-timeseries /tmp/SLURM_21418914_20078/tmpoggbctu1/t emp_subject.dtseries.nii -volume /fdata/scratch/joseph.orr/ adaptcog/fmri/hcp/sub-M80318505/MNINonLinear/Results/task-ritl_acq-MB_run- 01/task- ritl_acq-MB_run-01.nii.gz /fdata/scratch/joseph.orr/adaptcog/fmri/hcp/sub- M80318505/MNINonLinear/ROIs/ROIs.2.nii.gz

ERROR: label volume has a different volume space than data volume

The ROI file (subcortex) lines up well on the functional volume (see below), so I'm not sure what is causing this error.

[image: screen shot 2018-06-15 at 2 50 01 pm] https://user-images.githubusercontent.com/8575279/41486832-b5b5f7c8-70ab-11e8-896c-78c53e78a67f.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/edickie/ciftify/issues/63#issuecomment-397725475, or mute the thread https://github.com/notifications/unsubscribe-auth/AMl59uMd0j39mbEg53G9KvXTLRDqw0PPks5t9BCDgaJpZM4UqBrT .

edickie commented 6 years ago

Weird. I'm not replicating the error on my end. What version of ciftify are you using? Can I have a copy of you cifti_subject_fmri.log file so I can debug further?

oricon commented 6 years ago

Ahh weird. Sure, here's a logfile. Let me know if you need the accompanying recon_all.log file.

I have ciftify 2.0.2

ciftify_subject_fmri.log

edickie commented 6 years ago

This one seems to have another error. wb_command is failing on the first file read.. Are you able to run other functions on that input file?

Running: wb_command -volume-math "(x)" /tmp/SLURM_21418878_20078/tmp7zjqhk4e/native_func_first.nii.gz -var x /fdata/scratch/joseph.orr/adaptcog/fmri/preproc/fmriprep/sub-M80301092/func/sub-M80301092_task-ritl_acq-MB_run-01_bold_space-MNI152NLin2009cAsym_variant-smoothAROMAnonaggr_preproc_trimmed.nii.gz -subvolume 1
cmd: wb_command -volume-math "(x)" /tmp/SLURM_21418878_20078/tmp7zjqhk4e/native_func_first.nii.gz -var x /fdata/scratch/joseph.orr/adaptcog/fmri/preproc/fmriprep/sub-M80301092/func/sub-M80301092_task-ritl_acq-MB_run-01_bold_space-MNI152NLin2009cAsym_variant-smoothAROMAnonaggr_preproc_trimmed.nii.gz -subvolume 1 
 Failed with returncode 255

SEVERE: error closing compressed file '/fdata/scratch/joseph.orr/adaptcog/fmri/preproc/fmriprep/sub-M80301092/func/sub-M80301092_task-ritl_acq-MB_run-01_bold_space-MNI152NLin2009cAsym_variant-smoothAROMAnonaggr_preproc_trimmed.nii.gz'
Method: virtual caret::ZFileImpl::~ZFileImpl()
Location: CaretBinaryFile.cxx:275

While running:
/apps/psyc/workbench/1.3.1/bin_rh_linux64/../exe_rh_linux64/wb_command -volume-math '(x)' /tmp/SLURM_21418878_20078/tmp7zjqhk4e/native_func_first.nii.gz -var x /fdata/scratch/joseph.orr/adaptcog/fmri/preproc/fmriprep/sub-M80301092/func/sub-M80301092_task-ritl_acq-MB_run-01_bold_space-MNI152NLin2009cAsym_variant-smoothAROMAnonaggr_preproc_trimmed.nii.gz -subvolume 1

ERROR: error while reading from nifti file '/fdata/scratch/joseph.orr/adaptcog/fmri/preproc/fmriprep/sub-M80301092/func/sub-M80301092_task-ritl_acq-MB_run-01_bold_space-MNI152NLin2009cAsym_variant-smoothAROMAnonaggr_preproc_trimmed.nii.gz'
oricon commented 6 years ago

I ran fslroi on the input files to trim the first 6 volumes and for some reason it messed up a lot of the files causing this problem. So I'll try fixing the trim and rerun ciftify fmri.

Thanks!

mtnhuck commented 5 years ago

Hi! I'm having a relatively similar error: ERROR: label volume has a different volume space than data volume I ran fmriprep 1.1.2 on my dataset and am trying to convert one/all of the task files to cifti. ciftify_recon_all seems to have run correctly and now I'm attempting to run ciftify_subject_fmri. Both ROIs.2.nii.gz and the fmriprep preprocessed files are in 2x2x2 space, but they have different FOV - 91x109x91 for ROIs.2.nii.gz and 92x115x97 (x605 functionals). I have ciftify version 2.0.9. Does the workflow not flag these for resampling because they are in the same 2x2x2 space, just with different fields of view? Thanks so much!

edickie commented 5 years ago

So, your right, the issue is that the ROIs.2.nii.gz file are registered to the FSL MNI template which is actually slightly different than MNI152NLin2009 cAsMNI152NLin2009 cAsymym. (I think we are not calling it MNI152NLin6Sym), and the difference that is the issue with the FOV of the two templates (91x109x91 vs 92x115x97). ciftify_recon_all is still re-calculating a transform to the other template for this reason.

One hack to fix this would be to try reslice the ROIs.2.nii.gz file to the MNI152NLin2009cAsym Template.

I should note that one issue to keep in mind, however, if your using the fmriprep AROMA outputs, is that the surface resampling assumes that the fMRI for the cortex is also aligned to the MNI152NLin6Sym template, so I would double check that the MNI space surfaces (i.e. those in the MNINonLinear/fsaverage_LR32k folder) overlay nicely with the MNI transformed volumes, before going forward..

mtnhuck commented 5 years ago

Thanks so much for the quick response!

  1. I am a little confused because I thought that ciftify does try to resample functional images into the template space based on what I read above? Or is it not picking up on it because they are both 2x2x2 but different FOV? Is this a common problem with fmriprep output? If it did another transform from to MNI152NLin6Sym then it should be in the same space as the Atlas_ROIs.2.nii.gz, yes? As a note I did a pretty vanilla run of fmriprep.

  2. Would I resample the version of Atlas_ROIs.2.nii.gz in ciftify/data/standard_mesh_atlases or ciftify/data/91282_Greyordinates or both of them?

  3. If resampling is the correct way to go then would I do that before running ciftify_recon_all?

  4. I am not planning on using the AROMA outputs so that doesn't sounds like a problem.

Cheers

edickie commented 5 years ago

Sorry about not coming back to this. Yes, ciftify is supposed to do all the internal resampling but it does so assuming that inputs are in "individual" or "T1w" space, not from MNI152NLin2009cAsym.

In other words.. ciftify_subject_fmri was intended (in default settings) to take the _space-T1w preprocessed bold inputs. Some user's might not have these because they are not an fmriprep default (you need to indicate --output-space T1w in the call to fmriprep).

I don't know if that addresses your issue.

mtnhuck commented 5 years ago

Thanks so much - I'm running a few test subjects now.

helloTC commented 4 years ago

@edickie Hi, I think I know why this error happened. I ran the same command as oricon mentioned but still got the same problem. Here is my code: ciftify_subject_fmri --surf-reg MSMSulc --SmoothingFWHM 4 --ciftify-work-dir test_ciftify_output/ --already-in-MNI test_output_new/fmriprep/sub-M01/ses-01/func/sub-M01_ses-01_task-motor_run-3_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.nii.gz sub-M01 ses-01_task-motor_run-03 I got an error:

While running: /usr/local/neurosoft/workbench/bin_linux64/../exe_linux64/wb_command -cifti-create-dense-timeseries /tmp/tmpw7wgtfgv/temp_subject.dtseries.nii -volume /nfs/h1/workingshop/huangtaicheng/try_htc/test_ciftify_mni152/sub-M01/MNINonLinear/Results/ses-01_task-motor_run-03/ses-01_task-motor_run-03.nii.gz /nfs/h1/workingshop/huangtaicheng/try_htc/test_ciftify_mni152/sub-M01/MNINonLinear/ROIs/ROIs.2.nii.gz ERROR: label volume has a different volume space than data volume

This error happened not due to MNI152NLin2009 because I also got the same error with MNI152NLin6Asym. I checked the difference of mri info between the sub-M01_ses-01_task-motor_run-3_space-MNI152NLin6Asym_desc-smoothAROMAnonaggr_bold.nii.gz and ROIs.2.nii.gz, and I found the orientation of the first file is RAS but the second one is LAS. I further checked the orientation of MNI152_2mm.nii.gz from the FSL, it is LAS, which is same to ROIs.2.nii.gz, while orientation of tpl-MNI152NLin6Asym_res-02_T1w.nii.gz which downloaded from the templateflow, is RAS. I think this is the reason why wb_command feedback an error that label volume has a different volume space than data volume.

I'm not sure why orientation of the MNI152NLin6Asym from the fmriprep is different from the MNI152_2mm.nii.gz from the FSL, perhaps you can fix this issue in the updating version of ciftify by examining the coordinate system of the input.

Thanks!