read_gray_seread_gray_seReadGraySeReadGraySe (Operator)

Name

read_gray_seread_gray_seReadGraySeReadGraySe — Load a structuring element for gray morphology.

Signature

read_gray_se( : SE : FileName : )

Herror read_gray_se(Hobject* SE, const char* FileName)

Herror T_read_gray_se(Hobject* SE, const Htuple FileName)

void ReadGraySe(HObject* SE, const HTuple& FileName)

void HImage::ReadGraySe(const HString& FileName)

void HImage::ReadGraySe(const char* FileName)

void HImage::ReadGraySe(const wchar_t* FileName)   (Windows only)

static void HOperatorSet.ReadGraySe(out HObject SE, HTuple fileName)

void HImage.ReadGraySe(string fileName)

Description

read_gray_seread_gray_seReadGraySeReadGraySeReadGraySe loads a structuring element for gray morphology from a file. The file names of these structuring elements must end in '.gse' (for gray-scale structuring element). This suffix is automatically appended by read_gray_seread_gray_seReadGraySeReadGraySeReadGraySe to the passed file name, and thus must not be passed. The structuring element's data must be contained in the file in the following format: The first line specifies the data type of the structuring element as 'byte', 'uint2' or 'real' (without enclosing quotes). It must match the image type of the image to be processed in subsequent operator calls using this structuring element. The following two numbers in the file determine the width and height of the structuring element and determine a rectangle enclosing the structuring element. Both values must be greater than 0. Then the number of chords of the region to be defined follows. Then the chords themselves follow: Each chord is defined by the row of the chord (L), the column begin (CB) and the column end (CE), separated by a space between them. Then values follow that are regarded as the corresponding values for gray morphology (their number depends on the defined width and height of the structuring element). Values that will not be part of the region of the structuring element (because no chord is defined for this points) must not be omitted. Nevertheless they will be ignored in the resulting structuring element. Structuring elements are stored internally as images with the data type specified above. Normal images can also be used as structuring elements, where the region of the image defines the shape of the structuring element. However, take care not to use too large images, since the runtime is proportional to the area of the image multiplied by the area of the structuring element. Flat structuring elements (i.e. elements with constant grayvalues) will be executed particularly fast though. The origin of the structuring element lies at half of the defined width and height. For even dimensions the origin will be rounded towards the upper left corner. The structuring element can be saved as image with the help of the operator write_imagewrite_imageWriteImageWriteImageWriteImage. However, take care to use an image format that supports alpha channels to save the shape of the structuring element such as 'tiff', 'jp2' or 'png'. These files can then be loaded again with the operator read_imageread_imageReadImageReadImageReadImage.

Execution Information

Parameters

SESESESESE (output_object)  image objectHImageHImageHobject * (byte / uint2 / real)

Generated structuring element.

FileNameFileNameFileNameFileNamefileName (input_control)  filename.read HTupleHTupleHtuple (string) (string) (HString) (char*)

Name of the file containing the structuring element.

File extension: .gse

Example (HDevelop)

* Load a byte structuring element of width 3 and height 3 that
* consists of 3 chords at lines 0 (from x=1 to x=1), 1 (from x=0
* to x=2) and 2 (from x=1 to x=1). The (used) grayvalues are
* 0, 0, 1, 0, 0 .
* contents of file 'isod4.gse':
* byte
*  3 3
*
* 3
* 0 1 1
* 1 0 2
* 2 1 1
*
*  -1  0 -1
*   0  1  0
*  -1  0 -1
read_gray_se (SE, environment('HALCONROOT')+'/filter/isod4')

Result

read_gray_seread_gray_seReadGraySeReadGraySeReadGraySe returns 2 (H_MSG_TRUE) if all parameters are correct. Otherwise, an exception is raised.

Possible Successors

gray_erosiongray_erosionGrayErosionGrayErosionGrayErosion, gray_dilationgray_dilationGrayDilationGrayDilationGrayDilation, gray_openinggray_openingGrayOpeningGrayOpeningGrayOpening, gray_closinggray_closingGrayClosingGrayClosingGrayClosing, gray_tophatgray_tophatGrayTophatGrayTophatGrayTophat, gray_bothatgray_bothatGrayBothatGrayBothatGrayBothat, write_imagewrite_imageWriteImageWriteImageWriteImage

Alternatives

gen_disc_segen_disc_seGenDiscSeGenDiscSeGenDiscSe, read_imageread_imageReadImageReadImageReadImage, change_domainchange_domainChangeDomainChangeDomainChangeDomain

See also

paint_regionpaint_regionPaintRegionPaintRegionPaintRegion, paint_graypaint_grayPaintGrayPaintGrayPaintGray, crop_partcrop_partCropPartCropPartCropPart

Module

Foundation