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.