Looks like it does what you wanted. Side note, if you have multiple non-overlapping ROIs to do this with, you could also make them into a dlabel file, then use -cifti-parcellate on the timeseries, and do a -cifti-cross-correlation using it and the smoothed dtseries. However, you'll need to figure out the correct order of files in the cross correlation to avoid needing -cifti-transpose to display it the way you want.
Tim On Thu, May 4, 2017 at 4:28 PM, Ely, Benjamin <benjamin....@mssm.edu> wrote: > Good to know, thanks - that's consistent with what I'm seeing. Will keep > the transformation for now. For future ref to anyone trying this, the > corrected sequence is: > > 1) Extract mean unsmoothed ROI data to text: > wb_command -cifti-roi-average ${sub}_${run}.dtseries.nii > roi_data_${sub}_${run}_unsmoothed.txt -vol-roi ${sub}_roi_mask.nii > 2) Convert extracted ROI data to cifti: > wb_command -cifti-create-scalar-series roi_data_${sub}_${run}_unsmoothed.txt > roi_data_${sub}_${run}_unsmoothed.dscalar.nii -transpose -series SECOND 0 1 > 3) Cross-correlate this new ROI timeseries cifti with the smoothed > whole-brain cifti data and (optionally) z transform: > wb_command -cifti-cross-correlation ${subject}_${run}_smoothed.dtseries.nii > roi_data_${sub}_${run}_unsmoothed.dscalar.nii > z_correlation_${sub}_${run}.dscalar.nii -fisher-z > 4) Repeat for all runs and average: > wb_command -cifti-average z_correlation_${sub}_average.dscalar.nii \ > > -cifti z_correlation_${sub}_run1.dscalar.nii \ > > -cifti z_correlation_${sub}_run2.dscalar.nii \ > > -cifti z_correlation_${sub}_run3.dscalar.nii \ > > -cifti z_correlation_${sub}_run4.dscalar.nii > > ------------------------------ > *From:* Benjamin Risk [bb...@cornell.edu] > *Sent:* Thursday, May 04, 2017 2:34 PM > *To:* Harms, Michael > *Cc:* Ely, Benjamin > *Subject:* Re: [HCP-Users] unsmoothed ROI to smoothed cifti correlation > > That's true, but the sample correlation coefficient is asymptotically > normal. I agree with Benjamin based on some correlations I looked at from > HCP data. They do tend to be pretty Gaussian because the number of time > points is large and the correlations I looked at were not close to 1 or > -1. > > Even when the correlations are close to Gaussian, the Fisher-transform is > variance stabilizing and results in a standard Gaussian, which is nice for > hypothesis testing. But there are cases where you might not want to > transform, e.g., interpretability. > > On Thu, May 4, 2017 at 1:49 PM, Harms, Michael <mha...@wustl.edu> wrote: > >> >> To be clear, depending on the r-value, the Fisher’s z-transform may not >> change the value much, but that doesn’t mean that the correlation >> (Pearson’s r) has a *distribution* that is close to Gaussian. >> >> cheers, >> -MH >> >> -- >> Michael Harms, Ph.D. >> ----------------------------------------------------------- >> Conte Center for the Neuroscience of Mental Disorders >> Washington University School of Medicine >> Department of Psychiatry, Box 8134 >> 660 South Euclid Ave. Tel: 314-747-6173 <(314)%20747-6173> >> St. Louis, MO 63110 Email: mha...@wustl.edu >> >> From: "Ely, Benjamin" <benjamin....@mssm.edu> >> Date: Thursday, May 4, 2017 at 12:43 PM >> To: Michael Harms <mha...@wustl.edu>, "Glasser, Matthew" < >> glass...@wustl.edu>, "HCP-Users@humanconnectome.org" < >> HCP-Users@humanconnectome.org> >> Subject: RE: [HCP-Users] unsmoothed ROI to smoothed cifti correlation >> >> Ah that makes sense, thanks! The effect of the z transformation is quite >> subtle (as expected since the correlation distributions are close to >> gaussian before transformation). >> ------------------------------ >> *From:* Harms, Michael [mha...@wustl.edu] >> *Sent:* Thursday, May 04, 2017 10:21 AM >> *To:* Ely, Benjamin; Glasser, Matthew; HCP-Users@humanconnectome.org >> *Subject:* Re: [HCP-Users] unsmoothed ROI to smoothed cifti correlation >> >> >> I would probably z transform before averaging across runs, so that you >> are averaging something with at least an approximately gaussian >> distribution. >> >> cheers, >> -MH >> >> -- >> Michael Harms, Ph.D. >> ----------------------------------------------------------- >> Conte Center for the Neuroscience of Mental Disorders >> Washington University School of Medicine >> Department of Psychiatry, Box 8134 >> 660 South Euclid Ave. Tel: 314-747-6173 <(314)%20747-6173> >> St. Louis, MO 63110 Email: mha...@wustl.edu >> >> From: <hcp-users-boun...@humanconnectome.org> on behalf of "Ely, >> Benjamin" <benjamin....@mssm.edu> >> Date: Wednesday, May 3, 2017 at 11:46 PM >> To: "Glasser, Matthew" <glass...@wustl.edu>, " >> HCP-Users@humanconnectome.org" <HCP-Users@humanconnectome.org> >> Subject: Re: [HCP-Users] unsmoothed ROI to smoothed cifti correlation >> >> Hi Matt, >> >> Thanks for getting back to me - after some further tinkering, I think >> this command sequence yields the desired output: >> >> 1) Extract mean unsmoothed ROI data to text: >> wb_command -cifti-roi-average ${subject}_${run}.dtseries.nii >> roi_data_${sub}_${run}_unsmoothed.txt -vol-roi ${sub}_roi_mask.nii # >> probably works for surface-based ROIs as well but I haven't tested >> 2) Convert extracted ROI data to cifti: >> wb_command -cifti-create-scalar-series roi_data_${sub}_${run}_unsmoothe >> d.txt roi_data_${sub}_${run}_unsmoothed.dscalar.nii -transpose -series >> SECOND 0 1 >> 3) Cross-correlate this new ROI timeseries cifti with the smoothed >> whole-brain cifti data: >> wb_command -cifti-cross-correlation ${subject}_${run}_smoothed.dtseries >> .nii roi_data_${sub}_${run}_unsmoothed.dscalar.nii >> correlation_${sub}_${run}.dscalar.nii >> 4) Repeat for all runs and average: >> wb_command -cifti-average correlation_${sub}_average.dscalar.nii >> -cifti correlation_${sub}_run1.dscalar.nii -cifti correlatio >> n_${sub}_run2.dscalar.nii -cifti correlation_${sub}_run3. >> dscalar.nii -cifti correlation_${sub}_run4.dscalar.nii >> 5) Fisher z transform results: >> wb_command -cifti-math "atanh(x)" z_correlation_${sub}_average.dscalar.nii >> -var x correlation_${sub}_average.dscalar.nii >> >> The resulting files appear as expected (similar to the >> smoothed-ROI-to-smoothed-cifti results but with more variation/less smooth >> appearance). Please let me know if you see any errors. >> >> Thanks again! >> -Ely >> >> ------------------------------ >> *From:* Glasser, Matthew [glass...@wustl.edu] >> *Sent:* Wednesday, May 03, 2017 11:32 PM >> *To:* Ely, Benjamin; HCP-Users@humanconnectome.org >> *Subject:* Re: [HCP-Users] unsmoothed ROI to smoothed cifti correlation >> >> Hi Ely, >> >> We don’t have a function like this yet, but have been discussing making >> one. I think matlab is your best bet at this time. >> >> Peace, >> >> Matt. >> >> From: <hcp-users-boun...@humanconnectome.org> on behalf of "Ely, >> Benjamin" <benjamin....@mssm.edu> >> Date: Wednesday, May 3, 2017 at 10:06 PM >> To: "HCP-Users@humanconnectome.org" <HCP-Users@humanconnectome.org> >> Subject: [HCP-Users] unsmoothed ROI to smoothed cifti correlation >> >> Hi everyone, >> >> I'm running some connectivity analyses following the procedure outlined >> in this thread https://www.mail-archive.com/hcp-users@humanconnectom >> e.org/msg04403.html >> <https://urldefense.proofpoint.com/v2/url?u=https-3A__www.mail-2Darchive.com_hcp-2Dusers-40humanconnectome.org_msg04403.html&d=DwMF-g&c=shNJtf5dKgNcPZ6Yh64b-A&r=wkbWuLo29rcKlS_jqY-IWyhtdbOPOJ4YiqipZSzm0r4&m=yPHnchyPW8zwQAjrQNcCAh2TbX5ft58rzU3tH0B6K54&s=XOJJuzw82VOhaCYWwXk5uBoLsl8E7AyfiW_3Uz35EJo&e=>. >> Since my ROIs are fairly small, I'd like to calculate the correlation >> between the mean unsmoothed timeseries of each ROI (i.e. "smoothed" only by >> averaging within the ROI) and the subject's smoothed cifti data. However, >> the wb_command -cifti-average-roi-correlation function only generates >> correlations from an ROI within the same cifti file, and none of the other >> functions seem appropriate (possibly -cifti-cross-correlation where one >> input is a cifti containing a single row with the mean unsmoothed >> timeseries, but I couldn't get this to work). Is there a straightforward >> way to generate these correlations using workbench, or will I need to e.g. >> write a matlab script? My ROIs are subcortical (voxel-based), if that >> matters. >> >> Thank you! >> -Ely >> >> _______________________________________________ >> HCP-Users mailing list >> HCP-Users@humanconnectome.org >> http://lists.humanconnectome.org/mailman/listinfo/hcp-users >> <https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.humanconnectome.org_mailman_listinfo_hcp-2Dusers&d=DwMF-g&c=shNJtf5dKgNcPZ6Yh64b-A&r=wkbWuLo29rcKlS_jqY-IWyhtdbOPOJ4YiqipZSzm0r4&m=yPHnchyPW8zwQAjrQNcCAh2TbX5ft58rzU3tH0B6K54&s=VlpGPeejrRi73VM-uLx85SXITabqd6-wTiQRi2j3Dc4&e=> >> >> >> ------------------------------ >> >> 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 >> <https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.humanconnectome.org_mailman_listinfo_hcp-2Dusers&d=DwMGaQ&c=shNJtf5dKgNcPZ6Yh64b-A&r=wkbWuLo29rcKlS_jqY-IWyhtdbOPOJ4YiqipZSzm0r4&m=cBE0XEzvB41LO5Io4dpYy7xbwsz6AdKXjBck9dwrghI&s=JVrgdZNZofeDbQk-uQLQJkw27JxvwJiiayaw1UXAEiY&e=> >> >> >> ------------------------------ >> >> 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 >> <https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.humanconnectome.org_mailman_listinfo_hcp-2Dusers&d=DwMFaQ&c=shNJtf5dKgNcPZ6Yh64b-A&r=wkbWuLo29rcKlS_jqY-IWyhtdbOPOJ4YiqipZSzm0r4&m=I4pQD7iQNrPyXNhc7YG1_uxKq5nswxyUfxerRe_LpAI&s=msYCsbYGwhK0E0AuUApbfarLi7mFV52X3nW5C3Iwqeg&e=> >> > > _______________________________________________ > 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