Perfect, thanks so much!

Best,
Rezvan
________________________________
From: Glasser, Matthew <[email protected]>
Sent: 01 June 2018 19:38:53
To: Seyedehrezvan Farahibozorg; [email protected]
Subject: Re: [HCP-Users] Mapping NIFTI to CIFTI

For that you should probably follow the same steps as the fMRISurface pipeline 
with the exception of using the precomputed goodvoxels mask rather than 
recomputing that.

This code also provides a synopsis:

     
roiVolume="${AtlasResultsFolder}/RibbonVolumeToSurfaceMapping/goodvoxels.nii.gz"
      Flag="-fix-zeros"
      VolROI="-volume-roi $roiVolume"

    if [ 1 -eq `echo "$BrainOrdinatesResolution == $FinalfMRIResolution" | bc 
-l` ] ; then
   #If using the same fMRI and grayordinates space resolution, use the simple 
algorithm to project bias field into subcortical CIFTI space like fMRI
   volumeIn="${AtlasResultsFolder}/${fMRIName}_${File}.nii.gz"
   currentParcel="${ROIFolder}/ROIs.${BrainOrdinatesResolution}.nii.gz"
   newParcel="${ROIFolder}/Atlas_ROIs.${BrainOrdinatesResolution}.nii.gz"
   kernel="${Sigma}"
   volumeOut="${AtlasResultsFolder}/${File}_AtlasSubcortical.nii.gz"
   $Caret7_Command -volume-parcel-resampling $volumeIn $currentParcel 
$newParcel $kernel $volumeOut ${Flag}
    else
   #If using different fMRI and grayordinates space resolutions, use the 
generic algorithm to project bias field into subcortical CIFTI space like fMRI
   volumeIn="${AtlasResultsFolder}/${fMRIName}_${File}.nii.gz"
   currentParcel="${AtlasResultsFolder}/ROIs.${FinalfMRIResolution}.nii.gz"
   newParcel="${ROIFolder}/Atlas_ROIs.${BrainOrdinatesResolution}.nii.gz"
   kernel="${Sigma}"
   volumeOut="${AtlasResultsFolder}/${File}_AtlasSubcortical.nii.gz"
   $Caret7_Command -volume-parcel-resampling-generic $volumeIn $currentParcel 
$newParcel $kernel $volumeOut ${Flag}
    fi

    for Hemisphere in L R ; do
   #Map bias field volume to surface using the same approach as when fMRI data 
are projected to the surface
   volume="${AtlasResultsFolder}/${fMRIName}_${File}.nii.gz"
   
surface="${NativeFolder}/${Subject}.${Hemisphere}.midthickness.native.surf.gii"
   metricOut="${AtlasResultsFolder}/${File}.${Hemisphere}.native.func.gii"
   ribbonInner="${NativeFolder}/${Subject}.${Hemisphere}.white.native.surf.gii"
   ribbonOutter="${NativeFolder}/${Subject}.${Hemisphere}.pial.native.surf.gii"
   $Caret7_Command -volume-to-surface-mapping $volume $surface $metricOut 
-ribbon-constrained $ribbonInner $ribbonOutter ${VolROI}

      if [ ! ${File} = "dropouts" ] ; then
         #Fill in any small holes with dilation again as is done with fMRI
      metric="${AtlasResultsFolder}/${File}.${Hemisphere}.native.func.gii"
      
surface="${NativeFolder}/${Subject}.${Hemisphere}.midthickness.native.surf.gii"
      distance="20"
      metricOut="${AtlasResultsFolder}/${File}.${Hemisphere}.native.func.gii"
      $Caret7_Command -metric-dilate $metric $surface $distance $metricOut 
-nearest
      fi

      #Mask out the medial wall of dilated file
   metric="${AtlasResultsFolder}/${File}.${Hemisphere}.native.func.gii"
   mask="${NativeFolder}/${Subject}.${Hemisphere}.roi.native.shape.gii"
   metricOut="${AtlasResultsFolder}/${File}.${Hemisphere}.native.func.gii"
   $Caret7_Command -metric-mask $metric $mask $metricOut
   for RegName in ${RegNames} ; do
     if [ ! ${RegName} = "NONE" ] ; then
          RegString="_${RegName}"
        else
          RegString=""
          RegName="MSMSulc"
        fi
     #Resample the surface data from the native mesh to the standard mesh
     metricIn="${AtlasResultsFolder}/${File}.${Hemisphere}.native.func.gii"
     
currentSphere="${NativeFolder}/${Subject}.${Hemisphere}.sphere.${RegName}.native.surf.gii"
     
newSphere="${DownsampleFolder}/${Subject}.${Hemisphere}.sphere.${LowResMesh}k_fs_LR.surf.gii"
     method="ADAP_BARY_AREA"
     
metricOut="${AtlasResultsFolder}/${File}${RegString}.${Hemisphere}.${LowResMesh}k_fs_LR.func.gii"
     
currentArea="${NativeFolder}/${Subject}.${Hemisphere}.midthickness.native.surf.gii"
     
newArea="${DownsampleFolder}/${Subject}.${Hemisphere}.midthickness.${LowResMesh}k_fs_LR.surf.gii"
     roiMetric="${NativeFolder}/${Subject}.${Hemisphere}.roi.native.shape.gii"
     $Caret7_Command -metric-resample $metricIn $currentSphere $newSphere 
$method $metricOut -area-surfs $currentArea $newArea -current-roi $roiMetric
     #Make sure the medial wall is zeros
     
metric="${AtlasResultsFolder}/${File}${RegString}.${Hemisphere}.${LowResMesh}k_fs_LR.func.gii"
     
mask="${DownsampleFolder}/${Subject}.${Hemisphere}.atlasroi.${LowResMesh}k_fs_LR.shape.gii"
     
metricOut="${AtlasResultsFolder}/${File}${RegString}.${Hemisphere}.${LowResMesh}k_fs_LR.func.gii"
     $Caret7_Command -metric-mask $metric $mask $metricOut
     #Smooth the surface bias field the same as the fMRI
     
surface="${DownsampleFolder}/${Subject}.${Hemisphere}.midthickness.${LowResMesh}k_fs_LR.surf.gii"
     
metricIn="${AtlasResultsFolder}/${File}${RegString}.${Hemisphere}.${LowResMesh}k_fs_LR.func.gii"
     smoothingKernel="${Sigma}"
     
metricOut="${AtlasResultsFolder}/${File}${RegString}.${Hemisphere}.${LowResMesh}k_fs_LR.func.gii"
     
roiMetric="${DownsampleFolder}/${Subject}.${Hemisphere}.atlasroi.${LowResMesh}k_fs_LR.shape.gii"
     $Caret7_Command -metric-smoothing $surface $metricIn $smoothingKernel 
$metricOut -roi $roiMetric
      done
    done

 for RegName in ${RegNames} ; do
   if [ ! ${RegName} = "NONE" ] ; then
        RegString="_${RegName}"
      else
        RegString=""
        RegName="MSMSulc"
      fi
      #Create CIFTI file of bias field as was done with fMRI
      
ciftiOut="${AtlasResultsFolder}/${fMRIName}_Atlas${RegString}_${File}.dscalar.nii"
      volumeData="${AtlasResultsFolder}/${File}_AtlasSubcortical.nii.gz"
      labelVolume="${ROIFolder}/Atlas_ROIs.${BrainOrdinatesResolution}.nii.gz"
      
lMetric="${AtlasResultsFolder}/${File}${RegString}.L.${LowResMesh}k_fs_LR.func.gii"
      
lRoiMetric="${DownsampleFolder}/${Subject}.L.atlasroi.${LowResMesh}k_fs_LR.shape.gii"
      
rMetric="${AtlasResultsFolder}/${File}${RegString}.R.${LowResMesh}k_fs_LR.func.gii"
      
rRoiMetric="${DownsampleFolder}/${Subject}.R.atlasroi.${LowResMesh}k_fs_LR.shape.gii"
      $Caret7_Command -cifti-create-dense-scalar $ciftiOut -volume $volumeData 
$labelVolume -left-metric $lMetric -roi-left $lRoiMetric -right-metric $rMetric 
-roi-right $rRoiMetric

      rm ${lMetric} ${rMetric}
    done
    rm ${volumeData}

Matt.

From: Seyedehrezvan Farahibozorg 
<[email protected]<mailto:[email protected]>>
Date: Friday, June 1, 2018 at 1:29 PM
To: Matt Glasser <[email protected]<mailto:[email protected]>>, 
"[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: Re: [HCP-Users] Mapping NIFTI to CIFTI

Hi Matt,
Thanks very much.
I'm trying to evaluate an RS connectivity method by checking spatial 
similarities/differences of when it's applied to volumetric vs. cifti data. I 
won't be comparing the original timeseries...

Many thanks
Rezvan
________________________________
From: Glasser, Matthew <[email protected]<mailto:[email protected]>>
Sent: 01 June 2018 19:09:03
To: Seyedehrezvan Farahibozorg; 
[email protected]<mailto:[email protected]>
Subject: Re: [HCP-Users] Mapping NIFTI to CIFTI

That process does not replicate how the timeseries data were gotten on the 
surface to begin with.  What is it that you are trying to accomplish with this?

Peace,

Matt.

From: 
<[email protected]<mailto:[email protected]>>
 on behalf of Seyedehrezvan Farahibozorg 
<[email protected]<mailto:[email protected]>>
Date: Friday, June 1, 2018 at 1:05 PM
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: [HCP-Users] Mapping NIFTI to CIFTI


Hi all,

I have results of a subject-specific connectivity analysis on a) volumetric 
(.nii.gz) and b) CIFTI grayordinates (.dtseries.nii) data for a subset of 3T 
rfMRI HCP1200 subjects. In order to check the spatial correspondence, I am 
trying to map the former onto the space of the latter.



To do so, I used the following steps using wb command line:



1- Mapped the volumetric data to subject-specific surface using 
-volume-to-surface-mapping:

wb_command -volume-to-surface-mapping $input_nii $subject_gifti_left 
$output_gifti_left -trilinear

                wb_command -volume-to-surface-mapping $input_nii 
$subject_gifti_right $output_gifti_right -trilinear

2- Combined these mapped cortical responses and subcortical grey matter voxel 
responses in one CIFTI file using -cifti-create-dense-from-template:

                wb_command -cifti-create-dense-from-template  $template_cifti  
$output_cifti -series 1 0 -volume-all $input_nii -metric CORTEX_LEFT $ 
output_gifti_left -metric CORTEX_RIGHT $output_gifti_right



where $template_cifti is a group average of the aforementioned analysis on 
CIFTI data.



I was wondering if this way of mapping is correct? I would very much appreciate 
your feedback...



So many thanks,

Rezvan

_______________________________________________
HCP-Users mailing list
[email protected]<mailto:[email protected]>
http://lists.humanconnectome.org/mailman/listinfo/hcp-users

_______________________________________________
HCP-Users mailing list
[email protected]
http://lists.humanconnectome.org/mailman/listinfo/hcp-users

Reply via email to