Write Region to File
Use this tool to write a region to a file. The region is written in the file format .hobj HOBJ is a binary file format, which provides the functionality to write and read all kinds of iconic HALCON objects (images, regions, and XLDs). Since data are written with neither compression nor conversion, writing this file format is faster than other supported file formats in most circumstances. Hence, if an application needs to read and write all kinds of iconic HALCON objects as fast as possible and no compression is required, this format should be used. For images, all HALCON pixel types can be written. Multi-channel images are supported. The channels can have mixed pixel types but must have the same width and height. The domain of an image and its creation date are stored in the file as well. An object tuple is written into a single file. by default. The write operation is applied for each execution of the MVApp. You can load the regions from the file with the tool Read Region from File in any MERLIC Vision App.
The tool requires that the region is available and delivered from a previous tool.
Execution Behavior
The behavior of this tool regarding the execution differs from the default behavior. Usually a MERLIC tool is executed in the following cases:
- The MERLIC Vision App is explicitly executed in continuous mode.
- The MERLIC Vision App is explicitly executed in "Run Once" mode.
- A MERLIC Vision App with the tool is opened in the MERLIC Creator.
- A parameter value of the tool has been changed in the MERLIC Creator.
However, the tool "Write Region to File" is only executed in the following cases:
- The MERLIC Vision App is explicitly executed in continuous mode.
- The MERLIC Vision App is explicitly executed in "Run Once" mode.
This ensures that write operations are not applied when loading an MVApp or changing a parameter value of the tool.
Parameters
Basic Parameters
Image:
Use this parameter to set an image as background. This should usually be the image, the processed features e.g., contours or ROIs are based on. If no image is connected, the background will be black.
Region:
This parameter contains the region which is written to the selected file. For a better visualization the border of the region is highlighted. The region must be transferred from a previous tool. Therefore, you have to connect the parameter to a result of a previous tool. The connected region is then written to the file.
File Name:
This parameter defines the name and path of the file in which the region is written. It is set to "Me_region.hobj" by default which is located in the directory "%USERPROFILE%\Documents". You can change or select the desired file name and path at the corresponding connector. Regions are stored in the file format ".hobj" by default. However you may also write the regions to a file of the format ".reg". If you define a relative file path, the specified file is searched relative to the default directory "%USERPROFILE%\Documents". However, if your MVApp was already saved when you define a relative file path, the file is searched relative to the directory in which the MVApp is located.
Create Directories:
This parameter defines whether MERLIC creates the directory that is specified in the parameter "File Name" in case it does not exist yet. The parameter is set to 0 by default which means that no directory will be created. If the parameter is set to 1 and the directory that is specified in "File Name" does not exist, MERLIC will create the missing directory as soon as the MVApp is executed.
Results
Basic Results
Current File Name:
This result contains the name and absolute file path of the file that was saved in the last iteration, e.g., "C:\Users\Public\Documents\MVTec\MERLIC\Me_region.hobj".
Tool State:
"Tool State" returns information about the state of the tool and thus can be used for error handling. For more information, see Tool State Result
Additional Results
Processing Time:
This result returns the duration of the most recent execution of the tool in milliseconds. The result is provided as additional result. Therefore, it is hidden by default but it can be displayed via the button beside the tool results. For more information see the section Processing Time in the tool reference overview.