CImCombine:SetRelRect
The SetRelRect method defines a fractional dimension rectangle for sampling the image to compute the image normalization statistic.
CImCombine:SetRelRect() CImCombine:SetRelRect( CRect ) CImCombine:SetRelRect( xsize, xcenter, ysize, ycenter ) where |
CRect is the rectangle object containing percent values for the coordinates.
xsize, xcenter, ysize, and ycenter define the percent limits of the rectangle.
If no parameters are specified, the central 10% of the image is used. This is equivalent to xsize=10, xcenter=50, ysize=10, and ycenter=50.
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 percentage of the image dimensions. The present method defines the rectangle in the percentage way. The advantage of this method is that the rectangle will always lie in the same relative position on any image. If you need to specify exact column and row positions, use the SetRect method instead.
The percentage rectangle is expressed in terms of width and position of the rectangle, ranging between 0 and 100% of the image size. These are encoded in the rectangle as CRect( xsize, xcenter, ysize, ycenter ). For example, to specify a rectangle using 10% of the image width, set xsize=10. To position the rectangle at the horizontal center of the image (i.e., at 50% of the width), setxcenter=50. To set a rectangle of 20% of the width and 30% of the height, centered at 25% of the width and 75% of the height, use CRect( 20, 25, 30, 75 ).
If no parameters are specified, the central 10% of the width and height are used as the default normalization region. In that case, the current method should be called simply to inform the processing to use a relative rectangle rather than an absolute rectangle (see SetRect).
Suppose a CImageSet named S exists. The following script uses a CRect object to define a percentage normalization region and then combines the images using the median method:
|
-- create a CImCombine object |
|
-- central 10% of image |
|
-- specify the CRect to measure |
|
-- use the median as the statistic |
|
-- scale to normalize the image set |
|
-- combine image set and return new image |
|
-- show the new image |
The next example changes the way SetRelRect is used. This method is useful if you don't need the rectangle coordinates after calling SetRelRect the first time:
|
-- create a CImCombine object |
|
-- specify 20% of the image centered at 40% and 60% |
|
-- use the median as the statistic |
|
-- scale to normalize the image set |
|
-- combine image set and return new image |
|
-- show the new image |
The final example shows how to use the default central 10% of the image as the normalization rectangle:
|
-- create a CImCombine object |
|
-- default to the central 10% of the image |
|
-- use the median as the statistic |
|
-- scale to normalize the image set |
|
-- combine image set and return new image |
|
-- show the new image |