1. MatCNN - Analogic CNN Simulation Toolbox for MATLAB Reference Manual

1.1. Functions

1.1.1. function cbound

Version: 1.3, last modified on 2005/05/12 22:16:49 by histvan

Add a specified boundary to a CNN-type image

Syntax:

[B] = cbound(A, v, r)

Inputs:

A

the input image

v

the mode specifier (scalar from [-1, 1] or 2, or 3) [-1, 1] - add a boundary to A with a constant value v

2

add a zero-flux boundary to A duplicating the outermost pixels of A

3

then adds a torus boundary to A creating a torroidal onnection between the boundary pixels of A

r

the boundary width (neighborhood constant)

Outputs:

B

the generated image

1.1.2. function cimnoise

Version: 1.5, last modified on 2005/05/12 22:16:49 by histvan

Put noise in a CNN-type image

Syntax:

Y = cimnoise(X, Type, P1)

Inputs:

X

the input CNN-type image

Type

noise type (see imnoise)

P1

parameter (see imnoise)

Outputs:

Y

the output CNN-type image

Notes:

  • The function converts a CNN-type image X to a gray scale image X' and executes Y' = IMNOISE(X', Type, P1). Then converts Y' back to a CNN-type image Y. (See 'imnoise' for detailed explanation) $Id: cimnoise.m,v 1.5 2005/05/12 22:16:49 histvan Exp $

1.1.3. function cnn2gray

Version: 1.8, last modified on 2005/06/14 03:05:59 by histvan

Convert a CNN-type image to a gray scale intensity image.

Syntax:

[Y] = cnn2gray(X, c_flag)

Inputs:

X

CNN-type image

c_flag

inversion flag (default = 1)

0

normal conversion

1

inverted conversion

Outputs:

Y

converted grayscale image

1.1.4. function cnnmshow

Version: 1.7, last modified on 2005/06/14 03:05:59 by histvan

function [Y] = cnnmshow(CNNoRGB,B,eop,cindex,...)

Syntax:

[CNNoRGB] = cnnmshow(varargin)

Inputs:

The function has no inputs.

Outputs:

The function has no outputs.

1.1.5. function cnnshow

Version: 1.7, last modified on 2005/06/14 03:06:00 by histvan

Show a CNN-type intensity image

Syntax:

[Y] = cnnshow(X, N)

Inputs:

X

CNN-type image X (RGB or grayscale)

N

Colormap length to convert X to an RGB or Grayscale intensity image. If it is positive then an inverted, otherwise a non-inverted conversion is used. (default = 64)

Outputs:

Y

The RGB or grayscale image, result of conversion

1.1.6. function d_func

Version: 1.26, last modified on 2005/05/12 22:16:49 by histvan

Demonstration of the available functions of the MatCNN toolbox

Syntax:

T = d_func(ftype,picnum)

Inputs:

ftype

function type [string] / 'thresh';'histmod';'mean';'var';'dfilt';'sfilt';'fuzzy'; 'sort';'bmorph';'edge';'skele';'segment' /

picnum

test picture identification number [scalar] /1-14/

Outputs:

The function has no outputs.

1.1.7. function f_bmorph

Version: 1.7, last modified on 2005/05/12 22:16:49 by histvan

Performs CNN based general binary morphology operations (wave-type and iterative solution)

Syntax:

OUT = f_bmorph(method, IN, itnum1, itnum2, objval)

Inputs:

method

binary morphology operation [string]

IN

input image [scalar-2d]

itnum1

1st iteration number [scalar]

itnum2

2nd iteration number [scalar]

objval

object value (specifies object "color") [scalar]

Outputs:

OUT

output image [scalar-2d]

1.1.8. function f_breconstr

Version: 1.11, last modified on 2005/06/14 03:06:00 by histvan

Performs CNN based binary reconstruction operations (wave-type and iterative solution)

Syntax:

[OUT, Dist, Perim] = f_breconstr(method, IN, MARKER, MASK, Atem, b0, z0, mstep, objval)

Inputs:

method

binary morphology operation [string]

IN

input image (gray-scale constraints of reconstruction) [scalar-2d]

MARKER

marker image (seed locations of reconstruction) [scalar-2d]

MASK

mask image (binary constraints of reconstruction) [scalar-2d]

Atem

feedback template matrix [scalar-2d]

b0

input (mask) weighting: central element of the feedforward weigting matrix [scalar-1D]

z0

offset current [scalar-1D]

mstep

transient length (in tau) of wave propagation/ iteration number of binary morphology [scalar-1D]

objval

object value (specifies object "color") [scalar]

Outputs:

OUT

output image [scalar-2d]

Dist

output distances at each iteration

Perim

perimeter of the accepted objects

1.1.9. function f_dfilt

Version: 1.8, last modified on 2005/05/12 22:16:49 by histvan

Performs CNN based geometry-driven diffusion based filtering

Syntax:

OUT = f_dfilt(method, IN, thr, scale, lambda, constr)

Inputs:

method

diffusion method [string]

IN

input image [scalar-2d]

thr

threshold parameter [scalar]

scale

time scale parameter [scalar]

lambda

homotopy parameter [scalar]

constr

constraint parameter [scalar]

Outputs:

OUT

output image [scalar-2d]

1.1.10. function f_edge

Version: 1.7, last modified on 2005/05/12 22:16:49 by histvan

Performs CNN based binary edge detection

Syntax:

OUT = f_edge(method, IN, objval)

Inputs:

method

edge detection method [string]

IN

input image [scalar-2d]

objval

object value (specifies object "color") [scalar]

Outputs:

OUT

output image [scalar-2d]

1.1.11. function f_fuzzy

Version: 1.4, last modified on 2005/05/12 22:16:49 by histvan

Performs CNN based "fuzzyfication"

Syntax:

OUT = f_fuzzy(method, IN, mean, width)

Inputs:

method

fuzzyfication method [string]

IN

input image [scalar-2d]

mean

mean value of the fuzzy membership function [scalar]

width

width of the fuzzy membership function [scalar]

Outputs:

OUT

output image [scalar-2d]

1.1.12. function f_histmod

Version: 1.16, last modified on 2005/05/12 22:16:49 by histvan

Performs CNN based parallel histogram modification

Syntax:

[FILT, MOD, NORM] = f_histmod(method, IN, qnumber, lambda, mstep, mmode)

Inputs:

method

histogram modification method [string]

IN

input image [scalar-2d]

qnumber

number of quantum levels [scalar]

lambda

homotopy parameter of diff based filtering [scalar]

mstep

multi-step (>0: closing, <0: opening) morphology parameter [scalar]

mmode

mode of morphology operations (0 - er|dil, 1 - m(op|cl), 2 - 1:m(op|cl)) [scalar]

Outputs:

FILT

filtered, histogram modified and normalized output image [scalar-2d]

MOD

histogram modified and normalized output image [scalar-2d]

NORM

normalized output image [scalar-2d]

1.1.13. function f_mean

Version: 1.9, last modified on 2005/05/12 22:16:49 by histvan

Mean (1st moment) estimation in local neighborhood

Syntax:

OUT = f_mean(method, IN, lambda, scale)

Inputs:

method

var estimation method [string]

IN

input image [scalar-2d]

lambda

homotopy parameter of diff based filtering [scalar]

scale

scale parameter [scalar]

Outputs:

OUT

output image [scalar-2d]

1.1.14. function f_segment

Version: 1.6, last modified on 2005/05/12 22:16:49 by histvan

Segmentation based on geometry-driven diffusion and statistical filtering. Uses an adaptive thresholding scheme that incorporates both the estimates of the first (mean) and second (variance) order statistics

Syntax:

[OUT, OUTE, OUTS] = f_segment(method, IN, PreF, MeanE, VarE, ThreshE, SClass, EDet, SDet)

Inputs:

method

segmentation method [string]

IN

input image [scalar-2d]

PreF

prefiltering params [scalar-1d]

MeanE

mean estimation params [scalar-1d]

VarE

variance estimation params [scalar-1d]

ThreshE

threshold estimation params [scalar-1d]

SClass

size calssification params [scalar-1d]

EDet

edge detection [scalar-1d]

SDet

skeleton detection [scalar-1d]

Outputs:

OUT

output image (segmentation result) [scalar-2d]

OUTE

output image (segmentation edge) [scalar-2d]

OUTS

output image (segmentation skeleton) [scalar-2d]

1.1.15. function f_sfilt

Version: 1.8, last modified on 2005/05/12 22:16:49 by histvan

Performs CNN based robust statistical filtering

Syntax:

OUT = f_sfilt(method, IN, rord, sstep, thr)

Inputs:

method

thresholding method [string]

IN

input image [scalar-2d]

rord

rank order [string]

sstep

number of operation steps [scalar]

thr

threshold parameters of the NNE model [scalar-2d]

Outputs:

OUT

output image [scalar-2d]

1.1.16. function f_skele

Version: 1.12, last modified on 2005/05/12 22:16:49 by histvan

Performs CNN based binary skeletonization

Syntax:

OUT = f_skele(method, IN, exord, cnum, objval)

Inputs:

method

skeletonization method [string]

IN

input image [scalar-2d]

exord

(coded) execution order of directional peeling [scalar]

cnum

cycle number [scalar]

objval

object value (specifies object "color") [scalar]

Outputs:

OUT

output image [scalar-2d]

1.1.17. function f_sort

Version: 1.9, last modified on 2005/05/12 22:16:49 by histvan

Performs CNN based binary sorting

Syntax:

OUT = f_sort(method, IN, smin, smax, objval)

Inputs:

method

sorting method [string]

IN

input image [scalar-2d]

smin

minimum size specified in morph/wave "steps" [scalar]

smax

maximum size specified in morph/wave "steps" [scalar]

objval

object value (specifies object "color") [scalar]

Outputs:

OUT

output image [scalar-2d]

1.1.18. function f_thres

Version: 1.12, last modified on 2005/05/12 22:16:49 by histvan

Performs CNN based thresholding operations

Syntax:

OUT = f_thres(method, IN, thr)

Inputs:

method

thresholding method [string]

IN

input image [scalar-2d]

thr

threshold parameter [scalar-1d or 2d]

Outputs:

OUT

output image [scalar-2d]

1.1.19. function f_var

Version: 1.7, last modified on 2005/05/12 22:16:49 by histvan

Variance (2nd moment) estimation in local neighborhood

Syntax:

OUT = f_var(method, IN, scale, thr)

Inputs:

method

var estimation method [string]

IN

input image [scalar-2d]

scale

spatial scale parameter [scalar]

thr

threshold parameter [scalar-1d or 2d]

Outputs:

OUT

output image [scalar-2d]

1.1.20. function gray2cnn

Version: 1.7, last modified on 2005/06/14 03:06:00 by histvan

Convert a gray scale intensity image to a CNN-type image.

Syntax:

[Y] = gray2cnn(X, c_flag)

Inputs:

X

grayscale image

c_flag

inversion flag (default = 1)

0

normal conversion

1

inverted conversion

Outputs:

Y

converted CNN-type image

1.1.21. function lavi2cnn

Version: 1.11, last modified on 2005/05/12 22:16:49 by histvan

Loads an image from an AVI file and converts it to a CNN-type image

Syntax:

[X, MAP] = lavi2cnn(fn, i, mode)

Inputs:

fn

the name of the video file (if no extension is given, '.avi' is assumed)

i

the index of the frame to read out

mode

The color format of the output image, ('rgb', 'gray', 'bin', 'hsv').

Outputs:

X

The image read and converted to CNN-type

MAP

the actual colormap

1.1.22. function lbmp2cnn

Version: 1.6, last modified on 2005/05/12 22:16:49 by histvan

Loads a BMP (Microsoft Windows BitMap) file and converts it to a CNN-type image

Syntax:

[X, MAP] = lbmp2cnn(fn,mode)

Inputs:

fn

the name of the image file (if no extension is given, '.bmp' is assumed)

mode

The color format of the output image, ('rgb', 'gray').

Outputs:

X

The image read and converted to CNN-type

MAP

the actual colormap

1.1.23. function loadtem

Version: 1.6, last modified on 2005/06/14 03:06:00 by histvan

Loads the specified CNN template and sets the actual linear and nonlinear feedback (mCNN.Atem, mCNN.At_n), the linear and nonlinear control (mCNN.Btem, mCNN.Bt_n), the nonlinear functions (mCNN.nlin_a, mCNN.nlin_b) and bias (mCNN.I) (or a generalized nonlin interraction mCNN.Dt_n, mCNN.nlin_d) in the CNN environment according to the specified template name (mCNN.TemName <- TN).

Syntax:

LT = loadtem(TN)

Inputs:

TN

The name of the tempplate to load

Outputs:

LT

The type of the template loaded (LT <- mCNN.TemType).

1.1.24. function logexec

Version: 1.7, last modified on 2005/06/14 03:06:00 by histvan

Execute the specified logic operation on CNN images

Syntax:

RES = logexec(LType, OPER1, OPER2, disp_fl)

Inputs:

LType

Logic type to apply ('and', 'notland', 'or', 'notlor', 'xor', 'not')

OPER1

first operand

OPER2

second operand

disp_fl

display flag

Outputs:

RES

the result of the logic

1.1.25. function runtem

Version: 1.7, last modified on 2005/05/12 22:16:49 by histvan

Runs the actual CNN template (loaded by LOADTEM('mCNN.TemName')) with images given in the environment (mCNN.INPUT1, mCNN.INPUT2, mCNN.STATE, mCNN.OUTPUT, mCNN.BIAS, mCNN.MASK) using the global variables (mCNN.UseBiasMap, mCNN.UseMask, mCNN.Boundary) and simulation parameters (mCNN.TimeStep, mCNN.IterNum)

Syntax:

Rt = runtem()

Inputs:

The function has no inputs.

Outputs:

Rt

The length of the CNN simulation in miliseconds

1.1.26. function scnn2avi

Version: 1.8, last modified on 2005/06/14 03:06:00 by histvan

Save a CNN-type image to disk as a AVI frame file with a gray-scale (256 level) colormap

Syntax:

[mov] = scnn2avi(mov, X, MAP)

Inputs:

mov

the movie structure to save the image in

X

the image

MAP

colormap

Outputs:

mov

the movie structure with the saved image

1.1.27. function scnn2bmp

Version: 1.5, last modified on 2005/06/14 03:06:00 by histvan

Save a CNN-type image to disk as a BMP (Microsoft Windows BitMap) file with a gray-scale (256 level) colormap. If no file extension is given with the filename, the extension '.bmp' is assumed.

Syntax:

[] = scnn2bmp(fn, X, MAP)

Inputs:

fn

filename

X

the image

MAP

colormap

Outputs:

The function has no outputs.

1.1.28. function temexec

Version: 1.6, last modified on 2005/06/14 03:06:00 by histvan

Execute the specified template with given parameters

Syntax:

LAM = temexec(TName, TStep, INum, BCond, Transfer, UBMap, UMask)

Inputs:

TName

Template name (see temlib.m)

TStep

TimeStep

INum

Iteration number

BCond

Boundary condition

Transfer

string specifying transfer

YtoX

Y to X

YtoU1

Y to U1

YtoXU1

Y to X and U1

U1toX

U1 to X

XtoU1

x to U1

UBMap

Use bias map switch

UMask

Use mask switch

Outputs:

LAM

the output image

1.1.29. function temexecf

Version: 1.5, last modified on 2005/06/14 03:06:00 by histvan

The full version of the TEMEXEC function (hidding all globals of the CNN environment)

Syntax:

OUT = temexecf(INP, STA, TName, TStep, INum, BCond, Transfer, UBMap, UMask)

Inputs:

INP

Input image

STA

Environment State

TName

Template name (see temlib.m)

TStep

TimeStep

INum

Iteration number

BCond

Boundary condition

Transfer

string specifying transfer

YtoX

Y to X

YtoU1

Y to U1

YtoXU1

Y to X and U1

U1toX

U1 to X

XtoU1

x to U1

UBMap

Use bias map switch

UMask

Use mask switch

Outputs:

OUT

the output image

1.1.30. function transfer

Version: 1.3, last modified on 2005/05/12 22:16:49 by histvan

Transfer data between memory locations

Syntax:

D = transfer(S)

Inputs:

S

source

Outputs:

D

Destination

Notes:

  • This function corresponds to the assignment operator ('='). The only differenc is that it always transfers the data to another memory location than the source. It was created to deal with a bug find in MATLAB 5.x and 6.x. (D=S turnes out to be only a pointer assignment if D does not exist (or S is a global) and does not allocate a new memory location for D.

1.2. Scripts

1.2.1. script d_algo

Version: 1.6, last modified on 2005/04/01 23:54:28 by rcsaba

Sample CNN ANALOGIC ALGORITHM with linear and nonlinear templates

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.

1.2.2. script d_algo_ftol

Version: 1.3, last modified on 2005/04/01 23:54:28 by rcsaba

Sample CNN ANALOGIC ALGORITHM with linear and nonlinear templates (fault tolerance test)

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.

1.2.3. script d_lin

Version: 1.6, last modified on 2005/04/01 23:54:28 by rcsaba

Sample CNN simulation with a linear template

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.

1.2.4. script d_matcnn

Version: 1.4, last modified on 2002/01/12 17:33:30 by rcsaba

Calls and displays all MATCNN demos

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.

1.2.5. script d_nlinab

Version: 1.4, last modified on 2005/05/12 22:20:50 by histvan

Sample CNN simulation with a nonlinear AB-type template

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.

1.2.6. script d_nlind

Version: 1.4, last modified on 2005/05/12 22:20:50 by histvan

Sample CNN simulation with a nonlinear D-type template

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.

1.2.7. script histmod

Version: 1.1, last modified on 2002/01/12 17:13:09 by rcsaba

.C -> .MEX file : implements histogram modification

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.

1.2.8. script modfilt

Version: 1.4, last modified on 2002/11/28 09:22:02 by rcsaba

.C -> .MEX file : implements modal filters

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.

1.2.9. script ordstat

Version: 1.3, last modified on 2002/01/12 17:13:09 by rcsaba

.C -> .MEX file : implements order statistic filters

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.

1.2.10. script setenv

Version: 1.7, last modified on 2005/05/12 22:16:49 by histvan

Set CNN environment and global variable structure

It does not assume any variables in the workspace.

It does not change any existing variable.

It creates the following new variables in the workspace where called:

mCNN

Struct to describe CNN environment

1.2.11. script showdpic

Version: 1.5, last modified on 2002/01/15 19:15:46 by rcsaba

Show demo pictures of the MATCNN environment

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.

1.2.12. script showenv

Version: 1.4, last modified on 2002/01/12 17:13:09 by rcsaba

Show the global variables in the CNN environment

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.

1.2.13. script showtem

Version: 1.4, last modified on 2003/05/03 14:15:00 by rcsaba

Show the actual template loaded into the CNN environment

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.

1.2.14. script tanisod

Version: 1.4, last modified on 2005/05/12 22:16:49 by histvan

.C -> .MEX file : CNN based anisotropic diffusion models (PDE approach)

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.

Notes:

  • - Integration formula: Forward-Euler

  • Output characteristics: sigmoid-type piecewise-linear

1.2.15. script tanisod2

Version: 1.4, last modified on 2005/05/12 22:16:49 by histvan

.C -> .MEX file : CNN based anisotropic diffusion models (non-PDE approach)

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.

Notes:

  • - orig. model:

    rvar=2, ovar=2; lamb=0.25, cyn=1, h=0.1, itn=50-200, Bnd=2

  • simpl. CNN:

    rvar=1, ovar=1; lamb=0.0, cyn=5-10, h=0.1, itn=10-25, Bnd=2

  • Integration formula: Forward-Euler

  • Output characteristics: sigmoid-type piecewise-linear $Id: tanisod2.m,v 1.4 2005/05/12 22:16:49 histvan Exp $

1.2.16. script temlib

Version: 1.10, last modified on 2005/05/12 22:16:49 by histvan

The default CNN template library of the MATCNN Toolbox

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.

1.2.17. script tlinear

Version: 1.3, last modified on 2002/01/12 17:13:08 by rcsaba

.C -> .MEX file : executes the specified linear template on a single-layer CNN architecture with nearest neighbor interactions

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.

1.2.18. script tlinear2

Version: 1.3, last modified on 2002/01/12 17:13:08 by rcsaba

.C -> .MEX file : executes the specified linear template on a single-layer CNN architecture (r = 2)

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.

1.2.19. script tmedian

Version: 1.3, last modified on 2002/01/12 17:13:08 by rcsaba

.C -> .MEX file : CNN based single-layer rank order filters

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.

1.2.20. script tmedianh

Version: 1.3, last modified on 2002/01/12 17:13:08 by rcsaba

.C -> .MEX file : CNN based single-layer rank order filters - experiments with hysteresis nonlinearity -

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.

1.2.21. script tnlinab

Version: 1.3, last modified on 2002/01/12 17:13:08 by rcsaba

.C -> .MEX file : executes the specified AB-type nonlinear template on a single-layer CNN architecture with nearest neighbor interactions

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.

1.2.22. script tnlind

Version: 1.4, last modified on 2003/02/12 16:54:49 by rcsaba

.C -> .MEX file : executes the specified nonlinear D-type template on a single-layer CNN architecture with nearest neighbor interactions (two distinct inputs can be specified for nonlin function d in Dtn that can be either Ukl, Uij, X or Y)

It does not assume any variables in the workspace.

It does not change any existing variable.

It does not create any new variable.