Skip to content

Commit

Permalink
Merge pull request #85 from TomMaullin/new_release_2.0.0
Browse files Browse the repository at this point in the history
New release 2.0.0
  • Loading branch information
TomMaullin authored Nov 5, 2018
2 parents bb8f9f3 + 71d967c commit 026754e
Show file tree
Hide file tree
Showing 2 changed files with 167 additions and 11 deletions.
157 changes: 150 additions & 7 deletions swe.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
% Written by Bryan Guillaume
% $Id$

versionNo = '1.2.11';
versionNo = '2.0.0';

try
Modality = spm_get_defaults('modality');
Expand Down Expand Up @@ -59,11 +59,9 @@
%==================================================================
case 'asciiwelcome' %-ASCII swe banner welcome
%==================================================================
disp( ' ___ ___ _ ___ _ _ ');
disp( ' / __) _ _ | __) _ _ /_| (__ \ /_|/_| ');
disp( ' \__ \ \\/\// | __) \\// || _ / __/ _ || || ');
disp( ' (___/ \/\/ |___) \/ |||_| \___)|_| || || ');
fprintf('\n swe v%s \n', versionNo);
a = generateAscii(['SwE v' versionNo]);
fprintf('%s \n', a{1}, a{2}, a{3}, a{4});
fprintf('swe v%s \n', versionNo);

case 'colour'

Expand All @@ -82,6 +80,8 @@

return

end

%=======================================================================
% SUBFUNCTIONS
%=======================================================================
Expand Down Expand Up @@ -109,4 +109,147 @@
ok = 0;
end

return
return

end

% The following functions are for generating the ascii welcome message for
% SwE.
% -------------------------------------------------------------------------
% This method converts character 'char' to it's equivalent 4-line ascii
% art. New characters can be added by creating new cases in the below
% switch.
function aChar = char2ascii(char)

switch char

case '0'

aChar = {' ___ ',...
'| |',...
'| | |',...
'|___|'};

case '1'

aChar = {' _ ',...
'/_|',...
' ||',...
' ||'};

case '2'

aChar = {' ___ ',...
'(__ \',...
'/ __/',...
'\___)'};

case '3'

aChar = {' ___ ',...
'(__ )',...
' (_ \',...
'(___/'};
case '4'

aChar = {' __ ',...
' /. |',...
'(_ _)',...
' (_) '};
case '5'

aChar = {' ___ ',...
'| __)',...
'|__ \',...
'(___/'};

case '6'

aChar = {' _ ',...
' / ) ',...
'/ _ \',...
'\___/'};
case '7'

aChar = {' ___ ',...
'(__ )',...
' / / ',...
'(_/ '};
case '8'

aChar = {' ___ ',...
'| _ |',...
'| _ |',...
'|___| '};
case '9'

aChar = {' ___ ',...
'/ _ \',...
'\_ /',...
' (_/ '};

case '.'

aChar = {' ',...
' ',...
' _ ',...
'|_|'};

case 'S'

aChar = {' ___ ',...
'/ __)',...
'\__ \',...
'(___/'};

case 'w'

aChar = {' ',...
'_ _',...
'\\/\//',...
' \/\/ '};

case 'E'

aChar = {' ___ ',...
'| __)',...
'| __)',...
'|___)'};

case ' '

aChar = {' ',...
' ',...
' ',...
' '};

case 'v'

aChar = {' ',...
'_ _ ',...
'\\// ',...
' \/ '};


end

end

% This function takes two cell arrays containing ascii art in the form
% {line1, line2, line3,...} and concatenates them horizontally.
function c = concatAscii(a,b)

c = arrayfun(@(i) [a{i} b{i}], 1:length(b),'UniformOutput',false);
end

% This function takes in a string as input and recursively generates the
% ASCII art representation of said string.
function ascii = generateAscii(str)

if length(str)~=1
ascii = concatAscii(generateAscii(str(1:(end-1))), generateAscii(str(end)));
else
ascii = char2ascii(str);
end

end
21 changes: 17 additions & 4 deletions swe_getSPM.m
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,19 @@
%--------------------------------------------------------------------------
if STAT ~= 'P'

% Get the equivalent statistic
switch STAT

case 'T'

eSTAT = 'Z';

case 'F'

eSTAT = 'X';

end

% If we are doing voxelwise inference on a parametric.
if ~isfield(SwE, 'WB') && infType == 0

Expand Down Expand Up @@ -748,7 +761,7 @@
try
u = xSwE.u;
catch
u = spm_input(['threshold {',STAT,' or p value}'],'+0','r',0.001,1);
u = spm_input(['threshold {',eSTAT,' or p value}'],'+0','r',0.001,1);
end
if u <= 1
thresDesc = ['p<' num2str(u) ' (unc.)'];
Expand Down Expand Up @@ -800,7 +813,7 @@
try
u = xSwE.u;
catch
u = spm_input(['threshold {',STAT,' or p value}'],'+1','r',0.001,1);
u = spm_input(['threshold {',eSTAT,' or p value}'],'+1','r',0.001,1);
end
if u <= 1
thresDesc = ['p<' num2str(u) ' (unc.)'];
Expand Down Expand Up @@ -900,7 +913,7 @@
try
u = xSwE.u;
catch
u = spm_input(['threshold {',STAT,' or p value}'],'+0','r',0.001,1);
u = spm_input(['threshold {',eSTAT,' or p value}'],'+0','r',0.001,1);
end
if u <= 1
thresDesc = ['p<' num2str(u) ' (unc.)'];
Expand Down Expand Up @@ -989,7 +1002,7 @@
try
u = xSwE.u;
catch
u = spm_input(['threshold {',STAT,' or p value}'],'+1','r',0.001,1);
u = spm_input(['threshold {',eSTAT,' or p value}'],'+1','r',0.001,1);
end
if u <= 1
thresDesc = ['p<' num2str(u) ' (unc.)'];
Expand Down

0 comments on commit 026754e

Please sign in to comment.