Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nifti files to be used with HCP Workbench #2031

Closed
shilpitju opened this issue Mar 11, 2020 · 38 comments
Closed

Nifti files to be used with HCP Workbench #2031

shilpitju opened this issue Mar 11, 2020 · 38 comments
Labels
Milestone

Comments

@shilpitju
Copy link

shilpitju commented Mar 11, 2020

Hi,

I have preprocessed my fMRI data using fMRIPrep with fs-no-reconall. My output functional and structural files are in nii format. However, later I realized I want to use 'The Cole-Anticevic Brain-wide Network Partition (CAB-NP)' (that is in Cifti format), for further ROI based analysis. This atlas can be accessed using HCP Workbench.

Can you please suggest me a way out to solve this issue?

Thanks,

Shilpi Modi

@effigies
Copy link
Member

Add fsLR to your output spaces to get CIFTI outputs. Also, CIFTI files can only be made if the surfaces are reconstructed. --fs-no-reconall will prevent this.

@shilpitju
Copy link
Author

Alright. Thank you.

@shilpitju
Copy link
Author

Hi,

Is --cifti-output different from fsLR?

@mgxd
Copy link
Collaborator

mgxd commented Mar 11, 2020

hi @shilpitju - ---cifti-output is the flag necessary to produce your BOLD runs as CIFTI dtseries. Adding fsLR to your --output-spaces is not necessary.

However, I would strongly recommend waiting to produce CIFTI output until a new release (which will be 20.0.3) - the current implementation is producing incorrect data.

@shilpitju
Copy link
Author

Thanks.

When do we expect the new release?

@mgxd
Copy link
Collaborator

mgxd commented Mar 11, 2020

We should have one out later today

@shilpitju
Copy link
Author

That's fantastic. Thanks

@shilpitju
Copy link
Author

shilpitju commented Mar 11, 2020

Please have a look on my command below:

fmriprep-docker .\inputdir .\outputdir participant --participant-label sub-0001 --fs-lic
ense-file .\license.txt --use-syn-sdc --output-spaces MNI152NLin6Asym MNI152NLin2009cAsym fsLR --cifti-output --stop-on-first-crash

Will it serve my purpose of obtaining output in nifti as well as cifti formats?

@effigies
Copy link
Member

Do you actually want all of these outputs? What spaces would you like to do analysis in?

@shilpitju
Copy link
Author

For nii, I want my outputs in MNInonlinearv6 space. However, I think SDC only works when MNI152NLin2009cAsym is chosen as an output space (M I wrong here?). Plus, for Cifti fsLR and --cifti-output have to be used.

@effigies
Copy link
Member

In 20.0.x, you should not have to adjust output spaces for particular processing options. You can drop the 2009cAsym; it will be used internally but won't be placed in your outputs. Similarly, according to @mgxd, you don't need fsLR, just --cifti-output. So:

fmriprep-docker inputdir outputdir participant \
    --participant-label 0001 --fs-license-file license.txt \
    --use-syn-sdc --output-spaces MNI152NLin6Asym \
    --cifti-output --stop-on-first-crash

@shilpitju
Copy link
Author

Thanks a ton !!!

@shilpitju
Copy link
Author

One more question plz, in order to run SDC, do we need to choose --output-spaces MNI152NLin6Asym (even if we don't want output in nifti)?

@effigies
Copy link
Member

No.

@shilpitju
Copy link
Author

Thanks again.

@shilpitju
Copy link
Author

When is 20.0.x release expected?

@effigies
Copy link
Member

Pending #2032. Hopefully today. Possibly tomorrow.

@shilpitju
Copy link
Author

All the best.

@shilpitju
Copy link
Author

shilpitju commented Mar 13, 2020

fmriprep-docker inputdir outputdir participant
--participant-label 0001 --fs-license-file license.txt
--use-syn-sdc --cifti-output --stop-on-first-crash

In the above command since I have not given any option for '--output-spaces', will the output be only in Cifti or MNI as well?

@oesteban
Copy link
Member

That command line will only generate CIFTI2 grayordinates files.

@effigies
Copy link
Member

Do we not still default to 2009c if output spaces is empty?

@mgxd
Copy link
Collaborator

mgxd commented Mar 14, 2020

We do, 2009c outputs should be there if --output-spaces isn't defined

@oesteban
Copy link
Member

Sorry, @shilpitju, as @effigies points out, I'm wrong. With such a command line, fMRIPrep should give you both types of outputs: one CIFTI2 grayordinates file and one NIfTI volume one the default MNI152NLin2009cAsym space.

If you don't want the volumetric outputs to be written, you can add the --output-spaces flag without any arguments, e.g.:

fmriprep-docker inputdir outputdir participant \
    --participant-label 0001 --fs-license-file license.txt \
    --use-syn-sdc --cifti-output --stop-on-first-crash \
    --output-spaces

@shilpitju
Copy link
Author

Thanks

@shilpitju shilpitju reopened this Mar 16, 2020
@shilpitju
Copy link
Author

Hi,

I tried to use -cifti-parcellate command to parcellate my input cifti functional file using 'The Cole-Anticevic Brain-wide Network Partition'.

I used the fillowing command:

eval(['!wb_command -cifti-parcellate ' inputFile ' ' parcelCIFTIFile ' COLUMN ' parcelTSFilename ' -method MEAN'])

The output obtained is as:

While running:
wb_command -cifti-parcellate input.dtseries.nii CortexSubcortex_ColeAnticevic_NetPartition_wSubcorGSR_parcels_LR.dlabel.nii COLUMN Output_Atlas_CortSubcort.Parcels.LR.ptseries.nii -method MEAN

ERROR: input cifti files must have the same volume space

My input dtseries was obtained after processing using fmriprep 20.0.3

Regards,

Shilpi Modi

@shilpitju
Copy link
Author

In continuation to above are volume-based subcortical voxels included in fmriprep preprocessing? Intuitively they should be, but just wanted to confirm.

Thanks

@mgxd
Copy link
Collaborator

mgxd commented Mar 17, 2020

hi @shilpitju - yes, volumes are present in the files. I took a deeper look into this, here's what I found:

  • Inspecting the volumes of some CIFTI files generated with HCPPipelines, the dimensions match the files produced by fmriprep. However, HCP volumes are in LAS orientation, while fmriprep produces RAS. Producing an image in LAS orientation fixes the above error, though -cifti-parcellate should probably be expanded to handle RAS orientation as well.

  • When generating the subcortical structures, fmriprep assumes the label file orientation matches the BOLD - currently this isn't the case, so the subcortical rois may be slightly off. There's a fix underway in BF: Ensure BOLD and label orientations are equal niworkflows#477 that will ensure these files match, and subsequently produce a volume in LAS for easier portability with workbench tools.

@shilpitju
Copy link
Author

Thanks. I will look into nipreps/niworkflows#477 . However, can ciftify tools sort out these issues?

@oesteban
Copy link
Member

paging @edickie

@edickie
Copy link

edickie commented Mar 17, 2020

It sounds like the volumn output is in the cifti file, but it may not be the same volume space as teh fsLR outputs from HCPPipelines (or ciftify)? How are you resampling the volume output before creating the cifti files?

@shilpitju A fast workaround for is to use "wb_command -cifti-separate" to separate the Antecivic-Cole Atlas into separate Left-cortex (gifti), right-cortex (gifti) and subcortical atlas files. The subcortical atlas ROIs would be in MNI space (nifti mask)... so you could easily use them to extract timeseries from the MNI space nifti fmriprep outputs...

@shilpitju
Copy link
Author

@edickie I have not yet used ciftify tools (have just pre-processed the data using fmriprep) . I was thinking that since freesurfer has already been run on my structural data, so now ciftify can be used to get everything into cifti.

However, as suggested by you if I separate the cole atlas into left-right-cortex and subcortex atlas files, will it sort the issue of LAS, RAS mismatch between fmriprep cifti output and HCP cifti?

@mgxd mgxd added this to the 20.0.4 milestone Mar 17, 2020
@mgxd
Copy link
Collaborator

mgxd commented Mar 17, 2020

@shilpitju it won't, but you can reorient the volume and then recombine the files to generate the CIFTI.

Alternatively, you can rerun using the new release that will be out later today (20.0.4) which should allow you to parcellate without raising an error.

@shilpitju
Copy link
Author

Alright. Thanks

@mgxd
Copy link
Collaborator

mgxd commented Mar 18, 2020

20.0.4 is now available - please reopen the issue persists

@mgxd mgxd closed this as completed Mar 18, 2020
@shilpitju
Copy link
Author

shilpitju commented Mar 18, 2020

Hi,

I ran a dataset today morning using the latest version, unfortunately while trying to parcellate I m getting the same error.

Shall I share the dataset and the code I m using with you?

@mgxd
Copy link
Collaborator

mgxd commented Mar 18, 2020

@shilpitju is it possible you are reusing the same working directory? You may need to clear it.

@shilpitju
Copy link
Author

shilpitju commented Mar 18, 2020

No, I made a new one. I copied the newly generated cifti files to the workbench folder. That folder also contained the Cole-Atlas files used in the code.

@shilpitju
Copy link
Author

shilpitju commented Mar 20, 2020

Hi,

What are your suggestions to me now based on the reply in
CIFTI volume preferred orientation #39

Shall I use wb_command -cifti-resample or wait for an update in fmriprep?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants