regionAnalyse

[ XITE Reference Manual | XITE home ]

Contents


Name

regionAnalyse - split BIFF image into regions and describe regions

Syntax

regionAnalyse [<option>...] <inimage> [<inimage2>]

Description

regionAnalyse splits the image inimage1 into disjunct homogenous regions and calculates a number of properties for every region or every set of regions (object). The result is written to stdout in ascii format. Some options modify the "behavior" of the program, others tell the system to measure and write a specific property for every region or object. Properties are written in the order in which they appear in the options list.

A number of properties (minpix, maxpix, xmean, ymean, moment, etc.) allow a second image inimage2 to be specified. If specified, it is used for the calculation of these properties, while still using inimage1 to define the extent of the regions. If inimage2 is missing, inimage1 is used to define the regions as well as to supply pixel values for these measurements.

Behaviour options

-header
Print a header showing the contents of the table.

-nc nc
Neighbour connectedness: 4 or 8 (default 4). nc applies to objects (pixel value > 0). The opposite applies to the background (=0).

-sort
Sort regions with respect to object number, store in an object-array.

-split
Split objects (except the background, the object with object number 0) so that every region forms an independent object.

-cursor x y
Define a cursor point (x, y).

-if expr
Use only regions which make the expression expr TRUE. expr is a logical expression.

Variables available for use in expr

 N - Object number.
 R - Region number.
 A - Region area.
 W - Region width.
 H - Region height.
 M - Region pixel mean.
 CR - Region number of cursor point
 CN - Object number of cursor point

Operators available in expr

 + - / *
 < <= == >= > != LT LE EQ GE GT NE
 AND OR NOT

Examples:

 -if 'A > 50'
 -if 'A * 0.75 > W * H AND W > H'
 -cursor 45 70 -if 'CR EQ R'

-o outimg
Used in combination with -if to make a new image containing only the regions which makes the if-expr TRUE.

-bg val
Set the background pixel value in outimg to val.

Property options

-objnr
Write object number.

-regnr
Write region number.

-area
Measure and write the area.

-perimeter
Measure and write the perimeter.

-xmin
Measure and write xmin.

-ymin
Measure and write ymin.

-xmax
Measure and write xmax.

-ymax
Measure and write ymax.

-minmax
Measure and write xmin, ymin, xmax and ymax.

-height
Measure and write the height of the region.

-width
Measure and write the width of the region.

-point
Write the x and y coordinates of a point in the region (the leftmost point on the upper line).

Property options acting on inimage2 if present, otherwise on inimage1:

-minpix
Measure and write minimum pixel value within region.

-maxpix
Measure and write maximum pixel value within region.

-minmaxpix
Measure and write minimum and maximum pixel values within region.

-xmean
Measure and write xmean, using inimage2 as weights.

-ymean
Measure and write ymean, using inimage2 as weights.

-xymean
Measure and write xmean and ymean, using inimage2 as weights.

-moment p q
Measure and write the moment of order p+q, using inimage2 if present. This option may be used repreatedly with different order arguments.

-cmoment p q
Measure and write the central moment of order p+q, using inimage2 if present. This option may be used repreatedly with different order arguments.

-imoment
7 invariant moments.

-volume
Measure and write the volume under inimage2 if present.

-mean
Measure and write the mean of the pixel values within the region(s).

-median
Measure and write the median of the pixel values.

-stdev
Measure and write the standard deviation of the pixel values.

Note: If using -sort together with -regnr, only the first region number in each object will be written.

Files

region.h

See also

regionArea(3), regionConvexHull(3), regionCreate(3), regionDraw(3), regionFree(3), regionHistoUpdate(3), regionHisto(3), regionImoment(3), regionInsertYline(3), regionDeleteYline(3), regionEndInsert(3), regionXmean(3), regionYmean(3), regionMean(3), regionXmin(3), regionXmax(3), regionYmin(3), regionYmax(3), regionMinMax(3), regionCMoment(3), regionPMoment(3), regionMoment(3), regionPerform(3), regionPerimeter(3), regionIsPoint(3), regionPoint(3), regionSearch(3), regionSort(3), regionCopy(3), regionUnion(3), regionOverlap(3), regionNeighbor(3), regionVolume(3), regionYline(3)

Restrictions

Input image must have bands with pixel type unsigned byte.

Author

Tor Lønnestad, BLAB, Ifi, UiO. Some additional features: Otto Milvang

Examples

 regionAnalyse -header -if 'A > 50' -regnr -area \\
     -width monat.img > mona.txt

Id

$Id: regionAnalyse.c,v 1.38 1997/02/21 17:06:17 svein Exp $