-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathfalseColorize.m
More file actions
26 lines (22 loc) · 770 Bytes
/
falseColorize.m
File metadata and controls
26 lines (22 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function out = falseColorize( img, varargin )
% out = falseColorize( img [, colormapName ] )
%
% Inputs:
% img - array with values between 0 and 1
%
% Optional Inputs:
% colormapName - the name of the colormap to use (default is jet)
%
% Written by Nicholas Dwork - Copyright 2020
%
% This software is offered under the GNU General Public License 3.0. It
% is offered without any warranty expressed or implied, including the
% implied warranties of merchantability or fitness for a particular
% purpose.
p = inputParser;
p.addOptional( 'colormapName', 'jet', @(x) true );
p.parse( varargin{:} );
colormapName = p.Results.colormapName;
eval( [ 'map = ', colormapName, '(256);' ] );
out = ind2rgb( round(img * 255), map );
end