diff --git a/Internal/intGetChannelNum.m b/Internal/intGetChannelNum.m
new file mode 100644
index 0000000..0992de6
--- /dev/null
+++ b/Internal/intGetChannelNum.m
@@ -0,0 +1,17 @@
+function nnc = intGetChannelNum( data )
+%% comp number of fluor channels
+
+nc = numel(find(~cellfun('isempty',strfind(fieldnames(data),'fluor'))));
+nnc = 0;
+
+for jj = 1:nc
+
+ fluorName = ['fluor',num2str(jj)];
+
+ if isfield( data, fluorName )
+ nnc = nnc + 1;
+ end
+
+end
+
+end
\ No newline at end of file
diff --git a/Internal/intMakeMinMax.m b/Internal/intMakeMinMax.m
new file mode 100644
index 0000000..f4d4498
--- /dev/null
+++ b/Internal/intMakeMinMax.m
@@ -0,0 +1,6 @@
+ function minmax = intMakeMinMax( im )
+ minner = medfilt2( im, [2,2], 'symmetric' );
+ maxxer = max( minner(:));
+ minner = min( minner(:));
+ minmax = [minner,maxxer];
+ end
\ No newline at end of file
diff --git a/Internal/intRange.m b/Internal/intRange.m
new file mode 100644
index 0000000..af49ea1
--- /dev/null
+++ b/Internal/intRange.m
@@ -0,0 +1,6 @@
+function ranger = intRange( im, CDFr )
+% put max and min in range
+
+ranger = [min( im ),max( im )];
+
+end
\ No newline at end of file
diff --git a/viz/doDrawCellOutlinePAW.m b/viz/doDrawCellOutlinePAW.m
new file mode 100644
index 0000000..1d19590
--- /dev/null
+++ b/viz/doDrawCellOutlinePAW.m
@@ -0,0 +1,109 @@
+function doDrawCellOutlinePAW( data, channel, ids1, ids2)
+% Description :
+%
+% Opens fig with outlines of cells drawn. The script currently allows
+% you to input two sets of cell IDs to be colored in blue (ids1) and red
+% (ids2). Currently any cells with IDs not listed in ids1 or ids2 will be
+% outlined in yellow. This is all customizable. If you wish to
+% change the colors, replace 'b' etc with the color of your choice. If you
+% do not want cells whose IDs are missing from the ID lists to be outlined,
+% remove code in 'else' block. If you wish to send in additional id lists,
+% add ids3, etc to the line above, and ammend the if/else block.
+%
+% List of inputs:
+%
+% data: A loaded err.mat file for the image you want outlines drawn on
+% channel: The channel to draw outline on (1-phase, 2-fluor1)
+% ids1: IDs of cells you want outlined in one color (default: blue)
+% ids2: IDs of cells you want outlined in a second color (default: red)
+%
+%
+% Copyright (C) 2016 Wiggins Lab
+% Written by Silas Boye Nissen, Connor Brennan, Stella Stylianidou.
+% University of Washington, 2016. Modified in 2018 by S Mangiameli and
+% P. Wiggins.
+% This file is part of SuperSegger.
+%
+% SuperSegger is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% SuperSegger is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with SuperSegger. If not, see .
+
+% Fill unset inputs
+if ~exist('ids1','var') || isempty( ids1 )
+ ids1 = [];
+end
+
+if ~exist('ids2','var') || isempty( ids2 )
+ ids2 = [];
+end
+
+
+
+
+
+
+
+% Draw outlines
+
+rl = data.regs.regs_label;
+ids = data.regs.ID;
+nc = max( rl(:) );
+
+props = regionprops( rl, 'PixelList' );
+
+% Sets color depending on cell ID
+for ii = 1:nc
+
+ id = ids(ii);
+
+ if ismember(id,ids1)
+ cc = 'b';
+ elseif ismember(id, ids2)
+ cc = 'r';
+ else
+ cc = 'y';
+ end
+
+ % Mask for current region
+ tmp = rl;
+ tmp(tmp ~= ii) = 0;
+
+ % Increase size of mask by 1 px and find boundary
+ se = strel('disk',1);
+ tmp2 = logical(imdilate(tmp,se));
+ [y,x] = find(tmp2 == 1);
+ k = boundary(x,y,1);
+
+
+ hold on;
+ skip = 1;
+ kk = k([1:skip:end]);
+ kk = kk([end-3:end,1:end,1:4]);
+
+ n = 1:numel(kk);
+ nn = 5:1:(numel(kk)-1);
+
+ % Interprets from pixel outline to smooth drawn outline
+ % xx = interp1( n, x(kk), nn,'spline' );
+ % yy = interp1( n, y(kk), nn,'spline' );
+
+ p = 0.1; %smaller value of p gives more smoothing
+ xx = fnval(csaps( n, x(kk),p), nn);
+ yy = fnval(csaps( n, y(kk),p), nn);
+
+
+ % Plots outline on phase image
+ plot( xx, yy, 'LineStyle','-','Color',cc,'LineWidth', .5 );
+
+end
+
+end
\ No newline at end of file
diff --git a/viz/doDrawCellOutlineSMM.m b/viz/doDrawCellOutlineSMM.m
new file mode 100755
index 0000000..04c2f63
--- /dev/null
+++ b/viz/doDrawCellOutlineSMM.m
@@ -0,0 +1,119 @@
+function doDrawCellOutlineSMM( data, channel, ids1, ids2)
+% Description :
+%
+% Opens fig with outlines of cells drawn. The script currently allows
+% you to input two sets of cell IDs to be colored in blue (ids1) and red
+% (ids2). Currently any cells with IDs not listed in ids1 or ids2 will be
+% outlined in yellow. This is all customizable. If you wish to
+% change the colors, replace 'b' etc with the color of your choice. If you
+% do not want cells whose IDs are missing from the ID lists to be outlined,
+% remove code in 'else' block. If you wish to send in additional id lists,
+% add ids3, etc to the line above, and ammend the if/else block.
+%
+% List of inputs:
+%
+% data: A loaded err.mat file for the image you want outlines drawn on
+% channel: The channel to draw outline on (1-phase, 2-fluor1)
+% ids1: IDs of cells you want outlined in one color (default: blue)
+% ids2: IDs of cells you want outlined in a second color (default: red)
+%
+%
+% Copyright (C) 2016 Wiggins Lab
+% Written by Silas Boye Nissen, Connor Brennan, Stella Stylianidou.
+% University of Washington, 2016. Modified in 2018 by S Mangiameli and
+% P. Wiggins.
+% This file is part of SuperSegger.
+%
+% SuperSegger is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% SuperSegger is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with SuperSegger. If not, see .
+
+% Fill unset inputs
+if ~exist('ids1','var') || isempty( ids1 )
+ ids1 = [];
+end
+
+if ~exist('ids2','var') || isempty( ids2 )
+ ids2 = [];
+end
+
+if ~exist('channel','var') || isempty( channel )
+ channel = 1;
+end
+
+clf;
+
+% To draw outlines on the fluorescence image, replace phase with fluor
+if channel == 1
+ im = cat(3, ag(data.phase), ag(data.phase), ag(data.phase));
+elseif channel == 2
+ im = cat(3, ag(data.fluor1)*0, ag(data.fluor1), ag(data.fluor1)*0);
+elseif channel ==3
+ im = cat(3, ag(data.fluor2), ag(data.fluor2)*0, ag(data.fluor2)*0);
+end
+
+imshow( im, [] );
+hold on;
+
+rl = data.regs.regs_label;
+ids = data.regs.ID;
+nc = max( rl(:) );
+
+props = regionprops( rl, 'PixelList' );
+
+% Sets color depending on cell ID
+for ii = 1:nc
+
+ id = ids(ii);
+
+ if ismember(id,ids1)
+ cc = 'b';
+ elseif ismember(id, ids2)
+ cc = 'r';
+ else
+ cc = 'y';
+ end
+
+ % Mask for current region
+ tmp = rl;
+ tmp(tmp ~= ii) = 0;
+
+ % Increase size of mask by 1 px and find boundary
+ se = strel('disk',1);
+ tmp2 = logical(imdilate(tmp,se));
+ [y,x] = find(tmp2 == 1);
+ k = boundary(x,y,1);
+
+
+ hold on;
+ skip = 1;
+ kk = k([1:skip:end]);
+ kk = kk([end-3:end,1:end,1:4]);
+
+ n = 1:numel(kk);
+ nn = 5:1:(numel(kk)-1);
+
+ % Interprets from pixel outline to smooth drawn outline
+ % xx = interp1( n, x(kk), nn,'spline' );
+ % yy = interp1( n, y(kk), nn,'spline' );
+
+ p = 0.1; %smaller value of p gives more smoothing
+ xx = fnval(csaps( n, x(kk),p), nn);
+ yy = fnval(csaps( n, y(kk),p), nn);
+
+
+ % Plots outline on phase image
+ plot( xx, yy, 'LineStyle','-','Color',cc,'LineWidth', .5 );
+
+end
+
+end
\ No newline at end of file
diff --git a/viz/intMakeMultiChannel.m b/viz/intMakeMultiChannel.m
new file mode 100644
index 0000000..c7dab86
--- /dev/null
+++ b/viz/intMakeMultiChannel.m
@@ -0,0 +1,94 @@
+function im = intMakeMultiChannel( data, FLAGS, CONST, clist, nc )
+
+im = [];
+
+if (FLAGS.f_flag == 0 && ~FLAGS.composite ) || ...
+ (FLAGS.phase_flag( FLAGS.f_flag +1 ) && ~FLAGS.composite) ...
+ || (FLAGS.composite && FLAGS.include(1) );
+
+ if FLAGS.manual_lut(1) && ~isnan( FLAGS.lut_min(1) ) && ~isnan( FLAGS.lut_max(1))
+ minmax = [FLAGS.lut_min(1), FLAGS.lut_max(1)];
+ elseif FLAGS.gbl_auto(1) && isfield( clist, 'imRangeGlobal')
+ minmax = clist.imRangeGlobal(:,1);
+ else
+ minmax = intMakeMinMax( data.phase );
+ end
+
+ im = comp( {data.phase, minmax, FLAGS.level(1)} );
+end
+
+% if you are in fluorescence mode (f_flag) draw the fluor channels
+if FLAGS.f_flag && CONST.view.falseColorFlag
+ ranger = FLAGS.f_flag;
+elseif FLAGS.composite
+ ranger = find(FLAGS.include(2:(nc+1)));
+elseif ~FLAGS.f_flag
+ ranger = [];
+else
+ ranger = FLAGS.f_flag;
+end
+
+for ii = ranger;
+
+ flName = ['fl',num2str(ii),'bg'];
+
+ filtName = ['fluor',num2str(ii),'_filtered'];
+
+ if FLAGS.filt(ii) && isfield( data, filtName);
+ flourName = filtName;
+ else
+ flourName = ['fluor',num2str(ii)];
+ end
+
+ im_tmp = data.(flourName);
+
+ if FLAGS.filt(ii)
+ minmax = intMakeMinMax( im_tmp );
+
+ if isfield( data, flName )
+ minmax(1) = data.(flName);
+ end
+
+ elseif FLAGS.manual_lut(ii+1) && ~isnan( FLAGS.lut_min(ii+1) ) && ~isnan( FLAGS.lut_max(ii+1))
+ minmax = [FLAGS.lut_min(ii+1), FLAGS.lut_max(ii+1)];
+ elseif FLAGS.gbl_auto(ii+1) && isfield( clist, 'imRangeGlobal')
+ minmax = clist.imRangeGlobal(:,ii+1);
+ else
+ minmax = intMakeMinMax( im_tmp );
+
+ if isfield( data, flName )
+ minmax(1) = data.(flName);
+ end
+
+ end
+
+ if CONST.view.falseColorFlag && FLAGS.f_flag
+ cc = jet(256);
+ else
+ cc = CONST.view.fluorColor{ii};
+ end
+
+
+ command = {im_tmp, cc, FLAGS.level(ii+1)};
+
+ if FLAGS.log_view(ii)
+ command = {command{:}, 'log'};
+ else
+ command = {command{:}, minmax };
+ end
+
+ im = comp( {im}, command );
+
+
+end
+
+
+
+
+
+
+
+
+
+
+end
\ No newline at end of file