read_gray_seread_gray_seReadGraySeReadGraySeread_gray_se (Operator)

Name

read_gray_seread_gray_seReadGraySeReadGraySeread_gray_se — 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)

def read_gray_se(file_name: str) -> HObject

Description

read_gray_seread_gray_seReadGraySeReadGraySeread_gray_se 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_seReadGraySeReadGraySeread_gray_se 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 gray values) 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_imageWriteImageWriteImagewrite_image. 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_imageReadImageReadImageread_image.

Execution Information

Parameters

SESESESEse (output_object)  image objectHImageHObjectHObjectHobject * (byte / uint2 / real)

Generated structuring element.

FileNameFileNameFileNamefileNamefile_name (input_control)  filename.read HTuplestrHTupleHtuple (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_seReadGraySeReadGraySeread_gray_se returns 2 ( H_MSG_TRUE) if all parameters are correct. Otherwise, an exception is raised.

Possible Successors

gray_erosiongray_erosionGrayErosionGrayErosiongray_erosion, gray_dilationgray_dilationGrayDilationGrayDilationgray_dilation, gray_openinggray_openingGrayOpeningGrayOpeninggray_opening, gray_closinggray_closingGrayClosingGrayClosinggray_closing, gray_tophatgray_tophatGrayTophatGrayTophatgray_tophat, gray_bothatgray_bothatGrayBothatGrayBothatgray_bothat, write_imagewrite_imageWriteImageWriteImagewrite_image

Alternatives

gen_disc_segen_disc_seGenDiscSeGenDiscSegen_disc_se, read_imageread_imageReadImageReadImageread_image, change_domainchange_domainChangeDomainChangeDomainchange_domain

See also

paint_regionpaint_regionPaintRegionPaintRegionpaint_region, paint_graypaint_grayPaintGrayPaintGraypaint_gray, crop_partcrop_partCropPartCropPartcrop_part

Module

Foundation