Skip to content

Data Handling (Matlab)

mario.senden edited this page Jun 24, 2020 · 11 revisions

Analyze-style data format (NIfTI)

Loading Data

Reading in NIfTI files in Matlab can simply be done using the built-in nifitread function. Functional NIFTI contain reserve the fourth dimension for time, while this tool requires time to be along the first dimension. Therefore, before using functional data with the present toolbox, they need to be re-arranged data = permute(data,[4,1,2,3]);

Saving Results

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

BrainVoyager Data Format (VTC)

Handling BrainVoyager data in Matlab requires NeuroElf. Please refer to the official NeuroElf wiki for installation instructions.

Loading Data

BrainVoyager stores functional data in the space of a 3D anatomical data set in the VTC file format. For a detailed overview of the file format please refer to the corresponding entry in the official BrainVoyager User's guide.

This data can be loaded into Matab using NeuroElf's xff function.

Below is an example on how to load a VTC file called prf_data.vtc and extract functional data.

VTC = xff('prf_data.vtc');
data = VTC.VTCData;

Saving Results

Results can be saved to a native resolution volume map (NR-VMP) file. For a detailed overview of the file format please refer to the corresponding entry in the official BrainVoyager User's guide.

A new, empty, VMP file can be created using NeuroElf's BVQXfile function. Subsequently, the header information needs to be supplied such as the number of maps that need to be stored, how the dimensions of the maps relate to that of the corresponding anatomy (VMR file) etc. Finally, the maps need to be filed with results obtained from one (or several) of the CNI tools.

Below is an example on how to save pRF mapping results to a VMP file.

% create VMP fie
VMP = BVQXfile('new:vmp');

% provide general information
% some information can be taken from VTC files
VMP.NrOfMaps = 6;
VMP.XStart = VTC.XStart;
VMP.XEnd = VTC.XEnd;
VMP.YStart = VTC.YStart;
VMP.YEnd = VTC.YEnd;
VMP.ZStart = VTC.ZStart;
VMP.ZEnd = VTC.ZEnd;
VMP.Resolution = VTC.Resolution;

% provide map specific information (1st map)
VMP.Map(1).Type = 2;
VMP.Map(1).LowerThreshold = 0.2;
VMP.Map(1).UpperThreshold = 0.6;
VMP.Map(1).Name = 'R';
VMP.Map(1).RGBLowerThreshPos = [0 0 100];
VMP.Map(1).RGBUpperThreshPos = [0 0 255];
VMP.Map(1).ClusterSize = 4;
VMP.Map(1).DF1 = 302;
VMP.Map(1).ShowPositiveNegativeFlag = 1;
VMP.Map(1).UnknownValue = -1;

% provide map specific information (2nd map)
% some information can be taken from previous maps 
VMP.Map(2) = VMP.Map(1);           
VMP.Map(2).Type = 1;
VMP.Map(2).LowerThreshold = 0;
VMP.Map(2).UpperThreshold = 10;
VMP.Map(2).Name = 'Best-fit pRF: x, UseThreshMap: R';
VMP.Map(2).RGBLowerThreshPos = [0 100 0];
VMP.Map(2).RGBUpperThreshPos = [0 255 0];
VMP.Map(2).LUTName = '/hsv.olt';
VMP.Map(2).ClusterSize = 1;
VMP.Map(2).DF1 = 0;
VMP.Map(2).ShowPositiveNegativeFlag = 3;

% provide map specific information (3rd map)
% some information can be taken from previous maps 
VMP.Map(3) = VMP.Map(2);     
VMP.Map(3).Name = 'Best-fit pRF: y, UseThreshMap: R';
VMP.Map(3).RGBLowerThreshPos = [100 0 0];
VMP.Map(3).RGBUpperThreshPos = [255 0 0];

% provide map specific information (4th map)
% some information can be taken from previous maps
VMP.Map(4) = VMP.Map(2);      
VMP.Map(4).Name = 'Best-fit pRF: sigma, UseThreshMap: R';
VMP.Map(4).RGBLowerThreshPos = [100 0 100];
VMP.Map(4).RGBUpperThreshPos = [255 0 255];

% provide map specific information (5th map)
% some information can be taken from previous maps
VMP.Map(5) = VMP.Map(2);
VMP.Map(5).LowerThreshold = 0.001;
VMP.Map(5).Name = 'Eccentricity, UseThreshMap: R';
VMP.Map(5).RGBLowerThreshPos = [0 100 100];
VMP.Map(5).RGBUpperThreshPos = [0 255 255];
VMP.Map(5).LUTName = '/eccentricity_v1.olt';

% provide map specific information (6th map)
% some information can be taken from previous maps
VMP.Map(6) = VMP.Map(2); 
VMP.Map(6).LowerThreshold = 0.001;
VMP.Map(6).UpperThreshold = 3.1416;
VMP.Map(6).Name = 'Polar angle, UseThreshMap: R';
VMP.Map(6).RGBLowerThreshPos = [0 0 100];
VMP.Map(6).RGBUpperThreshPos = [0 0 255];
VMP.Map(6).LUTName = '/angle_v1.olt';

% assign results to maps
VMP.Map(1).VMPData = results.corr_fit;
VMP.Map(2).VMPData = results.mu_x;
VMP.Map(3).VMPData = results.mu_y;
VMP.Map(4).VMPData = results.sigma;
VMP.Map(5).VMPData = results.eccentricity;
VMP.Map(6).VMPData = results.polar_angle;

% save VMP
VMP.saveas('pRF_mapping.vmp')
Clone this wiki locally