handleIgnoreFilter

PURPOSE ^

handle options to ignore proper particle identification

SYNOPSIS ^

function result = handleIgnoreFilter(bnd, optionStruct)

DESCRIPTION ^

 handle options to ignore proper particle identification

 Particles that are non-convex or too small are estimated by a simple
   circle to return a dummy result.

 THIS IS NO USER FUNCTION

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function result = handleIgnoreFilter(bnd, optionStruct)
0002 % handle options to ignore proper particle identification
0003 %
0004 % Particles that are non-convex or too small are estimated by a simple
0005 %   circle to return a dummy result.
0006 %
0007 % THIS IS NO USER FUNCTION
0008 
0009 % The elk-library: convex geometry applied to crystallization modeling.
0010 %   Copyright (C) 2013 Alexander Reinhold
0011 %
0012 % This program is free software: you can redistribute it and/or modify it
0013 %   under the terms of the GNU General Public License as published by the
0014 %   Free Software Foundation, either version 3 of the License, or (at your
0015 %   option) any later version.
0016 %
0017 % This program is distributed in the hope that it will be useful, but
0018 %   WITHOUT ANY WARRANTY; without even the implied warranty of
0019 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0020 %   General Public License for more details.
0021 %
0022 % You should have received a copy of the GNU General Public License along
0023 %   with this program.  If not, see <http://www.gnu.org/licenses/>.
0024 
0025 %% handle ignore cases
0026 flagIgnore = 0;
0027 if optionStruct.minConvexity && ...
0028         bnd.convexity < optionStruct.minConvexity
0029     flagIgnore = 1;
0030 end
0031 if optionStruct.minDiameter && ...
0032         bnd.meanWidthHull < optionStruct.minDiameter
0033     flagIgnore = 2;
0034 end
0035 if optionStruct.maxSphericity && ...
0036         bnd.sphericity > optionStruct.maxSphericity
0037     flagIgnore = 3;
0038 end
0039 if optionStruct.maxSphericity2 && ...
0040         bnd.sphericity2 > optionStruct.maxSphericity2
0041     flagIgnore = 4;
0042 end
0043 if optionStruct.maxAngleGap && ...
0044         bnd.largestAngleGap > optionStruct.maxAngleGap
0045     flagIgnore = 5;
0046 end
0047 if optionStruct.minBrightFraction && ~isfield(bnd, 'brightFraction')
0048     error('elk:bnd:inputError', ['If bright fraction from image shall ' ...
0049         'be checked, you must provide the image for obtainBnd']); 
0050 end
0051 if optionStruct.minBrightFraction && isfield(bnd, 'brightFraction') && ...
0052         bnd.brightFraction < optionStruct.minBrightFraction
0053     flagIgnore = 6;
0054 end
0055 if flagIgnore
0056     result = bnd;
0057     % shape data
0058     result.hrep.A = [];
0059     result.hrep.h = [];
0060     result.vrep.V = [0 0];
0061     result.lambda = mean(bnd.polarDistance);
0062     % additional data
0063     result.circumfence = 2*pi*result.lambda;
0064     result.meanWidth = 2*result.lambda;
0065     result.roughness = max(bnd.polarDistance) - min(bnd.polarDistance);
0066     result.squareRoughness = inf;
0067     result.flagIgnore = flagIgnore;
0068 else
0069     result = [];
0070 end

Generated on Sat 18-Jul-2015 16:45:31 by m2html © 2005