convert_hvolume -- convert the "h_*" files to a useful format Usage: [hMeans, hStds, numSamples] = convert_hvolume(hvol, numCond) As a result of the "selxavg" command in FS-FAST, "h_*" and "h-offset_*" volumes are created containing the mean deviation from baseline for each condition at each voxel and the offset value at each voxel, respectively. In what I presume was a way to use the "bfloat" format to store these results, the values at each voxel in the "h_*" files are concatinated together, with standard deviations following means, and each condition following the previous one. Thus, the dimensions of the hvol variable are [numSlices, numRows, numCols, 2*numCond*numSamples], where numSamples is how many timepoints each condition was sampled. convert_hvolume will take an hvol as input and split out the mean and standard deviation values into hMeans and hStds, both of dimension [numSlices, numRows, numCols, numConds, numSamples]. This function was originally written by Doug Greve and can be found in the Freesurfer distribution in fsfast/toolbox/yak.m; it has been modified slightly from its original form. $Id: convert_hvolume.m,v 1.4 2003/09/15 15:52:18 nknouf Exp $
This function calls:
This function is called by:
0001 function [hMeans, hStds, numSamples] = convert_hvolume(hvol, numCond) 0002 % convert_hvolume -- convert the "h_*" files to a useful format 0003 % 0004 % Usage: [hMeans, hStds, numSamples] = convert_hvolume(hvol, numCond) 0005 % 0006 % As a result of the "selxavg" command in FS-FAST, "h_*" and 0007 % "h-offset_*" volumes are created containing the mean deviation from 0008 % baseline for each condition at each voxel and the offset value at each voxel, 0009 % respectively. In what I presume was a way to use the "bfloat" format 0010 % to store these results, the values at each voxel in the "h_*" files 0011 % are concatinated together, with standard deviations following means, and 0012 % each condition following the previous one. Thus, the dimensions of the 0013 % hvol variable are [numSlices, numRows, numCols, 2*numCond*numSamples], 0014 % where numSamples is how many timepoints each condition was sampled. 0015 % convert_hvolume will take an hvol as input and split out the mean and 0016 % standard deviation values into hMeans and hStds, both of dimension 0017 % [numSlices, numRows, numCols, numConds, numSamples]. 0018 % 0019 % This function was originally written by Doug Greve and can be found in the 0020 % Freesurfer distribution in fsfast/toolbox/yak.m; it has been modified 0021 % slightly from its original form. 0022 % 0023 % $Id: convert_hvolume.m,v 1.4 2003/09/15 15:52:18 nknouf Exp $ 0024 0025 %% add one to include fixation 0026 numCond = numCond + 1; 0027 0028 [numSlices, numRows, numCols, numTimepoints] = size(hvol); 0029 0030 %% find out the number of samples by taking the 0031 %% total number of timepoints 0032 %% in the h volume and dividing by 2*numCond (since the hvol 0033 %% holds both the mean and the standard deviation) 0034 numSamples = numTimepoints/(2*numCond); 0035 0036 %% reshaping and permutations to get the conditions in the 0037 %% correct order 0038 %% we clear the temporary hvol* variables after we are through, 0039 %% as we can run into matlab "out of memory" errors on large 0040 %% or hi-res datasets 0041 hvol2 = permute(hvol, [4 3 2 1]); 0042 clear hvol; 0043 hvol3 = reshape(hvol2, [numSamples, 2, numCond, numCols, numRows, numSlices]); 0044 clear hvol2; 0045 0046 hvol4 = permute(hvol3, [6 5 4 3 1 2]); 0047 clear hvol3; 0048 0049 %% store the means and standard deviations separately 0050 hMeans = (hvol4(:,:,:,:,:,1)); 0051 hStds = (hvol4(:,:,:,:,:,2)); 0052 return;