2020-04-15 14:59:21 +02:00
|
|
|
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
|
2020-04-15 21:35:12 +02:00
|
|
|
ICAfile = {}; % .nii file containing the ICA images
|
|
|
|
TCfile = {}; % .nii file containing the TimeCourse data
|
2020-04-15 14:59:21 +02:00
|
|
|
Orientation = 'sag';% orientation of images to create
|
2020-04-15 21:35:12 +02:00
|
|
|
SliceNumbers = []; % slice numbers to plot
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
properties (Access=private)
|
|
|
|
OrientationOptions={'tra','sag','cor','all'};
|
2020-04-15 14:59:21 +02:00
|
|
|
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
|
|
|
|
|
2020-04-15 21:35:12 +02:00
|
|
|
function set.TCfile(obj,val)
|
|
|
|
obj.TCfile=obj.setfile(val);
|
|
|
|
end
|
|
|
|
|
|
|
|
function set.ICAfile(obj,val)
|
|
|
|
obj.ICAfile=obj.setfile(val);
|
|
|
|
end
|
|
|
|
|
|
|
|
function set.Orientation(obj,val)
|
|
|
|
switch lower(val)
|
|
|
|
case obj.OrientationOptions %#ok<MCSUP>
|
|
|
|
obj.Orientation=val;
|
|
|
|
otherwise
|
|
|
|
id = 'GiftIcaReport:set_orientation:invalid_orientation';
|
|
|
|
msg = sprintf('%s\n%s\n%s\t%s\t%s\n',...
|
|
|
|
'invalid option for orientation',...
|
|
|
|
'pick one of the following options',...
|
|
|
|
obj.OrientationOptions{:}); %#ok<MCSUP>
|
|
|
|
throw(MException(id,msg));
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function set.SliceNumbers(obj,val)
|
|
|
|
if isnumeric(val) && ~any(val<1)
|
|
|
|
obj.SliceNumbers=val;
|
|
|
|
else
|
|
|
|
id = 'GiftIcaReport:set_slicenumbers:invalid_input';
|
|
|
|
msg = sprintf('invalid input for slicenumbers');
|
|
|
|
throw(MException(id,msg));
|
|
|
|
end
|
|
|
|
|
2020-04-15 14:59:21 +02:00
|
|
|
end
|
|
|
|
end
|
2020-04-15 21:35:12 +02:00
|
|
|
methods %private methods
|
|
|
|
function out = setfile(~,val)
|
|
|
|
if isempty(val)
|
|
|
|
out={};
|
|
|
|
return
|
|
|
|
end
|
|
|
|
if strcmpi('ui',val)
|
|
|
|
out={spm_select(1,'image','select ICA file, first frame')};
|
|
|
|
return
|
|
|
|
end
|
|
|
|
if iscell(val)
|
|
|
|
if ~exist(val{1},'file')
|
|
|
|
id='GiftICAReport:setfile:FileNotFound';
|
|
|
|
msg='File not Found';
|
|
|
|
throw(MException(id,msg));
|
|
|
|
else
|
|
|
|
out=val(1);
|
|
|
|
return
|
|
|
|
end
|
|
|
|
else
|
|
|
|
if ~exist(val,'file')
|
|
|
|
id='GiftICAReport:setfile:FileNotFound';
|
|
|
|
msg='File not Found';
|
|
|
|
throw(MException(id,msg));
|
|
|
|
else
|
|
|
|
out={val};
|
|
|
|
return
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2020-04-15 14:59:21 +02:00
|
|
|
end
|
|
|
|
|