CImCombine:SetRect


The SetRect method defines an absolute coordinate rectangle for sampling the image to compute the image normalization statistic.

Syntax

CImCombine:SetRect( CRect )

CImCombine:SetRect( xmin, xmax, ymin, ymax )

where

    CRect is the rectangle object containing pixel coordinates.

    xmin, xmax, ymin, and ymax are the absolute coordinate limits of the rectangle.

  

The normalization region may be specified in absolute pixel coordinates (i.e., in terms of column number and row number) or in relative coordinates as a fractional region dimension placed at a fractional position on the image. The advantage of the absolute rectangle method (the current one) is that the dimensions can be expressed exactly. The disadvantage is that the rectangle may not lie in a favorable location on an image of different dimensions. Alternatively, the SetRelRect method specifies a rectangle in terms of fractional image position, which is independent of image dimension.

As normal in Mira, the rectangle is specified in the order xmin, xmax, ymin, ymax. For example, to set the rectangle over columns 100 to 200 and rows 400 to 500, set CRect( 100, 200, 400, 500 ).

Example

Suppose a CImageSet named S exists. The following script uses a CRect object to define the normalization region and then combines the images using the Mean method:

C = CImCombine:new()

-- create a CImCombine object

R = NewRect(200,300,200,400)

-- 100 x 100 pixel region

C:SetRect( R )

-- specify the CRect to measure

C:SetNormStat("median")

-- use the median as the normalization statistic

C:SetNormMethod("scale")

-- scale to normalize the image set

I = C:Mean( S )

-- combine the image set and return a new image

I:Display()

-- show the new image

The next example changes the way SetRect is used. This method is useful if youdo not need to use the rectangle coordinates again after calling SetRect:

C = CImCombine:new()

-- create a CImCombine object

C:SetRect( 200,300,200,400 )

-- specify the CRect to measure

C:SetNormStat("median")

-- use the median as the normalization statistic

C:SetNormMethod("scale")

-- scale to normalize the image set

I = C:Mean( S )

-- combine the image set and return a new image

I:Display()

-- show the new image

Related Topics

SetRelRect

CImCombine class

CRect class