<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div class="">Hi,</div>
<div class=""><br class="">
</div>
That makes sense. As described on <a href="https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/DualRegression" class="">https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/DualRegression</a> dual regression is just doing a linear regression twice, once to get subject-specific time courses,
and a second time to get subject-specific spatial maps.
<div class=""><br class="">
</div>
<div class="">I can't answer your question on which data format to use, because that depends on which tool you are going to use to do the regressions. If that tool supports CIFTI data, you can produce a CIFTI file with the correct shape as described in my previous
email. But, if it only supports NIFTI data you will have to create the 4D NIFTI file. If you are happy to run your regression within python, you will be able to pass on your newdata array directly without writing to disk. There are a lot of excellent tools
to do linear regression, so it is really up to you to decide which one you find easiest to use.</div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class=""><br class="">
</div>
<div class="">Michiel<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 25 Oct 2020, at 21:08, Uri Elias <<a href="mailto:uri.urie@gmail.com" class="">uri.urie@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">Thanks!
<div class=""><br class="">
</div>
<div class="">I may indeed try that, but before - and because you were doubtful about this sort of pipeline - I'll try to go over again -</div>
<div class=""><br class="">
</div>
<div class="">I want to get an "individualized atlas" by taking one and using it as a reference to dual regression (on a rest state time series), all this over Cifti. Does that make sense? If so, what's the best way of doing so?</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
</div>
<br class="">
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sun, Oct 25, 2020 at 2:08 PM Michiel Cottaar <<a href="mailto:michiel.cottaar@ndcn.ox.ac.uk" class="">michiel.cottaar@ndcn.ox.ac.uk</a>> wrote:<br class="">
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div style="overflow-wrap: break-word;" class="">Hi Uri,
<div class=""><br class="">
</div>
<div class="">You will have to tell Cifti what is along this new axis you created. One way to do this is to use the cifti2 axes (<a href="https://nipy.org/nibabel/reference/nibabel.cifti2.html#module-nibabel.cifti2.cifti2_axes" target="_blank" class="">https://nipy.org/nibabel/reference/nibabel.cifti2.html#module-nibabel.cifti2.cifti2_axes</a>).
After creating newdata this would look like:</div>
<div class="">>>> from nibabel import cifti2</div>
<div class="">>>> new_axis = cifti2.ScalarAxis([f"parcel {idx + 1}" for idx in range(N)]) # these are the names for all the parcels; you might want to replace them with something more meaningfull</div>
<div class="">>>> grayordinate_axis = dsobj.header.get_axis(1) # get a description of the greyordinate space from the loaded CIFTI file</div>
<div class="">>>> newobj = nb.Cifti2Image(newdata, (new_axis, grayordinate_axis)) # creates a new Cifti2 header based on these axes</div>
<div class="">This newobj will have the shape of (N, 64984) for N parcels.</div>
<div class=""><br class="">
</div>
<div class="">However, based on your description I'm not completely sure if this is what you want to be doing. The output will still be a 2D CIFTI file rather than a 4D NIFTI file. If you want the latter, just reshape the newdata to be 4D using something like
`newdata.T.reshape(64984, 1, 1, N)` and create a new nb.Nifti1Image object from that data.</div>
<div class=""><br class="">
</div>
<div class="">Good luck,</div>
<div class=""><br class="">
</div>
<div class="">Michiel</div>
<div class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">On 24 Oct 2020, at 19:05, Uri Elias <<a href="mailto:uri.urie@gmail.com" target="_blank" class="">uri.urie@gmail.com</a>> wrote:</div>
<br class="">
<div class="">
<div dir="ltr" class=""><br class="">
<br class="">
Hi All,<br class="">
<br class="">
Top level - I'd like to apply dual regression on rest fMRI based on parcellation where my rs-fMRI data in in CIFTI format.<br class="">
<br class="">
For a dual-regression SW I've chosen FSL, also because it works on Cifti (according to manual).<br class="">
For parcellation I've chosen the Schaefer parcellation, as it is Cifti-available and also partially based on rest-fMRI.<br class="">
<br class="">
Now, the Cifti parcellation file is a dscalar file (that is - a single volume/surface), with each greyordinate belongs to one of N parcels. FSL (AFAIU) requires a 4D file as a reference<br class="">
Working with nibabel, reformatting the matrix is easy - reading it with nibabel and do something like: for k in range(N):
<div class=""> newdata[k,:] = (orgdata==k+1).astype(float) <br class="">
<br class="">
Updating the Nifti header is also easy - <br class="">
newobj = nb.Cifti2Image(newdata, dscobj.header, dscobj.nifti_header)<br class="">
newobj.update_headers()<br class="">
<br class="">
The problem with this way is the the Cifti header is not being updated - </div>
<div class=""> newobj.header.matrix.get_data_shape()<br class="">
yeilds </div>
<div class=""> (1, 64984)<br class="">
<br class="">
What's a good way of doing this? - either by sticking to the nibabel->FSL line right or by any alternative<br class="">
<br class="">
Thanks all so much,<br class="">
Uri<br clear="all" class="">
<div class=""><br class="">
</div>
-- <br class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<table cellpadding="0" cellspacing="0" style="color:rgb(255,255,255);vertical-align:-webkit-baseline-middle;font-family:"Trebuchet MS"" class="">
<tbody class="">
<tr class="">
<td style="vertical-align:top" class="">
<h3 style="margin:0px" class=""><span style="font-size:16px" class="">Uri Elias</span></h3>
<div style="margin:0px;line-height:20px" class="">Computational Neuropsychiatry Lab </div>
<div style="margin:0px;line-height:20px" class="">Hadassah Hebrew University Medical School</div>
</td>
<td width="45" class="">
<div class=""></div>
</td>
<td style="vertical-align:top" class="">
<table cellpadding="0" cellspacing="0" style="vertical-align:-webkit-baseline-middle;font-family:"Trebuchet MS"" class="">
<tbody class="">
<tr class="">
<td height="30" class=""><a href="http://www.neuropsychiatrylab.com/" rel="noreferrer" style="color:rgb(17,85,204)" target="_blank" class=""><img src="https://drive.google.com/a/mail.huji.ac.il/uc?id=1NHYRtwrAti-P2paNAnmB30skxdxSQlqH&export=download" width="96" height="27" alt="www.neuropsychiatrylab.com" class=""></a><br class="">
<br class="">
</td>
</tr>
<tr class="">
<td style="text-align:center" class="">
<table cellpadding="0" cellspacing="0" style="vertical-align:-webkit-baseline-middle;font-family:"Trebuchet MS";display:inline-block" class="">
<tbody class="">
<tr class="">
<td class=""><a href="https://www.facebook.com/uri.urie" rel="noreferrer" style="color:rgb(17,85,204);display:inline-block;padding:0px;background-color:rgb(173,173,173)" target="_blank" class=""><img height="24" src="https://cdn2.hubspot.net/hubfs/53/tools/email-signature-generator/icons/facebook-icon-2x.png" alt="facebook" style="max-width: 135px; display: block;" class=""></a></td>
<td width="5" class="">
<div class=""></div>
</td>
<td class=""></td>
<td width="5" class="">
<div class=""></div>
</td>
<td class=""><a href="https://www.linkedin.com/in/uri-elias-99a43546/" rel="noreferrer" style="color:rgb(17,85,204);display:inline-block;padding:0px;background-color:rgb(173,173,173)" target="_blank" class=""><img height="24" src="https://cdn2.hubspot.net/hubfs/53/tools/email-signature-generator/icons/linkedin-icon-2x.png" alt="linkedin" style="max-width: 135px; display: block;" class=""></a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
_______________________________________________<br class="">
Neuroimaging mailing list<br class="">
<a href="mailto:Neuroimaging@python.org" target="_blank" class="">Neuroimaging@python.org</a><br class="">
<a href="https://mail.python.org/mailman/listinfo/neuroimaging" target="_blank" class="">https://mail.python.org/mailman/listinfo/neuroimaging</a><br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
_______________________________________________<br class="">
Neuroimaging mailing list<br class="">
<a href="mailto:Neuroimaging@python.org" target="_blank" class="">Neuroimaging@python.org</a><br class="">
<a href="https://mail.python.org/mailman/listinfo/neuroimaging" rel="noreferrer" target="_blank" class="">https://mail.python.org/mailman/listinfo/neuroimaging</a><br class="">
</blockquote>
</div>
<br clear="all" class="">
<div class=""><br class="">
</div>
-- <br class="">
<div dir="ltr" class="gmail_signature">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<table cellpadding="0" cellspacing="0" style="color:rgb(255,255,255);vertical-align:-webkit-baseline-middle;font-family:"Trebuchet MS"" class="">
<tbody class="">
<tr class="">
<td style="vertical-align:top" class="">
<h3 style="margin: 0px;" class=""><span style="font-size:16px" class="">Uri Elias</span></h3>
<div style="margin: 0px; line-height: 20px;" class="">Computational Neuropsychiatry Lab </div>
<div style="margin: 0px; line-height: 20px;" class="">Hadassah Hebrew University Medical School</div>
</td>
<td width="45" class="">
<div class=""></div>
</td>
<td style="vertical-align:top" class="">
<table cellpadding="0" cellspacing="0" style="vertical-align:-webkit-baseline-middle;font-family:"Trebuchet MS"" class="">
<tbody class="">
<tr class="">
<td height="30" class=""><a href="http://www.neuropsychiatrylab.com/" rel="noreferrer" style="color:rgb(17,85,204)" target="_blank" class=""><img src="https://drive.google.com/a/mail.huji.ac.il/uc?id=1NHYRtwrAti-P2paNAnmB30skxdxSQlqH&export=download" width="96" height="27" alt="www.neuropsychiatrylab.com" class=""></a><br class="">
<br class="">
</td>
</tr>
<tr class="">
<td style="text-align:center" class="">
<table cellpadding="0" cellspacing="0" style="vertical-align:-webkit-baseline-middle;font-family:"Trebuchet MS";display:inline-block" class="">
<tbody class="">
<tr class="">
<td class=""><a href="https://www.facebook.com/uri.urie" rel="noreferrer" style="color:rgb(17,85,204);display:inline-block;padding:0px;background-color:rgb(173,173,173)" target="_blank" class=""><img height="24" src="https://cdn2.hubspot.net/hubfs/53/tools/email-signature-generator/icons/facebook-icon-2x.png" alt="facebook" style="max-width: 135px; display: block;" class=""></a></td>
<td width="5" class="">
<div class=""></div>
</td>
<td class=""></td>
<td width="5" class="">
<div class=""></div>
</td>
<td class=""><a href="https://www.linkedin.com/in/uri-elias-99a43546/" rel="noreferrer" style="color:rgb(17,85,204);display:inline-block;padding:0px;background-color:rgb(173,173,173)" target="_blank" class=""><img height="24" src="https://cdn2.hubspot.net/hubfs/53/tools/email-signature-generator/icons/linkedin-icon-2x.png" alt="linkedin" style="max-width: 135px; display: block;" class=""></a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
_______________________________________________<br class="">
Neuroimaging mailing list<br class="">
<a href="mailto:Neuroimaging@python.org" class="">Neuroimaging@python.org</a><br class="">
https://mail.python.org/mailman/listinfo/neuroimaging<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>