basic scaffold for the unity test and object created
This commit is contained in:
p147685 2020-04-15 14:59:21 +02:00
parent f7c9f3b5ac
commit 1c93374f37
2 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,41 @@
classdef GiftIcaReport<handle
%GIFTICAREPORT
% This Class will be a little tool to print to file images and timecourses
% to quickly inspect the result of GIFT for a cleanup of fMRI data
% some guidlines can be found below!
% https://doi.org/10.1016/j.neuroimage.2016.12.036
properties
ICA_file = {}; % .nii file containing the ICA images
TC_file = {}; % .nii file containing the TimeCourse data
Orientation = 'sag';% orientation of images to create
SliceNumber = []; % slice numbers to plot
SPMPath
end
methods %constructor, set and get functions
function obj = GiftIcaReport()
%GIFTICAREPORT Construct an instance of this class
% Detailed explanation goes here
obj.SPMPath=[]; %check if SPM is in the path
end
function set.SPMPath(obj,~)
SPMFound=which('spm'); %check if SPM in searchpath
if isempty(SPMFound) %SPM not found
id='GiftIcaReport:set_SPMPath:SPM_not_found';
msg='SPM not found';
throw(MException(id,msg));
end
%to do add a check on spm version
obj.SPMPath=fileparts(SPMFound);
end
function outputArg = method1(obj,inputArg)
%METHOD1 Summary of this method goes here
% Detailed explanation goes here
outputArg = obj.Property1 + inputArg;
end
end
end

View File

@ -0,0 +1,22 @@
% this file forms the unity test for GiftIcaReport
% it requires that SPM is on the search path
%% inspect if eviourment is properly set
if isempty(which('spm'));error('SPM not on the path, unity test not performed');end
%% basic call
Q = GiftIcaReport;
%% basic call with no SPM error
try
tmp=fileparts(which('spm'));
rmpath(tmp);
Q = GiftIcaReport;
catch ME
addpath(tmp); %put back the path
if ~ strcmpi(ME.identifier,'GiftIcaReport:set_SPMPath:SPM_not_found')
rethrow(ME);
else
disp('passed no SPM test')
disp(ME)
end
end