classdef janis_patternBeta < janis_patternAbstractImg
properties (SetAccess = public)
ImgType = 'beta';
end
methods
function obj = janis_patternBeta(SPMfile,listOfConditions)
obj = obj@janis_patternAbstractImg;
if nargin > 0
obj.SPMfile = SPMfile;
obj = addCondition(obj,SPMfile,listOfConditions);
end
end
function obj = addCondition(obj,SPMfile,listOfConditions)
obj.SPMfile = SPMfile;
try
load(SPMfile);
catch excep
fprintf('Unable to access spm.mat: %s\n', SPMfile);
rethrow(excep);
end
try
betaNames = {SPM.Vbeta.descrip};
for condCount =1:numel(listOfConditions)
condIdx = strcmpi(betaNames,listOfConditions{condCount});
if exist ( SPM.Vbeta(condIdx).fname)
obj = obj.addImage(SPM.Vbeta(condIdx).fname);
elseif exist([SPM.swd filesep SPM.Vbeta(condIdx).fname])
obj = obj.addImage([SPM.swd filesep SPM.Vbeta(condIdx).fname]);
else
throw(MException('janis:betaFileNotFound'));
end
end
catch excep
error('Unable to find all beta-images for subject: %s',SPMfile);
rethrow(excep);
end
end
end
end