source: trunk/src/transform_field/ima_erode_particles.m @ 899

Last change on this file since 899 was 899, checked in by sommeria, 9 years ago

ima_erode_particles added

File size: 1.8 KB
Line 
1% 'ima_remove_particles': removes particles from an image (keeping the local minimum)
2% requires the Matlab image processing toolbox
3%------------------------------------------------------------------------
4%%%%  Use the general syntax for transform fields with a single input %%%%
5% OUTPUT:
6% DataOut:   output field structure
7%
8%INPUT:
9% DataIn:  first input field structure
10
11%=======================================================================
12% Copyright 2008-2014, LEGI UMR 5519 / CNRS UJF G-INP, Grenoble, France
13%   http://www.legi.grenoble-inp.fr
14%   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
15%
16%     This file is part of the toolbox UVMAT.
17%
18%     UVMAT is free software; you can redistribute it and/or modify
19%     it under the terms of the GNU General Public License as published
20%     by the Free Software Foundation; either version 2 of the license,
21%     or (at your option) any later version.
22%
23%     UVMAT is distributed in the hope that it will be useful,
24%     but WITHOUT ANY WARRANTY; without even the implied warranty of
25%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26%     GNU General Public License (see LICENSE.txt) for more details.
27%=======================================================================
28
29function DataOut=ima_remove_particles(DataIn)
30%------------------------------------------------------------------------
31DataOut=[];  %default  output field
32if strcmp(DataIn,'*')
33    return
34end
35
36%parameters
37radius=2;
38SE=strel('disk',2);
39%---------------------------------------------------------
40DataOut=DataIn;%default
41
42if ~isfield(DataIn,'A')
43    DataOut.Txt='remove_particles only valid for input images';
44    return
45end
46
47%BACKGROUND LEVEL
48Atype=class(DataIn.A);
49DataOut.A=imerode(DataIn.A,SE);
50% DataOut.A=feval(Atype,DataOut.A);
51
Note: See TracBrowser for help on using the repository browser.