AFNI Message Board

Dear AFNI users-

We are very pleased to announce that the new AFNI Message Board framework is up! Please join us at:

https://discuss.afni.nimh.nih.gov

Existing user accounts have been migrated, so returning users can login by requesting a password reset. New users can create accounts, as well, through a standard account creation process. Please note that these setup emails might initially go to spam folders (esp. for NIH users!), so please check those locations in the beginning.

The current Message Board discussion threads have been migrated to the new framework. The current Message Board will remain visible, but read-only, for a little while.

Sincerely, AFNI HQ

History of AFNI updates  

|
September 02, 2015 11:12AM
afniuser2014 Wrote:
-------------------------------------------------------
> Dear SUMA masters,
>
> I have run my first and group level analyses with
> afni/SUMA in surface space (ld = 64). Now I have a
> niml dataset for each hemisphere. [...]
> Does someone know how can I merge the right and
> left hemispheres stats niml.dset?

I've added your question to the CoSMOMVPA FAQCoSMoMVPA FAQ: .

It has the following Matlab / Octave code [updated 4 Sept 2014, because the original code showed an indexing error]:
% generate synthetic left and right hemisphere data
% (this is just example data for illustration)
ds_left=cosmo_synthetic_dataset('type','surface','seed',1);
ds_right=cosmo_synthetic_dataset('type','surface','seed',2);

% Set the number of vertices of the left surface.
% If the surface is sparse (it does not have data for all nodes), it *may*
% be necessary to adjust this value manually. In that case, consider to:
%
%  - compute the number of vertices, if it is a standardized surface from
%    MapIcosahedron. If the ld parameter was set to 64, then the number of
%    vertices is 10*64^2+2=40962.
%  - get the number of vertices using:
%       [v,f]=surfing_read('left_surface.asc');
%       nverts=max(size(v));
%
[unused, index]=cosmo_dim_find(ds_left, 'node_indices');
nverts_left=max(ds_left.a.fdim.values{index});

% get the offset to set the feature attribute index later
offset_left=numel(ds_left.a.fdim.values{index});

% update node indices to support indexing data from two hemispheres
node_indices=[ds_left.a.fdim.values{index}, ...
                nverts_left+ds_right.a.fdim.values{index}];
ds_left.a.fdim.values{index}=node_indices;
ds_right.a.fdim.values{index}=node_indices;

% update node indices for right hemisphere
assert(all(ds_left.fa.node_indices<=offset_left)); % safety check
ds_right.fa.node_indices=ds_right.fa.node_indices+offset_left;

% merge hemisphes
ds_left_right=cosmo_stack({ds_left,ds_right},2);

You may also consider reading a previous post.



Edited 1 time(s). Last edit at 09/04/2015 01:12PM by nick.
Subject Author Posted

Merging left and right hemispheres .niml datasets

afniuser2014 September 02, 2015 09:59AM

Re: Merging left and right hemispheres .niml datasets

nick September 02, 2015 11:12AM

Re: Merging left and right hemispheres .niml datasets

afniuser2014 September 02, 2015 07:16PM

Re: Merging left and right hemispheres .niml datasets

nick September 04, 2015 06:00AM

Re: Merging left and right hemispheres .niml datasets

afniuser2014 September 04, 2015 11:49AM

Re: Merging left and right hemispheres .niml datasets

nick September 04, 2015 01:13PM