TDT Ploting Voxels

tdt
#1

I’m a new user of The Decoding Toolbox, playing with some analysis. I preformed an analysis and used feature selection. I would like to know how can I plot voxels that have been selected?

#2

Hi tryto,

You find the results of the features that have been selected under results.feature_selection.

It can be a little involved, because there is a possibility for many nested stages. For each decoding analysis and for each cross-validation step you would get a different index. Say you ran a ROI analysis with three ROI masks and want to get the index for ROI 2 and cross-validation iteration 7. Then you would get that from
i_decoding = 2;
i_step = 7;
fs_index = results.feature_selection(i_decoding).fs_index{i_step};
Now armed with the index, I believe this to be the subindex referencing to the mask index (so of those voxel positions in the ROI in index format, which voxels did you pick). This means you can get the actual index in the volume through
volindex = results.mask_index_each{i_decoding}(fs_index);
(this does not work for searchlights because we don’t write the mask_index_each for them - takes up way too much memory - and the use cases should be extremely low)

Now with this index, you can create a mask volume yourself.

hdr = spm_vol(reference_filename); % choose a reference .nii
vol = zeros(hdr.dim(1:3));
vol(volindex) = 1; % makes a mask
hdr.fname = new_filename; % choose a new filename
spm_write_vol(hdr,vol);

I just wrote a quick function that would write a volume given an index and will add it to the utilities in TDT. Shoot me an email if you would like to try it out now.

Best,
Martin