History of AFNI updates  

|
September 04, 2015 11:49AM
The problem appears when stacking the two datasets.

the node_indices are as follow...

>> ds_left_right.fa.node_indices

ans =

1 2 3 4 5 6 13 14 15 16 17 18

Thus, when trying to save the dset, the cosmo_map2surface function reports the next problem

>> cosmo_map2surface(ds_left_right, 'test_data');
Error using cosmo_check_dataset (line 137)
: .fa.node_indices must be vector with integers in range 1..12

Error in cosmo_map2surface (line 89)
cosmo_check_dataset(ds,'surface');


I have taking a better look of the code and I think that the problem is in here

offset_left=numel(ds_left.a.fdim.values{index}); %(which is 12)

and it should be:

offset_left=numel(ds_left.fa.node_indices); %(which is 6)

After changing this, everything works correctly. See below:

% 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});

% 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
ds_left.fa.node_indices
offset_left=numel(ds_left.fa.node_indices);

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);
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