Thank you so much! I understand it better now.

best regards
Jaime


El mié., 29 may. 2019 a las 21:43, Timothy Coalson (<tsc...@mst.edu>)
escribió:

> Yes, it is a similar problem to working in "image space", basically the
> FSL tools work in a space resulting from taking the voxel indices and
> multiplying them by the voxel dimensions, so a particular corner voxel
> always has coordinates of (0, 0, 0)mm.  Because of the transition from
> origin-less ANALYZE volume format to a completely defined coordinate space
> in NIfTI, different software has ended up with different quirks as to
> whether it properly handles NIfTI coordinates.  I think ANTs does use the
> full NIfTI coordinate specification, though internally they flip it to the
> ITK convention (which only matters if you need to interpret ANTs transforms
> yourself, as the identity transform still does the right thing).
> Unfortunately, FSL continued to use the ANALYZE coordinate specification
> when doing registration and resampling of NIfTI volumes.
>
> We started connectome workbench much more recently than FSL started, and
> although workbench inherited some code from caret5 (which also used the
> full NIfTI coordinate specification, but also supported ANALYZE and other
> formats, leading to some issues), its volume code was rewritten from
> scratch, and only supports NIfTI volumes, so we were able to avoid legacy
> issues and use the full NIfTI coordinates from day 1.  FSL didn't have this
> luxury, as they started before NIfTI even existed.
>
> As to your situation, when using FSL tools to resample to a different
> voxel grid, you have to either carefully generate your volume spaces in
> advance to have their corners aligned in NIfTI space the same way that FSL
> assumes they align in its ANALYZE-like space, or you have to deal with FSL
> adding translations to your voxel coordinates every time you resample
> between these voxel spaces (by using affine files containing the opposite
> translations).
>
> The different MNI template resolutions we use in the pipelines have these
> special corner voxels aligned already in their NIfTI coordinates, so for
> the pipelines we can tolerate the quirks of FSL resampling tools (and their
> more advanced tools don't seem to have equivalents in other software
> packages, and we work with them on improvements), but I can't recommend FSL
> resampling tools to the unwary as the first choice for a new task in an
> unknown volume space.
>
> Tim
>
>
> On Wed, May 29, 2019 at 1:16 PM Jaime Caballero <jcabai...@gmail.com>
> wrote:
>
>> Thank you, Timothy
>>
>> I did the resampling with ANTs' WarpImageMultiTransform, as I thought the
>> software used for this didn't matter. I have now done the same with
>> wb_command as you suggested and the resulting ROIs are exactly the same.
>>
>> I could not make FSL's applywarp work, so I cannot tell by now what would
>> come out from that. Anyway I'm not sure I understand why would it fail. Is
>> it something related to rounding coordinates or working directly in image
>> space?
>>
>> Regards,
>> Jaime
>>
>> El mar., 28 may. 2019 a las 20:46, Timothy Coalson (<tsc...@mst.edu>)
>> escribió:
>>
>>> If you need to preserve the mm coordinates of the ROI, I would not trust
>>> FSL's resampling with an identity transform to get it right, because that
>>> will produce a different shift depending on what coordinates a particular
>>> corner voxel is at in each image (as I understand it, FSL's conventions
>>> come from originally handling ANALYZE format images).  Instead, wb_command
>>> -volume-affine-resample, given an identity matrix (and NOT specifying
>>> -flirt) will do the resampling via nifti mm coordinates, with no guesswork.
>>>
>>> Tim
>>>
>>>
>>> On Tue, May 28, 2019 at 8:08 AM Jaime Caballero <jcabai...@gmail.com>
>>> wrote:
>>>
>>>> Thank you so much!
>>>>
>>>> It worked fine, and the resulting ROIs are were they are suposed to be.
>>>>
>>>> Regards,
>>>> Jaime
>>>>
>>>> El lun., 27 may. 2019 22:20, Glasser, Matthew <glass...@wustl.edu>
>>>> escribió:
>>>>
>>>>> That file does exist in the structural package then.
>>>>>
>>>>>
>>>>>
>>>>> Matt.
>>>>>
>>>>>
>>>>>
>>>>> *From: *Jaime Caballero <jcabai...@gmail.com>
>>>>> *Date: *Monday, May 27, 2019 at 3:20 PM
>>>>> *To: *"Glasser, Matthew" <glass...@wustl.edu>
>>>>> *Cc: *"hcp-users@humanconnectome.org" <hcp-users@humanconnectome.org>
>>>>> *Subject: *Re: [HCP-Users] Convert nifti-ROIs to cifti format
>>>>> (subcortical)
>>>>>
>>>>>
>>>>>
>>>>> Sorry for the confusion.
>>>>>
>>>>>
>>>>>
>>>>> Locally acquired data wasn't processed using the HCP pipelines, it is
>>>>> in a different resolution and it was processed in volume space, no problem
>>>>> there.
>>>>>
>>>>>
>>>>>
>>>>> I want to use Choi's parcellation with HCP data. All the process I
>>>>> described is mi workaround to adapt Choi files to HCP files.
>>>>>
>>>>>
>>>>>
>>>>> Jaime
>>>>>
>>>>>
>>>>>
>>>>> El lun., 27 may. 2019 22:12, Glasser, Matthew <glass...@wustl.edu>
>>>>> escribió:
>>>>>
>>>>> I thought you said you were using a locally collected sample you ran
>>>>> the HCP Pipelines on?
>>>>>
>>>>> Matt.
>>>>>
>>>>>
>>>>>
>>>>> *From: *Jaime Caballero <jcabai...@gmail.com>
>>>>> *Date: *Monday, May 27, 2019 at 3:10 PM
>>>>> *To: *"Glasser, Matthew" <glass...@wustl.edu>
>>>>> *Subject: *Re: [HCP-Users] Convert nifti-ROIs to cifti format
>>>>> (subcortical)
>>>>>
>>>>>
>>>>>
>>>>> Ok, thank you! I will try that.
>>>>>
>>>>>
>>>>>
>>>>> I asume the reference image
>>>>> ${StudyFolder}/${Subject}/MNINonLinear/ROIs/Atlas_ROIs.2.nii.gz is to be
>>>>> downloaded with the structural package?
>>>>>
>>>>>
>>>>>
>>>>> Regards,
>>>>>
>>>>> Jaime
>>>>>
>>>>>
>>>>>
>>>>> El lun., 27 may. 2019 a las 21:00, Glasser, Matthew (<
>>>>> glass...@wustl.edu>) escribió:
>>>>>
>>>>> To make the .dscalar.nii file, you seem to be on the right track.  If
>>>>> the Choi ROIs are properly in MNI space, hopefully you could simply use
>>>>> applywarp --interp=nn -i <ROIs.nii.gz> -r
>>>>> ${StudyFolder}/${Subject}/MNINonLinear/ROIs/Atlas_ROIs.2.nii.gz -o
>>>>> <ROIs.2.nii> and then the wb_command -cifti-create-dense-from-template you
>>>>> mention.
>>>>>
>>>>>
>>>>>
>>>>> Matt.
>>>>>
>>>>>
>>>>>
>>>>> *From: *Jaime Caballero <jcabai...@gmail.com>
>>>>> *Date: *Monday, May 27, 2019 at 12:56 PM
>>>>> *To: *"Glasser, Matthew" <glass...@wustl.edu>
>>>>> *Cc: *"hcp-users@humanconnectome.org" <hcp-users@humanconnectome.org>
>>>>> *Subject: *Re: [HCP-Users] Convert nifti-ROIs to cifti format
>>>>> (subcortical)
>>>>>
>>>>>
>>>>>
>>>>> The objective is to extract functional connectivity between cortical
>>>>> and striatal ROIs, and ALFF and ReHo from both cortical and striatal ROIs.
>>>>>
>>>>>
>>>>>
>>>>> Up to this point I have imported each subject's dtseries.nii file into
>>>>> MATLAB, and also the previously defined ROIs in an HCP-compatible format.
>>>>> For the dtseries I have a 96854x1200 matrix, and for the ROI a 96854x1
>>>>> matrix containing a mask, which I use to extract the time series I'm
>>>>> interested in for further processing.
>>>>>
>>>>>
>>>>>
>>>>> Jaime
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> El lun., 27 may. 2019 a las 19:14, Glasser, Matthew (<
>>>>> glass...@wustl.edu>) escribió:
>>>>>
>>>>> What do you plan to do with the file?
>>>>>
>>>>>
>>>>>
>>>>> Matt.
>>>>>
>>>>>
>>>>>
>>>>> *From: *Jaime Caballero <jcabai...@gmail.com>
>>>>> *Date: *Monday, May 27, 2019 at 12:08 PM
>>>>> *To: *"Glasser, Matthew" <glass...@wustl.edu>
>>>>> *Cc: *"hcp-users@humanconnectome.org" <hcp-users@humanconnectome.org>
>>>>> *Subject: *Re: [HCP-Users] Convert nifti-ROIs to cifti format
>>>>> (subcortical)
>>>>>
>>>>>
>>>>>
>>>>> A .dscalar.nii output, I think. Basically I want an equivalent of the
>>>>> nifti ROI, but in cifti: for each voxel/vertex, value 1 if inside the ROI,
>>>>> 0 if outside. Would a dlabel file be better for this application?
>>>>>
>>>>>
>>>>>
>>>>> El lun., 27 may. 2019 a las 19:03, Glasser, Matthew (<
>>>>> glass...@wustl.edu>) escribió:
>>>>>
>>>>> Are you wanting a .dlabel.nii output or a .dscalar.nii output?
>>>>>
>>>>>
>>>>>
>>>>> Matt.
>>>>>
>>>>>
>>>>>
>>>>> *From: *<hcp-users-boun...@humanconnectome.org> on behalf of Jaime
>>>>> Caballero <jcabai...@gmail.com>
>>>>> *Date: *Monday, May 27, 2019 at 10:37 AM
>>>>> *To: *"hcp-users@humanconnectome.org" <hcp-users@humanconnectome.org>
>>>>> *Subject: *[HCP-Users] Convert nifti-ROIs to cifti format
>>>>> (subcortical)
>>>>>
>>>>>
>>>>>
>>>>> Dear experts
>>>>>
>>>>>
>>>>>
>>>>> In my center we are studying cortico-striatal functional connectivity,
>>>>> and cortical/striatal local measures (ALFF, ReHo) on a locally acquired
>>>>> sample. For that we are using Choi's functional parcellation, distributed
>>>>> as a volumetric NIFTI file, in MNI152 space. We want to validate our
>>>>> measures with a subset of the S1200 release (resting state, 3T).
>>>>> Specifically I have used the ICA-FIX cleaned and MSM-all registered files,
>>>>> i.e.:
>>>>>
>>>>>
>>>>> <subject_dir>/MNINonLinear/Results/rfMRI_REST1_LR/rfMRI_REST1_LR_Atlas_MSMAll_hp2000_clean.dtseries.nii
>>>>>
>>>>>
>>>>>
>>>>> The thing is I have doubts on the way to convert nifti ROIs to cifti
>>>>> format in this case.
>>>>>
>>>>>
>>>>>
>>>>> My first approach:
>>>>>
>>>>>
>>>>>
>>>>> 1. Load a cifti template file and the NIFTI ROI file in MATLAB. The
>>>>> roi file is a volume containing 0s and 1s.
>>>>>
>>>>> 2. Use the inverse of the NIFTI's transformation matrix to convert the
>>>>> XYZ coordinates in MNI space from each grayordinate to XYZ coordinates in
>>>>> the NIFTI'S volume space. (The matrix is corrected to account for MATLAB's
>>>>> 1-based matrix indexing)
>>>>>
>>>>> 3. The values of the NIFTI volume for the obtained coordinates define
>>>>> the ROI in the output cifti.
>>>>>
>>>>> 4. Keep only the grayordinates that are set to one by my method and
>>>>> that are labeled as striatum (i.e. caudate, putamen or accumbens) in the
>>>>> cifti files.
>>>>>
>>>>>
>>>>>
>>>>> This aproach is rather hand-made, and I wonder if I am missing
>>>>> something important. Conceptually it looks correct to me, but the ROIs
>>>>> appear slightly displaced to the right, which might affect the results.
>>>>>
>>>>> To load the CIFTIs I use fieltdrip's ft_cifti_read( ), which for this
>>>>> purpose works well (it reads the grayordinate positions and labels), and 
>>>>> to
>>>>> load the NIFTIs I use Freesurfer's load_nifti( ).
>>>>>
>>>>> Is this method correct, or is there something important I'm not taking
>>>>> into account?
>>>>>
>>>>>
>>>>>
>>>>> Now I'm trying to do the same with wb_command to compare, but I cannot
>>>>> get it working. The procedure I use is:
>>>>>
>>>>>
>>>>>
>>>>> # Resample the ROI file to 2x2x2 resolution with ANTs:
>>>>>
>>>>> ResampleImage 3 "$NiftiFileIn" "$NiftiFileResampled" 2x2x2 0
>>>>>
>>>>> # Convert the obtained nifti to cifti:
>>>>>
>>>>> wb_command -cifti-create-dense-from-template
>>>>> "$CiftiDscalarTemplateFile" "$CiftiOut" -volume-all "$NiftiFileResampled"
>>>>>
>>>>>
>>>>>
>>>>> Which outputs the error: -volume-all specifies a volume file that
>>>>> doesn't match the volume space of the template cifti file
>>>>>
>>>>> Is there anything wrong with my way of doing this procedure?
>>>>>
>>>>>
>>>>>
>>>>> Thanks in advance,
>>>>>
>>>>>
>>>>>
>>>>> Best regards,
>>>>>
>>>>> Jaime Caballero-Insaurriaga
>>>>>
>>>>> _______________________________________________
>>>>> HCP-Users mailing list
>>>>> HCP-Users@humanconnectome.org
>>>>> http://lists.humanconnectome.org/mailman/listinfo/hcp-users
>>>>>
>>>>>
>>>>> ------------------------------
>>>>>
>>>>> 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.
>>>>>
>>>>>
>>>>> ------------------------------
>>>>>
>>>>> 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.
>>>>>
>>>>>
>>>>> ------------------------------
>>>>>
>>>>> 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.
>>>>>
>>>>>
>>>>> ------------------------------
>>>>>
>>>>> 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.
>>>>>
>>>>>
>>>>> ------------------------------
>>>>>
>>>>> 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.
>>>>>
>>>> _______________________________________________
>>>> HCP-Users mailing list
>>>> HCP-Users@humanconnectome.org
>>>> http://lists.humanconnectome.org/mailman/listinfo/hcp-users
>>>>
>>>

_______________________________________________
HCP-Users mailing list
HCP-Users@humanconnectome.org
http://lists.humanconnectome.org/mailman/listinfo/hcp-users

Reply via email to