Commit f78eee30 authored by Turnhout, M.C. van's avatar Turnhout, M.C. van
Browse files

add (optional) Imax argument

parent 692a7713
function [amounts, P, Q, R, RGB, A, K, iOD] = cld_decon(dyes, im, rod)
% [amounts, P, Q, R, RGB, A, K, iOD] = cld_decon(dyes, im, 'rod')
function [amounts, P, Q, R, RGB, A, K, iOD] = cld_decon(dyes, im, varargin)
% [amounts, P, Q, R, RGB, A, K, iOD] = cld_decon(dyes, im, 'rod', Imax)
%
% Input:
% dyes matrix with dye RGB or OD values, a column [R G B]^T for each
......@@ -8,6 +8,9 @@ function [amounts, P, Q, R, RGB, A, K, iOD] = cld_decon(dyes, im, rod)
% rod (optional) a string to identify whether dyes is in RGB or OD
% rod = 'RGB' dyes contains dye RGB values (default)
% rod = 'OD' dyes contains dye OD (optical density) values
% Imax (optional) maximum intensity for the RGB values
% (default is 8-bits RGB: Imax = 2^8-1 = 255 for a missing
% argument).
%
% Output:
% amounts 3D matrix of size(im) with dye amounts for dye n in
......@@ -33,15 +36,20 @@ function [amounts, P, Q, R, RGB, A, K, iOD] = cld_decon(dyes, im, rod)
%
% See also cld_RGB2OD, cld_OD2RGB
% parse input
if nargin < 3
rod = 'RGB';
end
% set defaults
Imax = 255; rod = 'RGB';
% initialise
amounts = zeros(size(im));
P = amounts; Q = P; R = P; RGB = P;
Imax = 255;
% parse input
for n = 1:numel(varargin)
if ischar(varargin{n}) % RGB/OD switch
rod = varargin{n};
else % Imax
Imax = varargin{n};
end
end
% RGB or OD?
if strcmpi(rod(1), 'r')
% dyes contains RGB values, convert to OD
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment