%% Anatomical dataset basics
% In this example, load a brain as a CoSMoMVPA datset and visualize it
% in matlab
%
% # For CoSMoMVPA's copyright information and license terms, #
% # see the COPYING file distributed with CoSMoMVPA. #
% Set the path.
config=cosmo_config();
data_path=fullfile(config.tutorial_data_path,'ak6','s01');
% Set filename
fn=fullfile(data_path, 'brain.nii');
% Load with cosmo_fmri_dataset and assign to a variable 'ds'
%%%% >>> Your code here <<< %%%%
%% Show the dataset contents using cosmo_disp. Where can you see the
% number of voxels in the three spatial dimensions?
%%%% >>> Your code here <<< %%%%
% Show a histogram of all values in the dataset. For bonus points add axis
% labels.
% Hint: all data is present in ds.samples
%%%% >>> Your code here <<< %%%%
%% There are a lot of zero values in the dataset. Find all non-zero values
% in ds.samples, and plot a histogram of those. What do the two bumps
% represent?
%%%% >>> Your code here <<< %%%%
%% Using cosmo_plot_slices, show a saggital view of the dataset
%%%% >>> Your code here <<< %%%%
% Make a copy of the dataset
ds_copy=ds;
%% ds.fa.i contains, for each feature (voxel), an index for the
% anterior-posterior position of that voxel.
% Set all voxels that have a value of less than 100 for ds.fa.i to zero,
% and plot the results
%%%% >>> Your code here <<< %%%%
% Store the results in a nifti file for visualization using cosmo_map2fmri
output_path=config.output_data_path;
fn_out=fullfile(output_path,'anatomical_dataset_posterior.nii');
%%%% >>> Your code here <<< %%%%
%% Advanced exercise: set all voxels around a center voxel at
% i=150,j=100,k=50 within a 40-voxel radius to zero, and display the result
center_ijk=[150; 100; 50];
radius=40;
%%%% >>> Your code here <<< %%%%