Converting ROI nifti file into dscalar

429 views
Skip to first unread message

kenza kadri

unread,
Nov 12, 2021, 8:29:29 AM11/12/21
to HCP-Users
Dear HCP users

I am quite new with HCP data and wb_command and I was wondering how can I convert niftii file into gifti. 

I want to make a resting-state connectivity matrix from some ROI. We selected the cortical ROI from Glasser Parcellation, and subcortical ROI from multiples atlas (based on HCP data). 
Some of the files are binarised volume file {ROI_name}.nii.gz (made with fslmaths) and I need to have dscalar.nii to extract the times series from the ROI in Matlab. 
If I understand well, wb_command --cifti-convert -from-nifti can't be used because it only converts the format, without taking into account any coordinates (that results in a matrix on 0 in my case)

Is there a way to convert my ROI masks obtained from fslmaths into dscalar.nii?

Many thanks

Glasser, Matt

unread,
Nov 12, 2021, 11:42:44 AM11/12/21
to hcp-...@humanconnectome.org

The goal is to have a CIFTI .dlabel.nii file that you can use with wb_command -cifti-parcellate (and then -cifti-correlate).  We have an existing version of the HCP’s multi-modal parcellation that has the standard FreeSurfer subcortical structures (https://balsa.wustl.edu/file/87B9N); however, you could replace these (using -cifti-replace-structure -volume-all) with a separate volume label file (created using wb_command -volume-label-import).  A label volume contains integer “key” values for each parcel and one creates an associated text file that links the key to a name and color for each parcel.

 

Matt.

--
You received this message because you are subscribed to the Google Groups "HCP-Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hcp-users+...@humanconnectome.org.
To view this discussion on the web visit https://groups.google.com/a/humanconnectome.org/d/msgid/hcp-users/49ffabb8-aa65-46be-b9cc-6942c59db409n%40humanconnectome.org.

 


The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.

kenza kadri

unread,
Nov 15, 2021, 12:16:45 PM11/15/21
to HCP-Users, glas...@wustl.edu
Many thanks for your explanations, however, I still have some questions.

I have multiple ROI volume files from differents atlases (binarized with FSL), so if I want to create my own volume label file (to use in wb_command cifti-replace-structure -volume-all) using wb_command -volume-label-import, I need for each mask (so for each ROI) : 
- the volume file (the binarized mask) for example roi1_bin_mask.nii.gz
- a text file with the name of the ROI ( <label-list-file> - text file containing the values and names for labels). 
-- This text file seems to be in a specific format: ROIname followed the line after by a key, colour combination and opacity.
For example :
ROI_name
1 98 202 207 255
When I tried the command wb_command volume-label-import with these type of files (volume + txt file), I can create a dlabel.nii file (no errors) but that is empty. I guess that it's because the 'key' is only specified in the txt file and not in the volume.
So, how the key that I put in my text file (Here 1)  is supposed to be associated with the volume file? Is the volume file need to be create with a specific command ?

Many thanks,

Kenza

Glasser, Matt

unread,
Nov 15, 2021, 1:07:02 PM11/15/21
to hcp-...@humanconnectome.org

You can merge the files with wb_command -volume-merge, then reduce with wb_command -volume-reduce with INDEXMAX.  The keys will then be the number of the order of the merge (for the first volume the key will be 1, for the second volume 2, etc.). 

Coalson, Timothy Scott (S&T-Student)

unread,
Nov 15, 2021, 5:06:29 PM11/15/21
to HCP-Users, glas...@wustl.edu
To make sure, the -cifti-replace-structure -volume-all command will only work for subcortical (and cerebellum) data.  Are you trying to use volume files for cortical ROIs?

Tim


From: kenza kadri <kenzak...@gmail.com>
Sent: Monday, November 15, 2021 11:16 AM
To: HCP-Users <hcp-...@humanconnectome.org>
Cc: glas...@wustl.edu <glas...@wustl.edu>
Subject: Re: [hcp-users] Converting ROI nifti file into dscalar
 
WARNING: This message has originated from an External Source. This may be a phishing expedition that can result in unauthorized access to our IT System. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.

kenza kadri

unread,
Nov 17, 2021, 12:08:54 PM11/17/21
to HCP-Users, tsc...@mst.edu, glas...@wustl.edu
Hello,

Sorry, I thought I replied to you.
Thank you for your help.
And yes it was subcortical ROI only, as I already had my cortical ROI!

Best regards,

Kenza

Catherine Mikkelsen

unread,
Feb 22, 2024, 7:55:09 PM2/22/24
to HCP-Users, kenzak...@gmail.com, tsc...@mst.edu, glas...@wustl.edu
Hi all,
I'm trying to do something similar and so have been following these instructions to create a mask that has left accumbens and right accumbens (with seperate keys to later create the label files). I have been using the following commands to try to merge the two using -volume-merge based on the examples in the documentation:
PS C:\workbench\bin_windows64> .\wb_command -volume-merge AccMerget40.nii.gz -volume RightAccumbenst40.nii -volume LeftAccumbenst40.nii
PS C:\workbench\bin_windows64> .\wb_command -volume-merge AccMerget40flip.nii.gz -volume LeftAccumbenst40.nii -volume RightAccumbenst40.nii

However, when I visualize the outputs in wb_view, only the first region specified is in the output file. I get the same result no matter which way I flip it, so I don't think it is an issue with the .nii files? I have tried the output as a .nii and as a .nii.gz in case it made a difference and the result is the same. In the long term, I am hoping to merge them with my dorsal striatum ROIs (created in FSL maths), but I thought getting 2 working may be an easier place to start. Do you have any insights into what might be happening here? 
Thank you for your patience!
Catherine

Tim Coalson

unread,
Feb 22, 2024, 9:02:13 PM2/22/24
to hcp-...@humanconnectome.org, kenzak...@gmail.com, tsc...@mst.edu, glas...@wustl.edu
-volume-merge concatenates files in the frame dimension (the same way a volume timeseries works).  Your other ROI should be in the second map.

One way to turn a lot of separate ROI files into a label file is to concatenate them, then use a -*-reduce command with INDEXMAX to get separate integers for each roi.  You then have to mask out anything that none of the ROIs used (another -*-reduce of the concatenated file with MAX is useful here).

Tim


Victoria King

unread,
Jul 26, 2024, 3:55:18 PM7/26/24
to HCP-Users, Coalson, Timothy Scott (S&T-Student), glas...@wustl.edu
Hi all,

I came across this thread with a similar question; however, I am interested in using cortical ROIs that I have generated from fslmaths. How are the above instructions different for cortical ROIs?

Tim Coalson

unread,
Jul 26, 2024, 7:07:16 PM7/26/24
to hcp-...@humanconnectome.org, glas...@wustl.edu
If this ROI is a single-subject ROI, you can map it to that subject's surfaces, we use wb_command -volume-to-surface-mapping with the -ribbon-constrained option (you can ignore most of its suboptions in most circumstances), followed by a tiny dilation in case the geometry works out badly for a vertex and doesn't give it a value.

If it is a group-average human cortical ROI, generating it in the volume usually isn't a good idea, see https://www.pnas.org/doi/10.1073/pnas.1801582115 .  Effectively, unless it is in central sulcus or insula, the volume registration hasn't lined up the cortical sheet across subjects to begin with, and surface-based registration can give you substantially more useful results.

Tim


Reply all
Reply to author
Forward
0 new messages