Home > SuperSegger > Internal > convertToMonochromatic.m

convertToMonochromatic

PURPOSE ^

trackOptiAlignPad : converts images with multiple channels into the

SYNOPSIS ^

function imMono = convertToMonochromatic(imMultiChannel)

DESCRIPTION ^

 trackOptiAlignPad : converts images with multiple channels into the
 channel with the maximum value.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function imMono = convertToMonochromatic(imMultiChannel)
0002 % trackOptiAlignPad : converts images with multiple channels into the
0003 % channel with the maximum value.
0004 
0005 % INPUT :
0006 %       imMultiChannel : multiple channel image
0007 % OUTPUT :
0008 %       imMono : monochromatic image
0009 %
0010 %
0011 % Copyright (C) 2016 Wiggins Lab
0012 % Written by Stella Stylianidou.
0013 % University of Washington, 2016
0014 % This file is part of SuperSegger.
0015 %
0016 % SuperSegger is free software: you can redistribute it and/or modify
0017 % it under the terms of the GNU General Public License as published by
0018 % the Free Software Foundation, either version 3 of the License, or
0019 % (at your option) any later version.
0020 %
0021 % SuperSegger is distributed in the hope that it will be useful,
0022 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0023 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0024 % GNU General Public License for more details.
0025 %
0026 % You should have received a copy of the GNU General Public License
0027 % along with SuperSegger.  If not, see <http://www.gnu.org/licenses/>.
0028 
0029 colors = size(imMultiChannel,3);
0030 maxValue = 0;
0031 for i = 1 : colors
0032     currentMaxValue = max(max(imMultiChannel(:,:,i)));
0033     if ( currentMaxValue > maxValue)
0034         maxValue = currentMaxValue;
0035         maxChannel = i;
0036     end
0037 end
0038 if maxValue > 0
0039     imMono = (imMultiChannel(:,:,maxChannel));
0040 else
0041     error ('unable to convert images to monochromatic');
0042 end
0043 end

Generated on Thu 19-Jan-2017 13:55:21 by m2html © 2005