# Algorithms file level help

## C:\Users\AB\DArT_Toolshed\Algorithms\Bezier

bezlib_bezcurve.m

``` function [varargout] = bezlib_bezcurve(varargin)

Calculates the points along a Bezier curve.

Inputs:
ctrl_pts - the control points for the Bezier
t      - the parameterization (time in this case)

Outputs:
bpts - the xy points along the Bezier curve defined by ctrl_pts at time t.

Example:
x = linspace(-1,1,100);
y = x.^3 + randn(size(x))/5;
pts = [x(:), y(:)];
cpts = bezlib_bezierfitlms('pts', pts, 'order', 4);
bpts = bezlib_bezcurve('ctrl_pts', cpts, 't', [0:0.001:1]);

Dr. A. I. Hanna (2005)

revised. J. Strasser 22/08/2007
```

bezlib_bezdisp.m

``` function varargout = bezlib_bezdisp(varargin)

Plots the result of bezlib_bezierfitlms

Inputs:
'pts' - the original noisy data points
'ctrl_pts' - the control points generated by bezlib_bezierfitlms
'parent' - the axis to draw to (default = gca)

Outputs:
'ph' - the plot handles to the data

cpts = bezlib_bezierfitlms('verbose', 1);
bezlib_plotbezslopes('cpts', cpts, 'parent', gca);

Dr. A. I. Hanna (2007)

revised. J. Strasser 22/08/2007
```

bezlib_bezierfitlms.m

``` function [varargout] = bezlib_bezierfitlms(varargin)

Calculates the control points for a Bezier curve given some data using a
least mean square approach. Note it is important that the point be
ordered in terms of a parameterization, i.e. arc length or time.
Unordered points will result in a poor fit.

Inputs:
pts - the Nx2 data that the Bezier should fit to (default = 100 points for a cubic polynomial)
order - the order of the Bezier curve (default = 3)
verbose - display any output (default = 0)

Outputs:
cpts - a set of Mx2 control points

Example:
cla;
bezlib_bezierfitlms('verbose', 1);

Example:
cla;
x = linspace(-1,1,100);
y = x.^3 + randn(size(x))/5;
pts = [x(:), y(:)];
cpts = bezlib_bezierfitlms('pts', pts, 'order', 4, 'verbose', 1);
bezlib_plotbezslopes('cpts', cpts, 'parent', gca);

Example:
cla;
x = linspace(-2,2,100);
y = x.^2 + randn(size(x))/5;
z = x + y;
pts = [x(:), y(:), z(:)];
cpts = bezlib_bezierfitlms('pts', pts, 'order', 4, 'verbose', 1);
bezlib_plotbezslopes('cpts', cpts, 'parent', gca);

Dr. A. I. Hanna (2006)

revised. J. Strasser 22/08/2007
```

bezlib_plotbezslopes.m

``` function varargout = bezlib_plotbezslopes(varargin)

Plots the slopes of the control points for a bezier curve

Inputs:
'cpts' - the control points
'parent' - the axis to draw to (default = gca)

Outputs:
'ph' - the plot handles to the slopes

cpts = bezlib_bezierfitlms('verbose', 1);
bezlib_plotbezslopes('cpts', cpts, 'parent', gca);

Dr. A. I. Hanna (2007)

revised. J. Strasser 22/08/2007
```

## C:\Users\AB\DArT_Toolshed\Algorithms\MeshGeneration\Mesh2d v2.1

connectivity.m

```  CONNECTIVITY: Assemble connectivity data for a triangular mesh.

The edge based connectivity is built for a triangular mesh and the
boundary nodes identified. This data should be useful when implementing
FE/FV methods using triangular meshes.

[e,te,et2,bnd] = connectivity(p,t);

p   : Nx2 array of nodes coordinates, [x1,y1; x2,y2; etc]
t   : Mx3 array of triangles as indices, [n11,n12,n13; n21,n22,n23; etc]

e   : Kx2 array of unique mesh edges - [n11,n12; n21,n22; etc]
te  : Mx3 array of triangles as indices into E, [e11,e12,e13;
e21,e22,e23; etc]
e2t : Kx2 array of triangle neighbours for unique mesh edges -
[t11,t12; t21,t22; etc]. Each row has two entries corresponding to
the triangle numbers associated with each edge in E. Boundary
edges have e2t(i,2)=0.
bnd : Nx1 logical array identifying boundary nodes. P(i,:) is a boundary
node if BND(i)=TRUE.

```

``` Mesh2d is a MATLAB toolbox designed to automatically generate quality 2D
unstructured triangular meshes based on linear geometry inputs.
Mesh2d is Copyright (C) 2007 Darren Engwirda.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.

If you use Mesh2d in any program or publication, please inform and
acknowledge its author Darren Engwirda (d_engwirda@hotmail.com).
```

inpoly.m

```  INPOLY: Point-in-polygon testing.

Determine whether a series of points lie within the bounds of a polygon
in the 2D plane. General non-convex, multiply-connected polygonal
regions can be handled.

SHORT SYNTAX:

in = inpoly(p,node);

p   : The points to be tested as an Nx2 array [x1 y1; x2 y2; etc].
node: The vertices of the polygon as an Mx2 array [X1 Y1; X2 Y2; etc].
The standard syntax assumes that the vertices are specified in
consecutive order.

in  : An Nx1 logical array with IN(i) = TRUE if P(i,:) lies within the
region.

LONG SYNTAX:

[in,on] = inpoly(p,node,edge);

edge: An Mx2 array of polygon edges, specified as connections between
the vertices in NODE: [n1 n2; n3 n4; etc]. The vertices in NODE
do not need to be specified in connsecutive order when using the
extended syntax.

on  : An Nx1 logical array with ON(i) = TRUE if P(i,:) lies on a
polygon edge. (A tolerance is used to deal with numerical
precision, so that points within a distance of
eps^0.8*norm(node(:),inf) from a polygon edge are considered "on"
the edge.

EXAMPLE:

polydemo;       % Will run a few examples

```

mesh2d.m

```  MESH2D: 2D unstructured triangular mesh generation.

A 2D unstructured triangular mesh is generated based on a piecewise-
linear geometry input. An iterative method is implemented to optimise
mesh quality. General multiply connected domains and element size
functions can be specified.

Returns the final coordinates of the nodes P, and their triangulation T
(with a counter-clockwise node ordering).

SHORT SYNTAX:

[p,t] = mesh2d(node);

NODE defines the geometry nodes as an Nx2 array:

node  = [x1 y1; x2 y2; etc], geometry nodes specified in consectutive
order, such that NODE(2,:) is joined with
NODE(1,:) etc.

An element size function is automatically generated based on the
complexity of the geometry. Generally this produces meshes with the
fewest number of triangles.

LONG SYNTAX:

[p,t] = mesh2d(node,edge,hdata,options);

Blank arguments can be passed using the empty placeholder "[]".

EDGE defines the connectivity between the points in NODE as a list of
edges:

edge = [n1 n2; n2 n3; etc], connectivity between nodes to form
geometry edges. If EDGE is specified it is
not required that NODE be consectutive.

HDATA is a structure containing user defined element size information.
HDATA can include the following fields:

hdata.hmax  = h0;                   Max allowable global element size.
hdata.edgeh = [e1,h1; e2,h2; etc];  Element size on specified geometry
edges.
hdata.fun   = 'fun' or @fun;        User defined size function.
hdata.args  = {arg1, arg2, etc};    Additional arguments for HDATA.FUN.

Calls to user specified functions must accept vectorised input of the
form H = FUN(X,Y,ARGS{:}), where X,Y are the xy coordinates where the
element size will be evaluated and ARGS are optional additional arguments
as passed by HDATA.ARGS.

An automatic size function is always generated to ensure that the
geometry is adequately resolved. The overall size function is the minimum
of the user specified and automatic functions.

OPTIONS is a structure array that allows some of the "tuning" parameters
used in the solver to be modified:

options.mlim   : The convergence tolerance. The maximum percentage
change in edge length per iteration must be less than
MLIM { 0.05, 5% }.
options.maxit  : The maximum allowable number of iterations { 20 }.
options.dhmax  : The maximum allowable (relative) gradient in the size
function { 0.3 }.
options.output : Displays the mesh and the mesh statistics upon
completion { TRUE }.

EXAMPLE:

meshdemo                  % Will run the standard demos
mesh_collection(n)        % Will run some additional demos

```

mesh_collection.m

```  MESH_COLLECTION: Collection of meshing examples from MESH2D users.

mesh_collection(n) will run the nth example.

1. Simple square domain. Used for "driven cavity" CFD studies.

2. Rectangular domain with circular hole. Used in thermally coupled CFD
studies to examine the flow around a heated pipe.

3. Rectangular domain with circular hole and user defined size
functions. Used in a CFD study to examine vortex shedding about
cylinders.

4. Rectangular domain with 2 circular holes and user defined size
functions. Used in a CFD study to examine the unsteady flow between
cylinders.

5. Rectangular domain with square hole and user defined size functions.
Used in a CFD study to examine vortex shedding about square prisms.

6. 3 element airfoil with user defined size functions and boundary layer
size functions. Used in a CFD study to examin the lift/drag
characteristics.

7. U shaped domain.

8. Rectangular domain with step. Used for "backward facing step" CFD
studies.

9. NACA airfoil with boundary layer size functions. Used in a CFD study
to examine the lift/drag vs. alpha characteristics.

10. Wavy channel from Kong Zour. Used in a CFD study to examine unsteady
behaviour.

11. Tray of glass beads from Falk Hebe. Used in a CFD study to examine the flow
through past a collection of beads.

12. Coastline data from Francisco Garcia. PLEASE NOTE! This is a very
complex example and takes a bit of processing time (40 sec on my
machine).

I am always looking for new meshes to add to the collection, if you would
like to contribute please send me an email with an m-file description of
the NODE, EDGE, HDATA and OPTIONS used to setup the mesh.

Darren Engwirda    : 2006-2007
Email              : d_engwirda@hotmail.com
```

meshdemo.m

``` Demo function for mesh2d.

Feel free to "borrow" any of the geometries for your own use.

Example:

meshdemo;       % Runs the demos

Darren Engwirda - 2006
```

## C:\Users\AB\DArT_Toolshed\Algorithms\MeshGeneration\Mesh2d v2.1\private

MyDelaunayn.m

checkgeometry.m

dist2poly.m

fixmesh.m

```FIXMESH  Remove duplicated/unused nodes and fix element orientation.
[P,T]=FIXMESH(P,T)
```

mytsearch.m

project2poly.m

quality.m

tinterp.m

refine.m

```  REFINE: Refine triangular meshes.

Quadtree triangle refinement is performed, with each triangle split into
four sub-triangles. The new triangles are created by joining nodes
introduced at the edge midpoints. The refinement is "quality" preserving,
with the aspect ratio of the sub-triangles being equal to that of the
parent.

UNIFORM REFINEMENT:

[p,t] = refine(p,t);

p : Nx2 array of nodal XY coordinates, [x1,y1; x2,y2; etc]
t : Mx3 array of triangles as indices, [n11,n12,n13; n21,n22,n23; etc]

NON-UNIFORM REFINEMENT:

Non-uniform refinement can also be performed by specifying which
triangles are to be refined. Quadtree refinement is performed on
specified triangles. Neighbouring triangles are also refined in order to
preserve mesh compatibility. These triangles are refined using
bi-section.

[p,t] = refine(p,t,ti);

ti : Mx1 logical array, with Ti(k) = TRUE if kth triangle is to be
refined

Functions defined on the nodes in P can also be refined using linear
interpolation through an extra input:

[p,t,f] = refine(p,t,ti,f);

f : NxK array of nodal function values. Each column in F corresponds to
a dependent function, F(:,1) = F1(P), F(:,2) = F2(P), etc.

It is often useful to smooth the refined mesh using SMOOTHMESH. Generally
this will improve element quality.

Example:

[p,t] = refine(p,t,ti);

```

smoothmesh.m

```  SMOOTHMESH: Smooth a triangular mesh using Laplacian smoothing.

Laplacian smoothing is an iterative process that generally leads to an
improvement in the quality of the elements in a triangular mesh.

[p,t] = smoothmesh(p,t);

p     : Nx2 array of nodal XY coordinates, [x1,y1; x2,y2; etc].
t     : Mx3 array of triangles as indices, [n11,n12,n13;
n21,n22,n23; etc].
maxit : Maximum allowable iterations.
tol   : Convergence tolerance (Percentage change in edge length must be
less than TOL).

If MAXIT or TOL are left empty the default values MAXIT = 20 and TOL =
0.01 are used.

EXAMPLE:

[p,t] = smoothmesh(p,t,10,0.05);

```

## C:\Users\AB\DArT_Toolshed\Algorithms\MeshGeneration\distmesh

boundedges.m

```BOUNDEDGES Find boundary edges from triangular mesh
E=BOUNDEDGES(P,T)
```

circumcenter.m

```   Copyright (C) 2004-2005 Per-Olof Persson. See COPYRIGHT.TXT for details.
```

dcircle.m

```   Copyright (C) 2004-2005 Per-Olof Persson. See COPYRIGHT.TXT for details.
```

ddiff.m

```   Copyright (C) 2004-2005 Per-Olof Persson. See COPYRIGHT.TXT for details.
```

dexpr.m

```   Copyright (C) 2004-2005 Per-Olof Persson. See COPYRIGHT.TXT for details.
```

dintersect.m

```   Copyright (C) 2004-2005 Per-Olof Persson. See COPYRIGHT.TXT for details.
```

distmesh2d.m

```DISTMESH2D 2-D Mesh Generator using Distance Functions.
[P,T]=DISTMESH2D(FD,FH,H0,BBOX,PFIX,FPARAMS)

P:         Node positions (Nx2)
T:         Triangle indices (NTx3)
FD:        Distance function d(x,y)
FH:        Scaled edge length function h(x,y)
H0:        Initial edge length
BBOX:      Bounding box [xmin,ymin; xmax,ymax]
PFIX:      Fixed node positions (NFIXx2)
FPARAMS:   Additional parameters passed to FD and FH

Example: (Uniform Mesh on Unit Circle)
fd=inline('sqrt(sum(p.^2,2))-1','p');
[p,t]=distmesh2d(fd,@huniform,0.2,[-1,-1;1,1],[]);

Example: (Rectangle with circular hole, refined at circle boundary)
fd=inline('ddiff(drectangle(p,-1,1,-1,1),dcircle(p,0,0,0.5))','p');
fh=inline('min(4*sqrt(sum(p.^2,2))-1,2)','p');
[p,t]=distmesh2d(fd,fh,0.05,[-1,-1;1,1],[-1,-1;-1,1;1,-1;1,1]);

```

distmeshnd.m

```DISTMESHND N-D Mesh Generator using Distance Functions.
[P,T]=DISTMESHND(FDIST,FH,H,BOX,FIX,FDISTPARAMS)

P:           Node positions (NxNDIM)
T:           Triangle indices (NTx(NDIM+1))
FDIST:       Distance function
FH:          Edge length function
H:           Smallest edge length
BOX:         Bounding box [xmin,xmax;ymin,ymax; ...] (NDIMx2)
FIX:         Fixed node positions (NFIXxNDIM)
FDISTPARAMS: Additional parameters passed to FDIST

Example: Unit ball
dim=3;
d=inline('sqrt(sum(p.^2,2))-1','p');
[p,t]=distmeshnd(d,@huniform,0.2,[-ones(1,dim);ones(1,dim)],[]);

```

dmatrix.m

```   Copyright (C) 2004-2005 Per-Olof Persson. See COPYRIGHT.TXT for details.
```

dmatrix3d.m

```   Copyright (C) 2004-2005 Per-Olof Persson. See COPYRIGHT.TXT for details.
```

dpoly.m

```   Copyright (C) 2004-2005 Per-Olof Persson. See COPYRIGHT.TXT for details.
```

drectangle.m

```   Copyright (C) 2004-2005 Per-Olof Persson. See COPYRIGHT.TXT for details.
```

drectangle0.m

```   Copyright (C) 2004-2005 Per-Olof Persson. See COPYRIGHT.TXT for details.
```

dsphere.m

```   Copyright (C) 2004-2005 Per-Olof Persson. See COPYRIGHT.TXT for details.
```

dunion.m

```   Copyright (C) 2004-2005 Per-Olof Persson. See COPYRIGHT.TXT for details.
```

fixmesh.m

```FIXMESH  Remove duplicated/unused nodes and fix element orientation.
[P,T]=FIXMESH(P,T)
```

hmatrix.m

```   Copyright (C) 2004-2005 Per-Olof Persson. See COPYRIGHT.TXT for details.
```

hmatrix3d.m

```   Copyright (C) 2004-2005 Per-Olof Persson. See COPYRIGHT.TXT for details.
```

huniform.m

```   Copyright (C) 2004-2005 Per-Olof Persson. See COPYRIGHT.TXT for details.
```

meshdemo2d.m

```MESHDEMO2d Distmesh2d examples.
```

meshdemond.m

```MESHDEMOND distmeshnd examples.
```

protate.m

```   Copyright (C) 2004-2005 Per-Olof Persson. See COPYRIGHT.TXT for details.
```

pshift.m

```   Copyright (C) 2004-2005 Per-Olof Persson. See COPYRIGHT.TXT for details.
```

simpplot.m

```   Copyright (C) 2004-2005 Per-Olof Persson. See COPYRIGHT.TXT for details.
```

simpqual.m

```SIMPQUAL Simplex quality.
Q=SIMPQUAL(P,T,TYPE)

TYPE == 1: Radius Ratio (default)
TYPE == 2: Approximate
```

simpvol.m

```SIMPVOL Simplex volume.
V=SIMPVOL(P,T)
```

surftri.m

```SURFTRI Find surface triangles from tetrahedra mesh
TRI=SURFTRI(P,T)
```

uniformity.m

```   Copyright (C) 2004-2005 Per-Olof Persson. See COPYRIGHT.TXT for details.
```

## C:\Users\AB\DArT_Toolshed\Algorithms\MultiScaleCorrelatedLearning\matlabfiles_aih\@tree

dataFromLayer.m

display.m

```DISPLAY Display array.
DISPLAY(X) is called for the object X when the semicolon is not used
to terminate a statement.

For example,
X = inline('sin(x)')
calls DISPLAY(X) while
X = inline('sin(x)');
does not.

A typical implementation of DISPLAY calls DISP to do most of the work
and looks as follows.  Note that DISP does not display empty arrays.

function display(X)
if isequal(get(0,'FormatSpacing'),'compact')
disp([inputname(1) ' =']);
disp(X);
else
disp(' ');
disp([inputname(1) ' =']);
disp(' ');
disp(X);
end

```
```   Overloaded methods:
opaque/display
sfit/display
tree/display
PointModelTemplate/display
AAM_Element/display
AAM/display
avifile/display
cdfepoch/display
inline/display
timer/display
serial/display
ftp/display
tscollection/display
timeseries/display
SimTimeseries/display
phytree/display
zpk/display
tf/display
ss/display
realp/display
pidstd/display
pid/display
loopswitch/display
genss/display
genmat/display
genfrd/display
daqdevice/display
daqchild/display
distributed/display
codistributor2dbc/display
codistributor1d/display
codistributed/display
gpuArray/display
qfft/display
vdspdebug/display
eclipseide/display
ccsrtdx/display
ccsdebug/display
imaqdevice/display
imaqchild/display
iviconfigurationstore/display
icgroup/display
instrument/display
network/display
frd/display
cvtest/display
cvdata/display
dataset/display
categorical/display
vrworld/display
vrnode/display
vrfigure/display
piecewisedistribution/display
gmdistribution/display
classregtree/display
ProbDist/display
NaiveBayes/display
sym/display
```
```   Reference page in Help browser
doc display
```

drawtree.m

``` function printtree(s)

A simple method that shows the general structure of your tree

Dr. A. I. Hanna (2007)
```
```   Overloaded methods:
tree/drawtree
```

get.m

```GET    Get object properties.
V = GET(H,'PropertyName') returns the value of the specified
property for the graphics object with handle H.  If H is a
vector of handles, then get will return an M-by-1 cell array
of values where M is equal to length(H).  If 'PropertyName' is
replaced by a 1-by-N or N-by-1 cell array of strings containing
property names, then GET will return an M-by-N cell array of
values.

GET(H) displays all property names and their current values for
the graphics object with handle H.

V = GET(H) where H is a scalar, returns a structure where each
field name is the name of a property of H and each field contains
the value of that property.

V = GET(0, 'Factory')
V = GET(0, 'Factory<ObjectType>')
V = GET(0, 'Factory<ObjectType><PropertyName>')
returns for all object types the factory values of all properties
which have user-settable default values.

V = GET(H, 'Default')
V = GET(H, 'Default<ObjectType>')
V = GET(H, 'Default<ObjectType><PropertyName>')
returns information about default property values (H must be
scalar).  'Default' returns a list of all default property values
currently set on H.  'Default<ObjectType>' returns only the
defaults for properties of <ObjectType> set on H.
'Default<ObjectType><PropertyName>' returns the default value
for the specific property, by searching the defaults set on H
and its ancestors, until that default is found.  If no default
value for this property has been set on H or any ancestor of H
up through the root, then the factory value for that property
is returned.

Defaults can not be queried on a descendant of the object, or on the
object itself - for example, a value for 'DefaultAxesColor' can not
be queried on an axes or an axes child, but can be queried on a figure
or on the root.

When using the 'Factory' or 'Default' GET, if PropertyName is
omitted then the return value will take the form of a
structure in which each field name is a property name and the
corresponding value is the value of that property.  If
PropertyName is specified then a matrix or string value will be
returned.

```
```   Overloaded methods:
tree/get
VolViewer/get
PointModelTemplate/get
AAM_Element/get
AAM/get
avifile/get
scribehgobj/get
scribehandle/get
hgbin/get
framerect/get
figobj/get
celltext/get
cellline/get
axistext/get
axisobj/get
axischild/get
arrowline/get
timer/get
serial/get
hgsetget/get
RandStream/get
COM/get
tscollection/get
timeseries/get
phytree/get
daqdevice/get
daqchild/get
qfft/get
imaqdevice/get
imaqchild/get
iviconfigurationstore/get
icgroup/get
icdevice/get
instrument/get
InputOutputModel/get
opcond.get
dataset/get
fdspec/get
fdmeas/get
fdline/get
fdax/get
vrworld/get
vrnode/get
vrfigure/get
```
```   Reference page in Help browser
doc get
```

get_max_levels.m

getchild.m

getchildren.m

getdata.m

```--- help for daqchild/getdata ---
```
```GETDATA Return acquired data samples from engine to MATLAB workspace.

DATA = GETDATA(OBJ) returns the number of samples specified in the
M-by-N matrix where M is the number of samples returned and N is the
number of channels in OBJ.  OBJ must be a 1-by-1 analog input object.

DATA = GETDATA(OBJ, SAMPLES) returns the specified number, SAMPLES,
of data.

[DATA, TIME] = GETDATA(OBJ) returns the number of samples specified
time-value pairs. TIME is a M-by-1 matrix where M is the number of
samples returned.

[DATA, TIME] = GETDATA(OBJ,SAMPLES) returns the specified number,
SAMPLES, of data in time-value pairs.

DATA = GETDATA(OBJ, SAMPLES, TYPE)
[DATA, TIME] = GETDATA(OBJ, SAMPLES, TYPE) allows for DATA to be
returned as the data type specified by the string TYPE.  TYPE can either
be 'double', for data to be returned as doubles, or 'native', for data
to be returned in its native data type.  If TYPE is not specified,
'double' is used as the default.

[DATA, TIME, ABSTIME] = GETDATA(...) returns the absolute time ABSTIME
of the trigger, which can also be found in OBJ's InitialTriggerTime
property.  ABSTIME is returned as a CLOCK vector.

[DATA, TIME, ABSTIME, EVENTS] = GETDATA(...) returns the structure EVENTS
which contains a log of events associated with OBJ.

GETDATA is a blocking function that returns execution control to the
MATLAB workspace once the requested number of samples become available.
OBJ's SamplesAvailable property will automatically be reduced by the
number of samples returned by GETDATA.  If the requested number of samples
is greater than the samples to be acquired, then an error is returned.

TIME=0 is defined as the point at which data logging begins, i.e., OBJ's
Logging property is set to 'On'.  TIME is measured continuously, in
seconds, with respect to 0 until the acquisition is stopped, i.e., OBJ's
Running property is set to 'Off'.

If GETDATA returns data from multiple triggers, the data from each
trigger is separated by a NaN.  This will increase the length of DATA
and TIME by the number of triggers.  If multiple triggers occur,
ABSTIME, is the absolute time of the first trigger.

It is possible to issue a ^C (Control-C) while GETDATA is blocking.  This
will not stop the acquisition but will return control to MATLAB.

```
```   Overloaded methods:
imaqdevice/getdata
```

increment_level.m

istree.m

leafCoords.m

printtree.m

```printtree( t, indent )
Print a tree whose leaves are integers.
```
```   Overloaded methods:
tree/printtree
```

set.m

```SET    Set object properties.
SET(H,'PropertyName',PropertyValue) sets the value of the
specified property for the graphics object with handle H.
H can be a vector of handles, in which case SET sets the
properties' values for all the objects.

SET(H,a) where a is a structure whose field names are object
property names, sets the properties named in each field name
with the values contained in the structure.

SET(H,pn,pv) sets the named properties specified in the cell array
of strings pn to the corresponding values in the cell array pv for
all objects specified in H.  The cell array pn must be 1-by-N, but
the cell array pv can be M-by-N where M is equal to length(H) so
that each object will be updated with a different set of values
for the list of property names contained in pn.

SET(H,'PropertyName1',PropertyValue1,'PropertyName2',PropertyValue2,...)
sets multiple property values with a single statement.  Note that it
is permissible to use property/value string pairs, structures, and
property/value cell array pairs in the same call to SET.

A = SET(H, 'PropertyName')
SET(H,'PropertyName')
returns or displays the possible values for the specified
property of the object with handle H.  The returned array is
a cell array of possible value strings or an empty cell array
if the property does not have a finite set of possible string
values.

A = SET(H)
SET(H)
returns or displays all property names and their possible values for
the object with handle H.  The return value is a structure whose
field names are the property names of H, and whose values are
cell arrays of possible property values or empty cell arrays.

The default value for an object property can be set on any of an
object's ancestors by setting the PropertyName formed by
concatenating the string 'Default', the object type, and the
property name.  For example, to set the default color of text objects
to red in the current figure window:

set(gcf,'DefaultTextColor','red')

Defaults can not be set on a descendant of the object, or on the
object itself - for example, a value for 'DefaultAxesColor' can not
be set on an axes or an axes child, but can be set on a figure or on
the root.

Three strings have special meaning for PropertyValues:
'default' - use default value (from nearest ancestor)
'factory' - use factory default value
'remove'  - remove default value.

```
```   Overloaded methods:
BioSeq/set
BioMap/set
tree/set
VolViewer/set
PointModelTemplate/set
AAM_Element/set
AAM/set
avifile/set
scribehgobj/set
scribehandle/set
framerect/set
figobj/set
editrect/set
editline/set
celltext/set
cellline/set
axistext/set
axisobj/set
axischild/set
arrowline/set
timer/set
serial/set
hgsetget/set
RandStream/set
COM/set
tscollection/set
timeseries/set
phytree/set
daqdevice/set
daqchild/set
qfft/set
imaqdevice/set
imaqchild/set
iviconfigurationstore/set
icgroup/set
icdevice/set
instrument/set
InputOutputModel/set
DynamicSystem/set
opcond.set
dataset/set
fdspec/set
fdmeas/set
fdline/set
fdax/set
vrworld/set
vrnode/set
vrfigure/set
```
```   Reference page in Help browser
doc set
```

set_max_levels.m

setchild.m

```--- help for tree/setchild ---
```
``` function T = setchild(T, indx, child)

Dr. A. I. Hanna (2007)
```

setchildren.m

setdata.m

tree.m

## C:\Users\AB\DArT_Toolshed\Algorithms\MultiScaleCorrelatedLearning\matlabfiles_aih\DataGenFunctions

cllib_blurimage.m

``` function varargout = cllib_blurimage(varargin)

Inputs
'image' - the input image
'H' - the blur mask (optional)
'hsize' - the size of the blur mask (only used if 'H' is not supplied (default = 20)
'sigma' - the std of the blur mask (only used if 'H' is not supplied (default = 10)

Outputs
'bim' - the blurred image

Example:
bim = cllib_blurimage('image', I);
subplot(1,2,1); imagesc(I); axis image;
subplot(1,2,2); imagesc(bim); axis image;

Example:
bim = cllib_blurimage('image', I, 'hsize', 10, 'sigma', 5);
subplot(1,2,1); imagesc(I); axis image;
subplot(1,2,2); imagesc(bim); axis image;

Dr. A. I. Hanna (2007)
```

cllib_embedImage.m

``` function varargout = cllib_embedImage(varargin)

Inputs
'image' - the image to embed
'horiz_border' - the number of pixels padding each side of the image
(default = 200)
'vert_border' - the number of pixels padding the top and bottom of the
image (default = 200)
'fillval' - the fill value (default = 0)

Dr. A. I. Hanna (2007)
```

cllib_genBlurredImages.m

``` function blurred_images = cllib_genBlurredImages(WINDOW_TREE, im, N)

Generates the blurred images needed by each level in the tree defined by
WINDOW_TREE.

Dr. A. I. Hanna
```

cllib_genLevelImages.m

``` function [varargout] = cllib_genLevelImages(varargin)

Generates a series of images ready for PCA

Inputs
'image' - the original input image
'N' - the number of samples to generate (default = 50)
'range' - the range of jiggle (1x2 vector) (default = [50 50])
'subsampsz' - the sub sample size (1x2 vector) (default = [16 16])
'hsize' - the size of the blurring filter (default = 20)
'theta' - the orientaion
'sigma' - the standard deviation of the blurring filter (default = 10)

Dr. A. I. Hanna (2007)
```

cllib_genSampleImage.m

``` function [varargout] = cllib_genSampleImage(varargin)

Generates an image ready for PCA

Inputs
'image' - the original input image
'window' - the window to look through
'range' - 1x2 range of translation of the image (default = [50 50])
'subsampsz' - the sub sample size (1x2 vector) (default = [16 16])
'hsize' - the size of the blurring filter (default = 20)
'sigma' - the standard deviation of the blurring filter (default = 10)

Dr. A. I. Hanna (2007)
```

cllib_genVirtualAppleScene.m

## C:\Users\AB\DArT_Toolshed\Algorithms\MultiScaleCorrelatedLearning\matlabfiles_aih\DispFunctions

cllib_drawImage.m

``` function varargout = cllib_drawImage(varargin)

Inputs:
'image' - the image to draw
'text' - the title of the image
'parent' - the parent to draw to (default = gca)

Dr. A. I. Hanna (2007)
```

cllib_drawWindow.m

``` function varargout = cllib_drawWindow(varargin)

Initializes a window for training multi-scale hierarchical piecewise
linear statistical models.

Inputs:
'window' - the window to draw
'parent' - the parent to draw to (default = gca)
'schema' - the type of plot (0 = default colour,
1 = black window, 2 = dot at centroid)

Dr. A. I. Hanna (2007)
```

cllib_moveImagesInStack.m

``` function cllib_moveImagesInStack(im_handles, offset, xdata_orig, ydata_orig)

Takes the handle to a set of images in a tree and moves them to the
position given in offset.
```

cllib_showImageStack.m

``` function varargout = cllib_showImageStack(varargin)

Dr. A. I. Hanna (2008)
```

cllib_show_result.m

``` function [varargout] = cllib_show_result(varargin)

Dr. A. I. Hanna (2007)
```

cllib_show_schema.m

``` function [varargout] = cllib_show_schema(varargin)

Dr. A. I. Hanna (2007)
```

cllib_threeImgFigure.m

drawEdge.m

drawnode.m

drawtree.m

``` function printtree(s)

A simple method that shows the general structure of your tree

Dr. A. I. Hanna (2007)
```
```   Overloaded methods:
tree/drawtree
```

plotParameterModel.m

``` function varargout = genParameterModel(varargin)

Dr. A. I. Hanna (2007)
```

## C:\Users\AB\DArT_Toolshed\Algorithms\MultiScaleCorrelatedLearning\matlabfiles_aih\Hebbian

generalized_hebbian.m

``` function varargout = generalized_hebbian(varargin)

This is the generalized hebbian algorithm (GHA) as given by Haykin. In
this algorithm we are performing a Gram-Schmidt ish approach to
processing the data. In other words we are removing the component of the
weights from the data in turn.

"Neural Networks, A Comprehensive Foundation", 2nd ed, S. Haykin, page 414

Inputs:
'X' - the input data
'W' - the weight matrix
'eta' - the learning rate

Outputs:
'Y' - the output from the network
'W' - the updated weight matrix

Example:

generalized_hebbian('demo', 1);

Dr. A. I. Hanna (2007)
```

hebbian.m

``` function varargout = hebbian(varargin)

A Matlab function that performs Hebbian learning on a data set.
```

## C:\Users\AB\DArT_Toolshed\Algorithms\MultiScaleCorrelatedLearning\matlabfiles_aih\IOFunctions

``` function varargout = cllib_loadImage(varargin)

Inputs:
'filename' - the name of the image to load
'scale' - the scale of the image to return (default = 1)

Outputs:
'image' - the image

Dr. A. I. Hanna (2007)
```

``` function images = cllib_loadImagesFromDir(varargin)

A method that loads a series of images from disk.

Input Parametes:

'scale' - the scaling factor of the image i.e. scale = 0.5 would half the
size of the image. (Images should be approx 512x512)

Example 1:

Example 2:

Dr. A. I. Hanna, CMP, UEA, 2007.
```

``` function varargout = cllib_loadResult(varargin)

Inputs:
'filename' - the name of the image to load

Outputs:
'model' - the model

Dr. A. I. Hanna (2007)
```

cllib_saveTestResult.m

``` function cllib_saveTestResult(varargin)

% model is created by cllib_test

cllib_saveTestResult('model', model);

Dr. A. I. Hanna, CMP, UEA, 2007.
```

## C:\Users\AB\DArT_Toolshed\Algorithms\MultiScaleCorrelatedLearning\matlabfiles_aih\ModelFunctions

cllib_applyLevelResponse.m

``` function model = cllib_applyLevelResponse(model, level_response, level_id)

Dr. A. I. Hanna (2007)
```

cllib_applyResidualResponse.m

``` function model = cllib_applyResidualResponse(model, level_response, level_id)

Dr. A. I. Hanna, CMP, UEA, 2007.
```

cllib_applyResponse.m

cllib_buildTree.m

``` function [varargout] = cllib_buildTree(varargin)

Builds an empty tree ready for population by other methods in cllib.

Dr. A. I. Hanna (2007)
```

cllib_build_shapp_model.m

``` function cllib_build_shapp_model

Builds a shapperance model.

1) Prompts user for the filename where the model should be saved on disk.
2) Asks the user to select result files generated by track_image_series.
3) To walk through the shappearance model use cllib_walk_shapp_model

Example

cllib_build_shapp_mod

Dr. A. I. Hanna, CMP, UEA, 2007.
```

cllib_build_window_shape_model.m

``` function [window_app_model] = cllib_build_window_shape_model(images)

Takes a cell array of results where each

Dr. A. I. Hanna, CMP, 2008.
```

cllib_calcAppModel.m

``` function [varargout] = cllib_calcAppModel(varargin)

Inputs:
'data' - a NxM matrix of input data where each column is an observation
'pc_ind' - the 1xN vector of PC indices used in the model (default = [1 2])

Dr. A. I. Hanna (2007)
```

cllib_createModel.m

``` function varargout = cllib_createModel(varargin)

Creates and saves a model for a particular image.

Usage:
cllib_createModel;

Dr. A. I. Hanna, CMP & JIC, 2008.
```

cllib_estimateLevelResponses.m

``` function [model, level_est] = cllib_estimateLevelResponses(model, level_id, test_image, model_id)

Dr. A. I. Hanna, CMP & JIC, 2008.
```

cllib_estimateModelResponses.m

``` function [model] = cllib_estimateModelResponses(model, level_id, test_image)

Dr. A. I. Hanna, CMP, UEA, Norwich, UK, 2007.
```

cllib_estimateWindowResponse.m

``` function [window] = cllib_estimateWindowResponse(img, window, model_id, levelmodel)

Takes an image and a window and calculates the response given a
particular model.

Dr. A. I. Hanna (2007)
```

cllib_genParameterModel.m

``` function varargout = genParameterModel(varargin)

Dr. A. I. Hanna (2007)
```

cllib_makeParamModel.m

cllib_mergeModels.m

cllib_param2response.m

cllib_paramInference.m

cllib_test.m

``` function [varargout] = cllib_test(varargin)

Dr. A. I. Hanna (2007)
```

cllib_train.m

``` function [varargout] = cllib_train(varargin)

Builds a tree structure at all levels by finding correlations between
appreance models and response amplitudes.

Dr. A. I. Hanna (2007)
```

cllib_trainlevel.m

``` function [varargout] = cllib_trainlevel(varargin)

Trains a particular level of the tree using a specified image.

Dr. A. I. Hanna (2007)
```

cllib_tree2pointmodel.m

``` function  [pm, id] = cllib_tree2pointmodel(T, level, pm, id)

Given a tree it returns a matrix where each row represents the centroid
of window.

Dr. A. I. Hanna (2007)
```

cllib_walk_shapp_model.m

``` function cllib_walk_shapp_model

Walks along a shappearance model that you select.

1) Prompts the user to open a shappearance model and displays a walk
along the first 3 pcs from -3 SD and +3 SD.

Example:

cllib_walk_shapp_model

Dr. A. I. Hanna, CMP, UEA, 2007.
```

## C:\Users\AB\DArT_Toolshed\Algorithms\MultiScaleCorrelatedLearning\matlabfiles_aih\WindowFunctions

cllib_calcRectOverlap.m

cllib_dispWindowImage.m

``` function varargout = cllib_dispWindowImage(varargin)

'window'
'level_id'
'window_im'

Dr. A. I. Hanna (2007)
```

cllib_drawInformativeWindows.m

``` function T = cllib_drawInformativeWindows(T, level)

Draws all the informative windows for a given tree.

Dr. A. I. Hanna (2007)
```

cllib_getAllWindows.m

cllib_getInformativeWindows.m

``` function infwins = cllib_getInformativeWindows(T, infwins, level)

Dr. A. I. Hanna (2007)
```

cllib_getWindowRect.m

cllib_image2windowview.m

``` function varargout = cllib_image2windowview(varargin)

'image'
'window'

Dr. A. I. Hanna (2007)
```

cllib_initWindow.m

``` function window = cllib_initWindow(varargin)

Initializes a window for training multi-scale hierarchical piecewise
linear statistical models.

Inputs
'window_size' - the size of the window (1x2 vector) (default = [100 100])
'color' - the colour of the window (1x3 vector) (default = [1 0 0])
'sub_samp_size' - the sub sample size of this window to apply to images (default = [32 32])
'mu' - the centroid of the window (1x2 vector) (default = [0 0])
'mean_response' - mean response of the window, i.e. movement x, y, z (default = [0 0])

Dr. A. I. Hanna (2007)
```

cllib_moveTree.m

``` function T = cllib_moveTree(T, pos)

Moves the tree to position pos

Dr. A. I. Hanna (2007)
```

cllib_setInformativeWindows.m

cllib_setWindowPositions.m

```T = model.WINDOW_TREE;
```

cllib_splitWindow.m

``` function varargout = cllib_splitWindow(varargin)

Splits a window into quarters and returns each of the subwindows

Inputs
'window' - the window to be split

Outputs
'subwindows' - a cell array containing the four sub windows.%

Dr. A. I. Hanna (2007)
```

cllib_splitWindow1d.m

``` function varargout = cllib_splitWindow1d(varargin)

Splits a window into quarters and returns each of the subwindows

Inputs
'window' - the window to be split

Outputs
'subwindows' - a cell array containing the four sub windows.%

Dr. A. I. Hanna (2007)
```

cllib_splitWindow2d.m

``` function varargout = splitWindow2d(varargin)

Splits a window into quarters and returns each of the subwindows

Inputs
'window' - the window to be split

Outputs
'subwindows' - a cell array containing the four sub windows.%

Dr. A. I. Hanna (2007)
```

cllib_translateChildren.m

``` function T = cllib_translateChildren(T, level, trans)

Translates all the children from T down by trans

Dr. A. I. Hanna (2007)
```

cllib_translateWindow.m

``` function varargout = cllib_translateWindow(varargin)

Translates a window in the xy plane

Inputs
'window' - the window to be translated
'offset' - the offset (1x2 vector) (default = [0 0])

Outputs
'window' - the translated window

Dr. A. I. Hanna (2007)
```

cllib_updateChildrenInf.m

cllib_windowOverlap.m

cllib_zeroAllWindows.m

## C:\Users\AB\DArT_Toolshed\Algorithms\Segmentation\LevelSets

active_contour_chan_vese2d.m

``` function varargout = active_contour_chan_vese2d(varargin)

A method that implements the Chan-Vese model applied to image
segmentation. This model is a special case of the Mumford-Shah model and
it tries to separate the image into regions based on intensities.

Default parameters:

'image' - the input image (default = 'pout.tif')
'phi' - the initial distance function (default = circular disk)
'lambda1' - weight of energy inside the contour (default = 0.5)
'lambda2' - weight of energy outside the contour (default = 0.5)
'mu' - weighting for the length of the contour (default = 1)
'nu' - weighting of area of the contour (default = 1)
'deltaT' - step size for the update of phi (default = 0.5, note: 0.01<=deltaT<=0.9)
'verbose' - shows the evolution of the curve phi (default = 0)
'max_iter' - the maximum number of iterations to perform (default = 10)
'normforceflag' - normalizes the force term at every iteration (default = 1)

Example:

active_contour_chan_vese2d('verbose', 1);

Paper: "Minimizing Functionals: A Level Set Approach", A. I. Hanna, School of Computing Sciences, University of East Anglia, 2007.
URL: http://www2.cmp.uea.ac.uk/~aih/papers/MinimizingFunctionalsUsingLevelSets/MinimizingFunctionals-ALevelSetApproach_hanna.pdf

Dr. A. I. Hanna (2007)
```

active_contour_chan_vese3d.m

``` function varargout = active_contour_chan_vese3d(varargin)

A method that implements the Chan-Vese model applied to volume
segmentation. This model is a special case of the Mumford-Shah model and
it tries to separate the volume into sub-volumes based on intensities.

Default parameters:

'volume' - the input volume
'phi' - the initial distance function (default = circular disk)
'lambda1' - weight of energy inside the contour (default = 0.5)
'lambda2' - weight of energy outside the contour (default = 0.5)
'mu' - weighting for the length of the contour (default = 1)
'nu' - weighting of area of the contour (default = 1)
'deltaT' - step size for the update of phi (default = 0.5, note: 0.01<=deltaT<=0.9)
'verbose' - shows the evolution of the curve phi (default = 0)
'max_iter' - the maximum number of iterations to perform (default = 10)
'normforceflag' - normalizes the force term at every iteration (default = 1)

Example:

active_contour_chan_vese3d('verbose', 1);

Paper: "Minimizing Functionals: A Level Set Approach", A. I. Hanna, School of Computing Sciences, University of East Anglia, 2007.
URL: http://www2.cmp.uea.ac.uk/~aih/papers/MinimizingFunctionalsUsingLevelSets/MinimizingFunctionals-ALevelSetApproach_hanna.pdf

Dr. A. I. Hanna (2007)
```

## C:\Users\AB\DArT_Toolshed\Algorithms\Segmentation\LevelSets\images

lsShowResult.m

```phi = load('../Results/leaf_phi_128_128_128.mat');
phi = phi.phi;
phi = smooth3(phi);
```

lsdemo_2d.m

``` function lsdemo_2d(im_opt)

Usage:
lsdemo_2d(opt_id); % opt_id = 1, 2, 3, 4

Dr. A. I. Hanna (2007)
```

lsdemo_3d.m

lsdispVolume.m

``` function dispVolume(cdata, axish)

A very very simple script to display a set of volume data

Dr. A. I. Hanna (2006
```

## C:\Users\AB\DArT_Toolshed\Algorithms\Segmentation\LevelSets\volumes\Leaf

alglib_flo_spots.m

``` function [NUM, c, L] = alglib_flo_spots(I)

Segments out flo spots in images

Dr. A. I. Hanna (2008)
```

alglib_white_spots.m

``` function [NUM, c, L] = alglib_white_spots(I, I2)

Segments out white spots in images

Dr. A. I. Hanna (2008)
```

cells_SEM.m

```%%%%%%%%%%%%%%%%%%%%

Process the cell image

%%%%%%%%%%%%%%%%%%%%%
```

segment_DAPI.m

``` function [bim] = segment_DAPI(varargin)

A script used to segment DAPI images. Typically these images are tif
images with a single channel.

Dr. A. I. Hanna, CMP, 2008.
```

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\32-bit

runme.m

```RUNME Summary of this function goes here
Detailed explanation goes here
```

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\64-bit

SIEVE4.M

``` function [Y1 Y2 ... Yn] = sieve(X, options, outputs, scan, type, time)

Apply recursive median datasieve to matrix X with complete control of
polarity (sign of recorded granules or edges) and bias (sign of filtered
extrema) at each mesh.  If X is a matrix then the columns of X are sieved
separately.  The scan argument controls the orientation of the sieve for
angles to the vertical in the range 0 to 45 degrees (all other angles can
be obtained by transposing or flipping the input data matrix).

The OPTIONS matrix is of size m*4 and each row contains the following data:

[maxmesh polarity bias output]

Thus meshes up to maxmesh are processed with the specified polarity and
bias parameters, and the results are stored according to the output
parameter.  The polarity and bias parameters are set using:

0  : Bipolar operation.
-1  : Process negative events.
+1  : Process positive events.

Note that polarity constraints are a subset of bias constraints - a polarity
of -1 means that only negative granules are recorded (but both positive and
negative extrema are processed), while a bias of -1 means that only negative
extrema are processed.

The output parameter specifies the number of the output argument (1 to n)
or 0 for no output.  The setting of the corresponding value in the OUTPUTS
vector determines the form of the output.

The OUTPUTS vector if a string containing the symbols 'l','b','g','e','s'.
These are concatenated into a string, for example 'lbbe'.  The k'th element
in the string corresponds to the k'th output argument, Yk.  The meaning of
the symbols is as follows:

'l' : Lowpass   - Lowpass image at output of mesh maxmesh
'b' : Bandpass  - Bandpass image from granules at processed meshes.
'g' : Granules  - Granules list from processed meshes.
'e' : Edge map  - Edge map formed from granule edges and amplitudes.
's' : Sobel map - Edgemap with post processing to emulate sobel filter.

The SCAN parameter is a two element vector of integers that determines the
orientation of the sieving.  The angle at which the sieve is applied
relative to the vertical is given in terms of the input vector [k1 k2] as
atan((k1+k2)/2).  So for k1=k2=1, the scan is at 45 degs. For k1=1, k2=2,
the scan is at 34 degs.  For k1, k2 > image dimension the scan is vertical.
Note that k1, k2 must be positive integers (so not all angles are possible).
Normally, k1 and k2 should be equal or differ by 1.

Note that the scan lines to which sieves are applied are guaranteed to be
non-overlapping.  However, this means that the gap between samples on a 45
degree scan is sqrt(2) times the normal sample spacing, which should be
taken into account when specifying 'cut-off' meshes etc.

The TYPE parameter specifies whether the data is integer or double precision.
It is a string that can be set to 'int' or 'double'.  If 'int' is specified,
then the user is responsible for ensuring that the data range does not
exceed a 32 bit signed integer.  If the data is not integer than it is
rounded using a 'C' cast. Integer precision is faster than double precision.
Double is default.

The TIME parameter is set to 1 to display elapsed user time while performing
processing.  It excludes memory allocation overheads.  The default is 0.

EXAMPLE:

[Y1 Y2 Y3] = sieve(X, OPTIONS, OUTPUTS, [1 1])

with OPTIONS = [ 4  0  0  1   and OUTPUTS = 'lbb'
16 +1  0  2
32  0  0  0
64  0  0  3]

returns Y1 = low pass image after initial noise reduction up to mesh 4.
Y2 = bandpass image containing positive granules for meshes 5 to 16.
Y3 = bandpass image containing all granules for meshes 33 to 64.

using scan lines at 45 degrees to vertical.

Robert Young   13 October 1994
```

sieve2d.m

``` FILE
sieve2d.m

AUTHOR
rwy Cambridge Consultants (project leader J.A. Bangham, UEA)

MODIFICATION HISTORY

1.1	02:jun:95	rwy	First version submitted to SCCS.
1.2	26:jun:95	rwy	Extended for open, close, M & N sieves.
1.3	27:jul:95	rwy	Allows bandpass outputs & granule fusing
1.4	03:aug:95	rwy	Minor revision.
1.5	09:aug:95	rwy	Added granule output.
1.6	14:sep:95	rwy	Added edge map output.
2.0 01/01/2013  jab Updated to 64 bit and includes additional outputs

SCCS IDENTIFIER
@(#)sieve2d.m	1.6 9/14/95
@(#)SIV2d.m	2.0 01/01/2013

[Y1 Y2 ... Ym] = sieve2d(X, [M1 M2 ... Mn], 'F1F2 ... Fn',
[O1 O2 ... On], type, N)

Perform a 2-D connected-set datasieve based on area.

X	:	input image
Mk	:	maximum mesh for each filter
Fk	:	filter type  (m, o, c, M or N)	[default: m]
Ok	: 	output index for each filter    [default: 1 for last filter]
type  :	output type  (l, b, e or f)	[default: l]
N	:	connectivity (4 or 8)           [default: 4]
Yj	:	output image from a filter

The input image is processed using one or more filters Fk, applied
sequentially, up to the associated maximum meshes Mk.  The available
filters are:

m     :	median     (maxima & minima processed in arbitrary order)
o     : 	opening    (only maxima processed)
c     : 	closing    (only minima processed)
M     : 	open-close (maxima then minima processed at each scale)
N     : 	close-open (minima then maxima processed at each scale)

For each filter, the result may optionally be output by specifying the
index of the desired output argument as the input Ok (where Ok=1 represents
the first output argument).  If Ok=0 then no output is generated
for filter Fk.

The available output types are:

l	:	low-pass
b	:	band-pass
f	:	band-pass with granule fusing
e  	:	band-pass, returning edge map
g	:	granule list

where the band-pass output is the difference between the outputs of the
current filter and the previous filter (or the input image) in the
sequence of filters.  The same output type must be used for each filter.

The granule output list format is a vector containing the following data:

[image_vdim image_hdim gran1_len gran1_val gran1_pos gran2_len ...]

where gran?_pos is a list of the positions of the granule pels within
the image (one scalar index per pel).

Note that producing multiple low or band pass outputs in this way is much
more efficient than calling the sieve function several times with different
meshes.

Memory requirements are about 18 bytes per image pel.

EXAMPLES:

Filter up to mesh 100 using a median sieve, and generate a low pass output:

Y = sieve2d(x, 100)
or 	Y = sieve2d(x, 100, 'm')
or	Y = sieve2d(x, 100, 'm', 1)
or	Y = sieve2d(x, 100, 'm', 1, 'l')

Filter up to mesh 10 using a median sieve, then up to mesh 100 using an
opening operator, and output the band pass signal between meshes 11 and 100:

Y = sieve2d(x, [10 100], 'mo', [0 1], 'b')

Form a sequence of low pass outputs using closing operators:

[Y1 Y2 Y3 Y4] = sieve2d(x, [8 16 32 64], 'cccc', [1 2 3 4])

As above, with initial noise reduction using a median filter:

[Y1 Y2 Y3 Y4] = sieve2d(x, [4 8 16 32 64], 'mcccc', [0 1 2 3 4])

As above, but producing band pass outputs with granule fusing:

[Y1 Y2 Y3 Y4] = sieve2d(x, [4 8 16 32 64], 'mcccc', [0 1 2 3 4], 'f')
```

sieve3d.m

``` FILE
sieve3d.m

AUTHOR
rwy (JAB)

MODIFICATION HISTORY

1.3 Dec:1010    JAB Exploit 64 bit by extending int to __int64
It does handle 512x512x512 images but needs >8Gbytes memory
to avoid being very slow

input image is uint8
outputs are all double

1.1	03:aug:95	rwy	jab First version submitted to SCCS.
1.2	04:aug:95	rwy	Added depth resolution.

SCCS IDENTIFIER
@(#)sieve3d.m	1.2 8/4/95

[Y1 Y2 ... Ym] = sieve3d(X, [depth Dres], [M1 M2 ... Mn], 'F1F2 ... Fn',
[O1 O2 ... On], type, N)

Perform a 3-D connected-set datasieve based on volume.

X	:	input image
depth	:	image depth  (scalar)
Dres	:	resolution in depth dimension 	[default: 1]
Mk	:	maximum mesh for each filter
Fk	:	filter type  (m, o, c, M or N)	[default: m]
Ok	: 	output index for each filter    [default: 1 for last filter]
type  :	output type  (l, b or f)	[default: l]
N	:	connectivity (only 6 currently) [default: 6]
Yj	:	output image from a filter

The input 3D image is supplied as a 2D matrix, X, in which the successive
2D slices at each depth are appended to the input matrix as new columns.
So if the matrices for the slices are S1, S2, S3 ... Sd then:

X = [S1 S2 S3 ... Sd]	and   depth = d

Currently, 3D volumes are 6-connected using the four 4-connected pels in the
same slice, and the pel in the same location within each of the two adjacent
slices.

The resolution in the depth dimension can be specified relative to the
resolution within each slice.  This is achieved by setting the Dres input
parameter to an integer greater than 1, in order to simulate a depth
resolution that is coarser by a factor Dres.  The 'volume' of each region
is increased by adding an extra Dres-1 units for each connection that
exists between pels on different slices.  Thus, a region of N pels all in the
same slice has a volume N, while a line of N pels all on different slices
has a volume N + (N-1)*(Dres-1).

The input image is processed using one or more filters Fk, applied
sequentially, up to the associated maximum meshes Mk.  The available
filters are:

m     :	median     (maxima & minima processed in arbitrary order)
o     : 	opening    (only maxima processed)
c     : 	closing    (only minima processed)
M     : 	open-close (maxima then minima processed at each scale)
N     : 	close-open (minima then maxima processed at each scale)

For each filter, the result may optionally be output by specifying the
index of the desired output argument as the input Ok (where Ok=1 represents
the first output argument).  If Ok=0 then no output is generated
for filter Fk.

The available output types are:

l	:	low-pass
b	:	band-pass
f	:	band-pass with granule fusing

where the band-pass output is the difference between the outputs of the
current filter and the previous filter (or the input image) in the
sequence of filters.  The same output type must be used for each filter.

Note that producing multiple low or band pass outputs in this way is much
more efficient than calling the sieve function several times with different
meshes.

Memory requirements are about 18 bytes per image pel.

EXAMPLES:

Filter an image composed of 50 slices up to mesh 100 using a median sieve,
and generate a low pass output:

Y = sieve3d(x, 50, 100)
or 	Y = sieve3d(x, 50, 100, 'm')
or	Y = sieve3d(x, 50, 100, 'm', 1)
or	Y = sieve3d(x, 50, 100, 'm', 1, 'l')
or	Y = sieve3d(x, [50 1], 100, 'm', 1, 'l')

Filter up to mesh 10 using a median sieve, then up to mesh 100 using an
opening operator, and output the band pass signal between meshes 11 and 100.
The resolution in the depth dimension is 3 times coarser than the
resolution
within each slice:

Y = sieve3d(x, [50 3], [10 100], 'mo', [0 1], 'b')

Form a sequence of low pass outputs using closing operators:

[Y1 Y2 Y3 Y4] = sieve3d(x, 50, [8 16 32 64], 'cccc', [1 2 3 4])

As above, with initial noise reduction using a median filter:

[Y1 Y2 Y3 Y4] = sieve3d(x, 50, [4 8 16 32 64], 'mcccc', [0 1 2 3 4])

As above, but producing band pass outputs with granule fusing:

[Y1 Y2 Y3 Y4] = sieve3d(x, 50, [4 8 16 32 64], 'mcccc', [0 1 2 3 4],'f')
```

Bags.m

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve

ArrowRegions.m

ConnectedSets.m

MakeQuantiserTable.m

QuantiseDensity.m

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve\SIV_test_20130410

SieveCTScans.m

``` Program name: SieveCTScans
Authors: GDT + PS
Date:     15/09/2011
```

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve\Snapshots

checkbox_isometric.m

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve\directory_of_images_for_SIV

displayRegion_Graph_Vertex.m

display_Region_Graph_Vertex.m

extremalMSERUtility2.m

```function [ imOut, granules, regions ] = extremalMSERUtility2( ( N ,siz, positions,diameters,graded) )

To be compatible with ConnectedSets.m (i.e. the plotting axis)

data.showText

Display a tree representation of a greyscale im
```

extremalTree.m

```function [ imOut, granules, regions ] = extremalTree( ( N ,siz, positions,diameters,graded) )

Display a tree representation of a greyscale im
```

extremalTreeFig.m

extremalTreeUtility.m

```function [ imOut, granules, regions ] = extremalTreeUtility( ( N ,siz, positions,diameters,graded) )

data.showText

Display a tree representation of a greyscale im
```

extremalTreeUtility2 - Copy.m

```function [ imOut, granules, regions ] = extremalTreeUtility2( ( N ,siz, positions,diameters,graded) )

To be compatible with ConnectedSets.m (i.e. the plotting axis)

data.showText

Display a tree representation of a greyscale im
```

extremalTreeUtility2.m

```function [ imOut, granules, regions ] = extremalTreeUtility2( ( N ,siz, positions,diameters,graded) )

To be compatible with ConnectedSets.m (i.e. the plotting axis)

data.showText

Display a tree representation of a greyscale im
```

quantise_uint8_im.m

saveCurrentStateSIV.m

showGranules.m

```function showGranules

Toggle views of significant granules
```

showTheText.m

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve\sieveCode

sieveSect.m

``` Program name: SIEVESECT
Authors: GDT + PS
Date:     15/09/2011
```

siv2d_m.m

``` [Y1 Y2 ... Ym] = siv2d_m(X, [M1 M2 ... Mn], 'F1F2 ... Fn',
[O1 O2 ... On], type, N, Levels)

CALLS the mex code SIV2d.* To get a sequence of outputs call SIVE2d directly

Perform a 2-D connected-set datasieve based on area.

X	    :	uint8, input image
Mk	:	maximum mesh (scale, area of extrema) for each filter
Fk	:	filter type  (m, o, c, M or N)	[default: m]
Ok	: 	output index for each filter    [default: 1 for last filter]
type  :	type of output  (l, b, e, g, f or v)	[default: l]
N	    :	connectivity (4 or 8)           [default: 4]
EP    :   parameters for selecting extrema [Levels,Ratio]
Levels :   number of finite levels in image [default: 256]
Ratio  :   typically 5 [default: 1]
MinArea:   typically 4 [default: 1]
MaxArea:   typically 1000 [default: 1000]
MinAmp :   typically 4 [default: 0]

Yj	:	output image(j) from a filter

FILTERS
The input image is processed using one or more filters Fk, applied
sequentially, up to the associated maximum meshes Mk.  The available
filters are:

m     :	median     (maxima & minima processed in arbitrary order)
o     : 	opening    (only maxima processed, c.f. maximally stable extreme regions )
c     : 	closing    (only minima processed, c.f. maximally stable extreme regions)
M     : 	open-close (maxima then minima processed at each scale)
N     : 	close-open (minima then maxima processed at each scale)

For each filter, the result may optionally be output by specifying the
index of the desired output argument as the input Ok (where Ok=1 represents
the first output argument).  If Ok=0 then no output is generated
for filter Fk.

TYPE OF OUTPUT
The available output types are:

l	:	low-pass
b	:	band-pass
f	:	band-pass with granule fusing
e :	band-pass, returning edge map
g	:	granule list
v :   verbose, i.e. main data structure of engine

where the band-pass output is the difference between the outputs of the
current filter and the previous filter (or the input image) in the
sequence of filters.  The same output type must be used for each filter.

The granule output list format is a cell array containing the following data:
For example:
Number: 3 (number of granules)
area: [1 5 9]
value: [18 7 11]
level: [255 237 230]
deltaArea: [4 4 4]
last_area: [400 80 44]
root: [76 76 76]
PictureElement: {  [77 94 60 78 76]  [77 95 61 93 59 94 60 78 76]}

e.g.  data.g.PictureElement{3} contains indexes to the pixels that formed the granule

Note that producing multiple low or band pass outputs in this way is much
more efficient than calling the sieve function several times with different
meshes.

Memory requirements are about 18 bytes per image pel.

EXAMPLES:

Filter up to mesh 100 using a median sieve, and generate a low pass output:

Y = SIV2d(x, 100)
or 	Y = SIV2d(x, 100, 'm')
or	Y = SIV2d(x, 100, 'm', 1)
or	Y = SIV2d(x, 100, 'm', 1, 'l')
or	Y = SIV2d(x, 100, 'm', 1, 'l',4)
or	Y = SIV2d(x, 100, 'm', 1, 'l',4,[256,4,5])

Filter up to mesh 10 using a median sieve, then up to mesh 100 using an
opening operator, and output the band pass signal between meshes 11 and 100:

Y = SIV2d(x, [10 100], 'mo', [0 1], 'b')

Form a sequence of low pass outputs using closing operators:

[Y1 Y2 Y3 Y4] = SIV2d(x, [8 16 32 64], 'cccc', [1 2 3 4])

As above, with initial noise reduction using a median filter:

[Y1 Y2 Y3 Y4] = SIV2d(x, [4 8 16 32 64], 'mcccc', [0 1 2 3 4])

Outputting granules (extrema) from an image with a maximum of 64 levels
and a selection ratio of 4:

Extrema = SIV2d(x, [4 8 16 32 64], 'mcccc', [0 1 2 3 4], 'g',[64,4])

FILE
SIV2d/SIV2d.m

AUTHOR
rwy Cambridge Consultants (project leader and algorithms J.A. Bangham, UEA)

MODIFICATION HISTORY

1.1	02:jun:95	rwy	First version submitted to SCCS.
1.2	26:jun:95	rwy	Extended for open, close, M & N sieves.
1.3	27:jul:95	rwy	Allows bandpass outputs & granule fusing
1.4	03:aug:95	rwy	Minor revision.
1.5	09:aug:95	rwy	Added granule output.
1.6	14:sep:95	rwy	Added edge map output.
2.0 01/01/2013  jab Updated to 64 bit and includes additional outputs

SVN IDENTIFIER
sieve2d.m	1.6 9/14/95
SIV2d.m	2.0 01/01/2013

```

test.m

```      [X,Y]=ind2sub(size(imOut),find(imOut>-1));
X=reshape(X,size(imOut));
Y=reshape(Y,size(imOut));
surf(X,Y,double(imOut)/256,'EdgeColor','none');
```
```   Overloaded methods:
classregtree/test
```

testCard.m

```function [ im, granules, regions ] = testCard( verbose,N,siz, positions,diameters,graded,amplitudeverbose)

N, number of objects
siz, rectangle with edges of length siz
positions, positions as a fraction of siz, N rows of x,y; pairs
diameters, diameters of spots as fraction of siz, N rows. If negative a quarter arc.
amplitude, amplitude as fraction of half intensity (the backround). Minus denonotes minima
graded, true means spots will be intensity cones, false uniform spots

im resulting image
regions, list of N regions
regions(i).x
regions(i).y
regions(i).diameter
Usage
[imOut,granules]=testCard(1,7,[0.5,0.5],0.5,true)

imOut=5*ones(7,7);imOut(2:3,2)=1;imOut(2,5:6)=10;imOut(4,5:6)=12;imOut(6,4:6)=13;imOut(2,3)=7;imOut(4,2)=7
v=sieve2d(imOut,5,'o',1,'v',4,1);
```

verboseSieve2d.m

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve - Copy

displayRegion_Graph_Vertex.m

display_Region_Graph_Vertex.m

extremalTree.m

```function [ imOut, granules, regions ] = extremalTree( ( N ,siz, positions,diameters,graded) )

Display a tree representation of a greyscale im
```

extremalTreeUtility.m

```function [ imOut, granules, regions ] = extremalTreeUtility( ( N ,siz, positions,diameters,graded) )

data.showText

Display a tree representation of a greyscale im
```

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve - Copy\sieveCode

testCard.m

```function [ im, granules, regions ] = testCard( verbose,N,siz, positions,diameters,graded,amplitudeverbose)

N, number of objects
siz, rectangle with edges of length siz
positions, positions as a fraction of siz, N rows of x,y; pairs
diameters, diameters of spots as fraction of siz, N rows. If negative a quarter arc.
amplitude, amplitude as fraction of half intensity (the backround). Minus denonotes minima
graded, true means spots will be intensity cones, false uniform spots

im resulting image
regions, list of N regions
regions(i).x
regions(i).y
regions(i).diameter
Usage
[imOut,granules]=testCard(1,7,[0.5,0.5],0.5,true)

imOut=5*ones(7,7);imOut(2:3,2)=1;imOut(2,5:6)=10;imOut(4,5:6)=12;imOut(6,4:6)=13;imOut(2,3)=7;imOut(4,2)=7
v=sieve2d(imOut,5,'o',1,'v',4,1);
```

verboseSieve2d.m

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve - Copy (2)

displayRegion_Graph_Vertex.m

display_Region_Graph_Vertex.m

extremalTree.m

```function [ imOut, granules, regions ] = extremalTree( ( N ,siz, positions,diameters,graded) )

Display a tree representation of a greyscale im
```

extremalTreeUtility.m

```function [ imOut, granules, regions ] = extremalTreeUtility( ( N ,siz, positions,diameters,graded) )

data.showText

Display a tree representation of a greyscale im
```

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve - Copy (2)\sieveCode

test.m

```      [X,Y]=ind2sub(size(imOut),find(imOut>-1));
X=reshape(X,size(imOut));
Y=reshape(Y,size(imOut));
surf(X,Y,double(imOut)/256,'EdgeColor','none');
```
```   Overloaded methods:
classregtree/test
```

testCard.m

```function [ im, granules, regions ] = testCard( verbose,N,siz, positions,diameters,graded,amplitudeverbose)

N, number of objects
siz, rectangle with edges of length siz
positions, positions as a fraction of siz, N rows of x,y; pairs
diameters, diameters of spots as fraction of siz, N rows. If negative a quarter arc.
amplitude, amplitude as fraction of half intensity (the backround). Minus denonotes minima
graded, true means spots will be intensity cones, false uniform spots

im resulting image
regions, list of N regions
regions(i).x
regions(i).y
regions(i).diameter
Usage
[imOut,granules]=testCard(1,7,[0.5,0.5],0.5,true)

imOut=5*ones(7,7);imOut(2:3,2)=1;imOut(2,5:6)=10;imOut(4,5:6)=12;imOut(6,4:6)=13;imOut(2,3)=7;imOut(4,2)=7
v=sieve2d(imOut,5,'o',1,'v',4,1);
```

verboseSieve2d.m

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve - Copy (3)

displayRegion_Graph_Vertex.m

display_Region_Graph_Vertex.m

extremalTree.m

```function [ imOut, granules, regions ] = extremalTree( ( N ,siz, positions,diameters,graded) )

Display a tree representation of a greyscale im
```

extremalTreeUtility.m

```function [ imOut, granules, regions ] = extremalTreeUtility( ( N ,siz, positions,diameters,graded) )

data.showText

Display a tree representation of a greyscale im
```

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve - Copy (3)\sieveCode

test.m

```      [X,Y]=ind2sub(size(imOut),find(imOut>-1));
X=reshape(X,size(imOut));
Y=reshape(Y,size(imOut));
surf(X,Y,double(imOut)/256,'EdgeColor','none');
```
```   Overloaded methods:
classregtree/test
```

testCard.m

```function [ im, granules, regions ] = testCard( verbose,N,siz, positions,diameters,graded,amplitudeverbose)

N, number of objects
siz, rectangle with edges of length siz
positions, positions as a fraction of siz, N rows of x,y; pairs
diameters, diameters of spots as fraction of siz, N rows. If negative a quarter arc.
amplitude, amplitude as fraction of half intensity (the backround). Minus denonotes minima
graded, true means spots will be intensity cones, false uniform spots

im resulting image
regions, list of N regions
regions(i).x
regions(i).y
regions(i).diameter
Usage
[imOut,granules]=testCard(1,7,[0.5,0.5],0.5,true)

imOut=5*ones(7,7);imOut(2:3,2)=1;imOut(2,5:6)=10;imOut(4,5:6)=12;imOut(6,4:6)=13;imOut(2,3)=7;imOut(4,2)=7
v=sieve2d(imOut,5,'o',1,'v',4,1);
```

verboseSieve2d.m

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve - Copy (4)

displayRegion_Graph_Vertex.m

display_Region_Graph_Vertex.m

extremalTree.m

```function [ imOut, granules, regions ] = extremalTree( ( N ,siz, positions,diameters,graded) )

Display a tree representation of a greyscale im
```

extremalTreeUtility.m

```function [ imOut, granules, regions ] = extremalTreeUtility( ( N ,siz, positions,diameters,graded) )

data.showText

Display a tree representation of a greyscale im
```

showGranules.m

```function showGranules

Toggle views of significant granules
```

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve - Copy (4)\sieveCode

test.m

```      [X,Y]=ind2sub(size(imOut),find(imOut>-1));
X=reshape(X,size(imOut));
Y=reshape(Y,size(imOut));
surf(X,Y,double(imOut)/256,'EdgeColor','none');
```
```   Overloaded methods:
classregtree/test
```

testCard.m

```function [ im, granules, regions ] = testCard( verbose,N,siz, positions,diameters,graded,amplitudeverbose)

N, number of objects
siz, rectangle with edges of length siz
positions, positions as a fraction of siz, N rows of x,y; pairs
diameters, diameters of spots as fraction of siz, N rows. If negative a quarter arc.
amplitude, amplitude as fraction of half intensity (the backround). Minus denonotes minima
graded, true means spots will be intensity cones, false uniform spots

im resulting image
regions, list of N regions
regions(i).x
regions(i).y
regions(i).diameter
Usage
[imOut,granules]=testCard(1,7,[0.5,0.5],0.5,true)

imOut=5*ones(7,7);imOut(2:3,2)=1;imOut(2,5:6)=10;imOut(4,5:6)=12;imOut(6,4:6)=13;imOut(2,3)=7;imOut(4,2)=7
v=sieve2d(imOut,5,'o',1,'v',4,1);
```

verboseSieve2d.m

ConnectedSets.m

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve - Copy (5)\Images

displayRegion_Graph_Vertex.m

display_Region_Graph_Vertex.m

extremalTree.m

```function [ imOut, granules, regions ] = extremalTree( ( N ,siz, positions,diameters,graded) )

Display a tree representation of a greyscale im
```

extremalTreeUtility.m

```function [ imOut, granules, regions ] = extremalTreeUtility( ( N ,siz, positions,diameters,graded) )

data.showText

Display a tree representation of a greyscale im
```

showGranules.m

```function showGranules

Toggle views of significant granules
```

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve - Copy (5)\sieveCode

test.m

```      [X,Y]=ind2sub(size(imOut),find(imOut>-1));
X=reshape(X,size(imOut));
Y=reshape(Y,size(imOut));
surf(X,Y,double(imOut)/256,'EdgeColor','none');
```
```   Overloaded methods:
classregtree/test
```

testCard.m

```function [ im, granules, regions ] = testCard( verbose,N,siz, positions,diameters,graded,amplitudeverbose)

N, number of objects
siz, rectangle with edges of length siz
positions, positions as a fraction of siz, N rows of x,y; pairs
diameters, diameters of spots as fraction of siz, N rows. If negative a quarter arc.
amplitude, amplitude as fraction of half intensity (the backround). Minus denonotes minima
graded, true means spots will be intensity cones, false uniform spots

im resulting image
regions, list of N regions
regions(i).x
regions(i).y
regions(i).diameter
Usage
[imOut,granules]=testCard(1,7,[0.5,0.5],0.5,true)

imOut=5*ones(7,7);imOut(2:3,2)=1;imOut(2,5:6)=10;imOut(4,5:6)=12;imOut(6,4:6)=13;imOut(2,3)=7;imOut(4,2)=7
v=sieve2d(imOut,5,'o',1,'v',4,1);
```

verboseSieve2d.m

ArrowRegions.m

ConnectedSets.m

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve - Copy (6)\Snapshots

displayRegion_Graph_Vertex.m

display_Region_Graph_Vertex.m

extremalTree.m

```function [ imOut, granules, regions ] = extremalTree( ( N ,siz, positions,diameters,graded) )

Display a tree representation of a greyscale im
```

extremalTreeUtility.m

```function [ imOut, granules, regions ] = extremalTreeUtility( ( N ,siz, positions,diameters,graded) )

data.showText

Display a tree representation of a greyscale im
```

showGranules.m

```function showGranules

Toggle views of significant granules
```

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve - Copy (6)\sieveCode

test.m

```      [X,Y]=ind2sub(size(imOut),find(imOut>-1));
X=reshape(X,size(imOut));
Y=reshape(Y,size(imOut));
surf(X,Y,double(imOut)/256,'EdgeColor','none');
```
```   Overloaded methods:
classregtree/test
```

testCard.m

```function [ im, granules, regions ] = testCard( verbose,N,siz, positions,diameters,graded,amplitudeverbose)

N, number of objects
siz, rectangle with edges of length siz
positions, positions as a fraction of siz, N rows of x,y; pairs
diameters, diameters of spots as fraction of siz, N rows. If negative a quarter arc.
amplitude, amplitude as fraction of half intensity (the backround). Minus denonotes minima
graded, true means spots will be intensity cones, false uniform spots

im resulting image
regions, list of N regions
regions(i).x
regions(i).y
regions(i).diameter
Usage
[imOut,granules]=testCard(1,7,[0.5,0.5],0.5,true)

imOut=5*ones(7,7);imOut(2:3,2)=1;imOut(2,5:6)=10;imOut(4,5:6)=12;imOut(6,4:6)=13;imOut(2,3)=7;imOut(4,2)=7
v=sieve2d(imOut,5,'o',1,'v',4,1);
```

verboseSieve2d.m

ArrowRegions.m

ConnectedSets.m

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve - Copy (7)\Snapshots

displayRegion_Graph_Vertex.m

display_Region_Graph_Vertex.m

extremalTree.m

```function [ imOut, granules, regions ] = extremalTree( ( N ,siz, positions,diameters,graded) )

Display a tree representation of a greyscale im
```

extremalTreeFig.m

extremalTreeUtility.m

```function [ imOut, granules, regions ] = extremalTreeUtility( ( N ,siz, positions,diameters,graded) )

data.showText

Display a tree representation of a greyscale im
```

extremalTreeUtility2.m

```function [ imOut, granules, regions ] = extremalTreeUtility2( ( N ,siz, positions,diameters,graded) )

To be compatible with ConnectedSets.m (i.e. the plotting axis)

data.showText

Display a tree representation of a greyscale im
```

showGranules.m

```function showGranules

Toggle views of significant granules
```

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve - Copy (7)\sieveCode

test.m

```      [X,Y]=ind2sub(size(imOut),find(imOut>-1));
X=reshape(X,size(imOut));
Y=reshape(Y,size(imOut));
surf(X,Y,double(imOut)/256,'EdgeColor','none');
```
```   Overloaded methods:
classregtree/test
```

testCard.m

```function [ im, granules, regions ] = testCard( verbose,N,siz, positions,diameters,graded,amplitudeverbose)

N, number of objects
siz, rectangle with edges of length siz
positions, positions as a fraction of siz, N rows of x,y; pairs
diameters, diameters of spots as fraction of siz, N rows. If negative a quarter arc.
amplitude, amplitude as fraction of half intensity (the backround). Minus denonotes minima
graded, true means spots will be intensity cones, false uniform spots

im resulting image
regions, list of N regions
regions(i).x
regions(i).y
regions(i).diameter
Usage
[imOut,granules]=testCard(1,7,[0.5,0.5],0.5,true)

imOut=5*ones(7,7);imOut(2:3,2)=1;imOut(2,5:6)=10;imOut(4,5:6)=12;imOut(6,4:6)=13;imOut(2,3)=7;imOut(4,2)=7
v=sieve2d(imOut,5,'o',1,'v',4,1);
```

verboseSieve2d.m

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve - Copy (8)

ArrowRegions.m

ConnectedSets.m

MakeQuantiserTable.m

QuantiseDensity.m

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve - Copy (8)\SIV_test_20130410

SieveCTScans.m

``` Program name: SieveCTScans
Authors: GDT + PS
Date:     15/09/2011
```

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve - Copy (8)\Snapshots

checkbox_isometric.m

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve - Copy (8)\directory_of_images_for_SIV

displayRegion_Graph_Vertex.m

display_Region_Graph_Vertex.m

extremalMSERUtility2.m

```function [ imOut, granules, regions ] = extremalMSERUtility2( ( N ,siz, positions,diameters,graded) )

To be compatible with ConnectedSets.m (i.e. the plotting axis)

data.showText

Display a tree representation of a greyscale im
```

extremalTree.m

```function [ imOut, granules, regions ] = extremalTree( ( N ,siz, positions,diameters,graded) )

Display a tree representation of a greyscale im
```

extremalTreeFig.m

extremalTreeUtility.m

```function [ imOut, granules, regions ] = extremalTreeUtility( ( N ,siz, positions,diameters,graded) )

data.showText

Display a tree representation of a greyscale im
```

extremalTreeUtility2 - Copy.m

```function [ imOut, granules, regions ] = extremalTreeUtility2( ( N ,siz, positions,diameters,graded) )

To be compatible with ConnectedSets.m (i.e. the plotting axis)

data.showText

Display a tree representation of a greyscale im
```

extremalTreeUtility2.m

```function [ imOut, granules, regions ] = extremalTreeUtility2( ( N ,siz, positions,diameters,graded) )

To be compatible with ConnectedSets.m (i.e. the plotting axis)

data.showText

Display a tree representation of a greyscale im
```

quantise_uint8_im.m

saveCurrentStateSIV.m

showGranules.m

```function showGranules

Toggle views of significant granules
```

showTheText.m

## C:\Users\AB\DArT_Toolshed\Algorithms\Sieve\UpdatedSieve - Copy (8)\sieveCode

sieveSect.m

``` Program name: SIEVESECT
Authors: GDT + PS
Date:     15/09/2011
```

siv2d_m.m

``` [Y1 Y2 ... Ym] = siv2d_m(X, [M1 M2 ... Mn], 'F1F2 ... Fn',
[O1 O2 ... On], type, N, Levels)

CALLS the mex code SIV2d.* To get a sequence of outputs call SIVE2d directly

Perform a 2-D connected-set datasieve based on area.

X	    :	uint8, input image
Mk	:	maximum mesh (scale, area of extrema) for each filter
Fk	:	filter type  (m, o, c, M or N)	[default: m]
Ok	: 	output index for each filter    [default: 1 for last filter]
type  :	type of output  (l, b, e, g, f or v)	[default: l]
N	    :	connectivity (4 or 8)           [default: 4]
EP    :   parameters for selecting extrema [Levels,Ratio]
Levels :   number of finite levels in image [default: 256]
Ratio  :   typically 5 [default: 1]
MinArea:   typically 4 [default: 1]
MaxArea:   typically 1000 [default: 1000]
MinAmp :   typically 4 [default: 0]

Yj	:	output image(j) from a filter

FILTERS
The input image is processed using one or more filters Fk, applied
sequentially, up to the associated maximum meshes Mk.  The available
filters are:

m     :	median     (maxima & minima processed in arbitrary order)
o     : 	opening    (only maxima processed, c.f. maximally stable extreme regions )
c     : 	closing    (only minima processed, c.f. maximally stable extreme regions)
M     : 	open-close (maxima then minima processed at each scale)
N     : 	close-open (minima then maxima processed at each scale)

For each filter, the result may optionally be output by specifying the
index of the desired output argument as the input Ok (where Ok=1 represents
the first output argument).  If Ok=0 then no output is generated
for filter Fk.

TYPE OF OUTPUT
The available output types are:

l	:	low-pass
b	:	band-pass
f	:	band-pass with granule fusing
e :	band-pass, returning edge map
g	:	granule list
v :   verbose, i.e. main data structure of engine

where the band-pass output is the difference between the outputs of the
current filter and the previous filter (or the input image) in the
sequence of filters.  The same output type must be used for each filter.

The granule output list format is a cell array containing the following data:
For example:
Number: 3 (number of granules)
area: [1 5 9]
value: [18 7 11]
level: [255 237 230]
deltaArea: [4 4 4]
last_area: [400 80 44]
root: [76 76 76]
PictureElement: {  [77 94 60 78 76]  [77 95 61 93 59 94 60 78 76]}

e.g.  data.g.PictureElement{3} contains indexes to the pixels that formed the granule

Note that producing multiple low or band pass outputs in this way is much
more efficient than calling the sieve function several times with different
meshes.

Memory requirements are about 18 bytes per image pel.

EXAMPLES:

Filter up to mesh 100 using a median sieve, and generate a low pass output:

Y = SIV2d(x, 100)
or 	Y = SIV2d(x, 100, 'm')
or	Y = SIV2d(x, 100, 'm', 1)
or	Y = SIV2d(x, 100, 'm', 1, 'l')
or	Y = SIV2d(x, 100, 'm', 1, 'l',4)
or	Y = SIV2d(x, 100, 'm', 1, 'l',4,[256,4,5])

Filter up to mesh 10 using a median sieve, then up to mesh 100 using an
opening operator, and output the band pass signal between meshes 11 and 100:

Y = SIV2d(x, [10 100], 'mo', [0 1], 'b')

Form a sequence of low pass outputs using closing operators:

[Y1 Y2 Y3 Y4] = SIV2d(x, [8 16 32 64], 'cccc', [1 2 3 4])

As above, with initial noise reduction using a median filter:

[Y1 Y2 Y3 Y4] = SIV2d(x, [4 8 16 32 64], 'mcccc', [0 1 2 3 4])

Outputting granules (extrema) from an image with a maximum of 64 levels
and a selection ratio of 4:

Extrema = SIV2d(x, [4 8 16 32 64], 'mcccc', [0 1 2 3 4], 'g',[64,4])

FILE
SIV2d/SIV2d.m

AUTHOR
rwy Cambridge Consultants (project leader and algorithms J.A. Bangham, UEA)

MODIFICATION HISTORY

1.1	02:jun:95	rwy	First version submitted to SCCS.
1.2	26:jun:95	rwy	Extended for open, close, M & N sieves.
1.3	27:jul:95	rwy	Allows bandpass outputs & granule fusing
1.4	03:aug:95	rwy	Minor revision.
1.5	09:aug:95	rwy	Added granule output.
1.6	14:sep:95	rwy	Added edge map output.
2.0 01/01/2013  jab Updated to 64 bit and includes additional outputs

SVN IDENTIFIER
sieve2d.m	1.6 9/14/95
SIV2d.m	2.0 01/01/2013

```

test.m

```      [X,Y]=ind2sub(size(imOut),find(imOut>-1));
X=reshape(X,size(imOut));
Y=reshape(Y,size(imOut));
surf(X,Y,double(imOut)/256,'EdgeColor','none');
```
```   Overloaded methods:
classregtree/test
```

testCard.m

```function [ im, granules, regions ] = testCard( verbose,N,siz, positions,diameters,graded,amplitudeverbose)

N, number of objects
siz, rectangle with edges of length siz
positions, positions as a fraction of siz, N rows of x,y; pairs
diameters, diameters of spots as fraction of siz, N rows. If negative a quarter arc.
amplitude, amplitude as fraction of half intensity (the backround). Minus denonotes minima
graded, true means spots will be intensity cones, false uniform spots

im resulting image
regions, list of N regions
regions(i).x
regions(i).y
regions(i).diameter
Usage
[imOut,granules]=testCard(1,7,[0.5,0.5],0.5,true)

imOut=5*ones(7,7);imOut(2:3,2)=1;imOut(2,5:6)=10;imOut(4,5:6)=12;imOut(6,4:6)=13;imOut(2,3)=7;imOut(4,2)=7
v=sieve2d(imOut,5,'o',1,'v',4,1);
```

verboseSieve2d.m