Dear Fredrik,
the next CAT12 version 12.8 will also include a tool to save surface data and volume files (resampled to lower spatial resolution) inside a mask as mat-file. I have attached the resp. function.
function varargout = cat_io_data2mat(opt)
% Save spatially registered volume or resampled surface data as Matlab data matrix for further
% use with machine learning tools.
% Volume data will be optionally masked to remove non-brain areas
%
% FORMAT cat_io_data2mat(opt)
%
% volume or surface data:
% opt.data - cell of char array of filenames
% opt.c - confounds data to be removed
% opt.fname - filename for saving mat-file
% opt.outdir - output directory of saved mat-file
%
% additional parameters for volume data only:
% opt.resolution - resampling spatial resolution for volume data
% opt.mask - optional brainmask for volume data
%
% saved parameters:
% Y - data matrix with size number of subjects x number of voxels/vertices
% label - label of samples
% ind - index for volume or surface data inside mask
% dim - dimension of original data
%
% Examples:
% Select recursively all 8mm smoothed gray matter segments from folder1
% for the 1st sample and folder 2 from the 2nd sample and save resampled data
% with 4mm resampling spatial resolution (please note that for several samples
% the parameter "files" should be defined as "{files}")
% files{1} = spm_select('FPListRec',folder1,'^s8mwp1.*\.nii$');
% files{2} = spm_select('FPListRec',folder2,'^s8mwp1.*\.nii$');
% cat_io_data2mat(struct('data',{files},'resolution',4,'mask',cat_get_defaults('extopts.brainmask'),'fname','Data.mat'));
%
% Select recursively all 12mm smoothed and resampled thickness data from current folder
% and save Data.mat in subfolder test
% files = spm_select('FPListRec',pwd,'^s12.mesh.thickness.resampled_32k.*\.gii$');
% cat_io_data2mat(struct('data',files,'fname','Data.mat','outdir','test'));
Best,
Christian
On Wed, 14 Apr 2021 20:17:17 +0100, Fredrik Bergström <[log in to unmask]> wrote:
>Dear Guillaume,
>
>thanks for your reply. Doing surface-based searchlight MVPA would also be
>an option, but e.g. CoSMoMVPA (and I believe I also tried TDT) cannot load
>.gii files, which is actually what prompted me to think about converting
>.gii to .nii instead. It would be ideal if there is some easy way of
>loading and converting the surface .gii files to 2d vectors that easily can
>be used by TDT or CoSMoMVPA, but I do not know any such toolbox or function.
>
>Best,
>Fredrik
>
>
>On Wed, Apr 14, 2021 at 7:18 PM Guillaume Flandin <[log in to unmask]>
>wrote:
>
>> Dear Fredrik,
>>
>> Best would be to perform the external analysis directly on the surface.
>> For a surface-based MVPA analysis, you have, for example, CoSMoMVPA:
>> http://www.cosmomvpa.org/
>> For the sake of completeness, functions to project surfaces to volume
>> and vice-versa are spm_mesh_to_grid and spm_mesh_project but I get
>> tut-tutted each time I mention them as they are unlikely to be the
>> appropriate answer here.
>>
>> Best regards,
>> Guillaume.
>>
>>
>> On 14/04/2021 12:07, Fredrik Bergström wrote:
>> > Dear all,
>> >
>> > Is there a straightforward way (for windows users) to convert surface
>> > gifti files generated by CAT12 to volumetric nifti files for external
>> > analysis (e.g., searchlight-based MVPA)? And possibly back again?
>> >
>> > Best,
>> > Fredrik
>>
>> --
>> Guillaume Flandin, PhD
>> Wellcome Centre for Human Neuroimaging
>> UCL Queen Square Institute of Neurology
>> London WC1N 3BG
>>
>
|