Completed test.

This should be the alpha version.
This commit is contained in:
p147685 2020-03-30 13:18:50 +02:00
parent 4add96e8bb
commit ad058cb455
1 changed files with 16 additions and 6 deletions

View File

@ -52,7 +52,14 @@ classdef BSM<handle
% obj.calc(n) to calculated the nth SPM.mat file
% obj.calc([1 3 6]) to indicate which SPM.mat file to calculate
%only initialize once. Every subsequent call to this function,
%do not reinitialize.
persistent InitDone
if isempty(InitDone) || not(InitDone)
% initialize spm job enviourment
spm_jobman('initcfg');
InitDone = true;
end
SPMidx=[];% will contain the index to the SPMs to work on
if logical(numel(varargin))
SPMidx=varargin{1};
@ -112,8 +119,7 @@ classdef BSM<handle
[val,TF]=obj.MyGetVal('Type',varargin);if TF;obj.Type=val;end
[val,TF]=obj.MyGetVal('Acfl',varargin);if TF;obj.Acfl=val;end
end
% initialize spm job enviourment
spm_jobman('initcfg');
end
function val=get.NumSPMs(obj)
val=numel(obj.SPMs);
@ -259,8 +265,12 @@ classdef BSM<handle
obj.RunJob(DirTrialList{e});%process SPM
BetaTrialList{e}=spm_select('ExtFPList',DirTrialList{e},'^beta_0001.*.nii$',1);
end% end loop
obj.PackBetas(BetaTrialList,LocalTargetFolder,CurCol)%pack per event result
obj.CleanUp(TargetFolderCurCol);
try
obj.PackBetas(BetaTrialList,LocalTargetFolder,CurCol)%pack per event result
obj.CleanUp(TargetFolderCurCol);
catch ME
keyboard; %for debuging purpose only
end
end % end loop act. col
% restore warning status
warning(WarnStat);
@ -269,7 +279,7 @@ classdef BSM<handle
rethrow(ME);
end
end
function CleanUp(~,D)
function CleanUp(obj,D)
if obj.Clean
try
rmdir(D,'s');