SqueezeBrains SDK 1.18
|
Collection of functions to manage the image information file associated to an image. More...
Data Structures | |
struct | sb_t_image_info_detail |
Image information details structure. More... | |
struct | sb_t_image_info_details |
Array of the image information details structure. More... | |
Macros | |
#define | SB_IMAGE_INFO_EXT "rtn" |
Extension of the image information file associated to an image. More... | |
Enumerations | |
enum | sb_t_image_info_type { SB_IMAGE_INFO_TYPE_NONE = 0 , SB_IMAGE_INFO_TYPE_TEST , SB_IMAGE_INFO_TYPE_SVL , SB_IMAGE_INFO_TYPE_SVL_USED } |
Defines the type of the image. More... | |
Functions | |
sb_t_err | sb_image_info_get_version (const char *const image_file, sb_t_version *version, char *const version_str, int size_version_str) |
Gets the version of the image information file. More... | |
sb_t_err | sb_image_info_get_details (const char *const image_file, sb_t_image_info_details **details) |
Load the file and get the array of the image info details. More... | |
sb_t_err | sb_image_info_destroy_details (sb_t_image_info_details **const details) |
Destroys the array of the images info details. More... | |
sb_t_err | sb_image_info_change_project (const char *const image_file, const sb_t_project_info *const project_info_old, SB_HANDLE module_handle_new) |
Change the project to the data associated to the image. More... | |
sb_t_err | sb_image_info_remove_project (const char *const image_file, const char *const project_uuid) |
Remove the project with the specified UUID from the data associated to the image. More... | |
sb_t_err | sb_image_info_load (SB_HANDLE *image_info, const char *const image_file, SB_HANDLE module_handle) |
Creates a SqueezeBrains image info handle. More... | |
sb_t_err | sb_image_info_destroy (SB_HANDLE *image_info) |
Destroys the SqueezeBrains image info handle. More... | |
sb_t_err | sb_image_info_save (SB_HANDLE image_info) |
Saves the SqueezeBrains image info handle into the image file. More... | |
sb_t_err | sb_image_info_clone (SB_HANDLE src, SB_HANDLE *pdst, SB_HANDLE module_handle) |
Clones the SqueezeBrains image info. More... | |
sb_t_err | sb_image_info_copy_labeling (SB_HANDLE dst, const char *const image_file, const sb_t_project_info *src_prj, int roi, int ground_truth, int *copied) |
Copies the labeling information from the src project into the destination image info. More... | |
sb_t_err | sb_image_info_add_sample (SB_HANDLE image_info, const sb_t_sample *const sample) |
Adds a sample into the SqueezeBrains image info handle. More... | |
sb_t_err | sb_image_info_set_samples (SB_HANDLE image_info, const sb_t_samples *const samples) |
Saves the samples in the corresponding SqueezeBrains image info handle. More... | |
sb_t_err | sb_image_info_get_samples (SB_HANDLE image_info, sb_t_samples **const samples) |
Get the samples of an image from the corresponding SqueezeBrains image info handle. More... | |
sb_t_err | sb_image_info_check_samples (const sb_t_samples *const samples, SB_HANDLE project, SB_HANDLE image_info, sb_t_size image_size) |
Check the correctness of the samples metadata. More... | |
sb_t_err | sb_image_info_reset (SB_HANDLE image_info) |
Erases all the data from the SqueezeBrains image info handle. More... | |
sb_t_err | sb_image_info_set_type (SB_HANDLE image_info, sb_t_image_info_type type) |
Sets the type of the SqueezeBrains image info. More... | |
sb_t_err | sb_image_info_get_type (SB_HANDLE image_info, const char *const model_name, sb_t_image_info_type *const type) |
Retrieves the SqueezeBrains image info handle type. More... | |
sb_t_err | sb_image_info_get_tiles_svl (SB_HANDLE handle, sb_t_tiles_info **const ptiles) |
Retrieves the svl tiles information. More... | |
sb_t_err | sb_image_info_get_project_info (SB_HANDLE handle, sb_t_project_info *const project_info) |
Retrieves the project information. More... | |
sb_t_err | sb_image_info_set_notes (SB_HANDLE image_info, const char *const str) |
Set a note into SqueezeBrains image info handle. More... | |
sb_t_err | sb_image_info_get_notes (SB_HANDLE image_info, char **const str) |
Gets the note from the SqueezeBrains image info handle. More... | |
sb_t_err | sb_image_info_get_name (SB_HANDLE image_info, char *const str, int str_size) |
Retrieves the name of the image. More... | |
sb_t_err | sb_image_info_set_results (SB_HANDLE image_info, const sb_t_res *const res) |
Set the results of the detection in the image info handle. More... | |
sb_t_err | sb_image_info_get_results (SB_HANDLE image_info, sb_t_res **const res, int compressed) |
Get the results of the detection from the image info handle. More... | |
sb_t_err | sb_image_info_set_project_name (SB_HANDLE image_info, const char *const project_name) |
Set the project name in the image info handle. More... | |
sb_t_err | sb_image_info_apply_par_changes (SB_HANDLE image_info, const sb_t_par_changes_info *info) |
Apply the par changes to the SqueezeBrains image info handle. More... | |
sb_t_err | sb_image_info_set_roi (SB_HANDLE image_info, const sb_t_roi *const roi) |
Sets the ROI in a SqueezeBrains image info handle. More... | |
sb_t_err | sb_image_info_get_roi (SB_HANDLE image_info, sb_t_roi **const roi, int width, int height, int compressed) |
Gets the ROI from a SqueezeBrains image info handle. More... | |
sb_t_err | sb_image_info_set_roi_defects (SB_HANDLE image_info, const sb_t_roi *const defects) |
Sets the surface defects ROI on a SqueezeBrains image info handle. More... | |
sb_t_err | sb_image_info_get_roi_defects (SB_HANDLE image_info, sb_t_roi **const defects, int width, int height, int compressed) |
Gets the surface defects ROI from a SqueezeBrains image info handle. More... | |
sb_t_err | sb_image_info_get_custom_par_root (SB_HANDLE handle, SB_HANDLE *node_root) |
Returns the xml root node of your own custom parameters. More... | |
Collection of functions to manage the image information file associated to an image.
#define SB_IMAGE_INFO_EXT "rtn" |
Extension of the image information file associated to an image.
enum sb_t_image_info_type |
Defines the type of the image.
It determines how image is used by that project.
If it is not used its value is SB_IMAGE_INFO_TYPE_NONE . The values are 32 bits both for 32 and 64 bits library version.
sb_t_err sb_image_info_add_sample | ( | SB_HANDLE | image_info, |
const sb_t_sample *const | sample | ||
) |
Adds a sample into the SqueezeBrains image info handle.
[in] | image_info | SqueezeBrains image info handle. |
[in] | sample | Pointer to the structure of the sample. |
sb_t_err sb_image_info_apply_par_changes | ( | SB_HANDLE | image_info, |
const sb_t_par_changes_info * | info | ||
) |
Apply the par changes to the SqueezeBrains image info handle.
The function updates the samples and the defects ROI of the image info according to the info passed.
[in] | image_info | SqueezeBrains image info handle. |
[in] | info | Information about the parameters changes |
sb_t_err sb_image_info_change_project | ( | const char *const | image_file, |
const sb_t_project_info *const | project_info_old, | ||
SB_HANDLE | module_handle_new | ||
) |
Change the project to the data associated to the image.
The function has two different behaviors:
[in] | image_file | Name of the image file. |
[in] | project_info_old | Identification of the project to be changed. |
[in] | module_handle_new | Handle of new project. |
sb_t_err sb_image_info_check_samples | ( | const sb_t_samples *const | samples, |
SB_HANDLE | project, | ||
SB_HANDLE | image_info, | ||
sb_t_size | image_size | ||
) |
Check the correctness of the samples metadata.
In the case that project is circular (sb_t_svl_par::sb_t_image_circularity_type equal to SB_IMAGE_CIRCULARITY_TYPE_HORIZONTAL ) the function manages the following cases:
With a circular Retina project, the samples loaded by the sb_image_info_load function and returned by the sb_image_info_get_samples function which are outside-left have left vertices whith negative horizontal coordinates and those are outside-right have right vertices higher than image width.
The function checks the coordinates of vertices within 1 pixel.
[in] | samples | Puntatore ai campioni |
[in] | project | SqueezeBrains project handle. |
[in] | image_info | SqueezeBrains image info handle. |
[in] | image_size | Image resolution |
Clones the SqueezeBrains image info.
[in] | src | The source image info handle. |
[out] | pdst | The pointer to the new image info handle. |
[in] | module_handle | The pointer to the project handle |
sb_t_err sb_image_info_copy_labeling | ( | SB_HANDLE | dst, |
const char *const | image_file, | ||
const sb_t_project_info * | src_prj, | ||
int | roi, | ||
int | ground_truth, | ||
int * | copied | ||
) |
Copies the labeling information from the src project into the destination image info.
The information that may be copied is different according to the project type:
If the rtn source file doesn't exist the function returns without error.
The source and destination image must have the same resolution.
[in] | dst | The destination image info handle. |
[in] | image_file | Name of the image file of the source project. |
[in] | src_prj | The source project information. |
[in] | roi | Set to 1 if you need to copy ROI analysis. |
[in] | ground_truth | Set to 1 if you need to copy ground truth (i.e. samples or ROI defects). |
[out] | copied | This flag is set to 1 if the labeling info has been copied to the destination. |
Destroys the SqueezeBrains image info handle.
[in,out] | image_info | SqueezeBrains image info handle. It is set to NULL. |
sb_t_err sb_image_info_destroy_details | ( | sb_t_image_info_details **const | details | ) |
Destroys the array of the images info details.
[in,out] | details | Array of the images info details |
Returns the xml root node of your own custom parameters.
[in] | handle | SqueezeBrains image info handle. |
[out] | node_root | The variable is filled with the xml root node of your own custom parameters. The handle returned by the function must not the destroyed. |
sb_t_err sb_image_info_get_details | ( | const char *const | image_file, |
sb_t_image_info_details ** | details | ||
) |
Load the file and get the array of the image info details.
[in] | image_file | Name of the image file. |
[out] | details | Pointer to the array of the image info details. |
Retrieves the name of the image.
[in] | image_info | SqueezeBrains image info handle. |
[out] | str | Pointer to the string. |
[in] | str_size | Number of bytes of the string str. |
Gets the note from the SqueezeBrains image info handle.
[in] | image_info | SqueezeBrains image info handle. |
[out] | str | Pointer to the string. On successful return, this parameter will be filled with the pointer to the note. The pointer should be freed with sb_free . |
sb_t_err sb_image_info_get_project_info | ( | SB_HANDLE | handle, |
sb_t_project_info *const | project_info | ||
) |
Retrieves the project information.
[in] | handle | SqueezeBrains image info handle. |
[out] | project_info | Pointer to the project information structure |
Get the results of the detection from the image info handle.
[in] | image_info | SqueezeBrains image info handle. |
[in] | res | Pointer to the result structure. The structure is allocated by the function and MUST be destroyed with sb_res_destroy. |
[in] | compressed | If TRUE the results are compressed, otherwise they are decompressed |
sb_t_err sb_image_info_get_roi | ( | SB_HANDLE | image_info, |
sb_t_roi **const | roi, | ||
int | width, | ||
int | height, | ||
int | compressed | ||
) |
Gets the ROI from a SqueezeBrains image info handle.
In case the roi was not found in the image file:
The roi is completely filled with the value 255 if it is created by the function because it does not exist in the image.
[in] | image_info | SqueezeBrains image info handle. |
[out] | roi | Pointer to the pointer of the ROI. On successful return, this parameter will be updated with the pointer of the handle, or it could be NULL if the roi was not found in the image and the width and height parameters are equal to 0. |
[in] | width | If the ROI isn't found in the image file, width of the created ROI |
[in] | height | If the ROI isn't found in the image file, height of the created ROI |
[in] | compressed | Set to 1 if you want to maintain the ROI in compressed format |
sb_t_err sb_image_info_get_roi_defects | ( | SB_HANDLE | image_info, |
sb_t_roi **const | defects, | ||
int | width, | ||
int | height, | ||
int | compressed | ||
) |
Gets the surface defects ROI from a SqueezeBrains image info handle.
In case the roi was not found in the image file:
The roi is completely filled with the value 0 if it does not exist in the image and was created by the function.
[out] | defects | Pointer to the pointer of the ROI defects. On successful return, this parameter will be updated with the pointer of the handle, or it could be NULL if the roi was not found in the image and the width and height parameters are equal to 0. |
[in] | image_info | SqueezeBrains image info handle. |
[in] | width | If the ROI isn't found in the image file, width of the created ROI |
[in] | height | If the ROI isn't found in the image file, height of the created ROI |
[in] | compressed | Set to 1 if you want to maintain the ROI in compressed format |
sb_t_err sb_image_info_get_samples | ( | SB_HANDLE | image_info, |
sb_t_samples **const | samples | ||
) |
Get the samples of an image from the corresponding SqueezeBrains image info handle.
[in] | image_info | SqueezeBrains image info handle. |
[out] | samples | Pointer to samples. On successful return, this parameter will be updated with the pointer of the structure sb_t_samples. The structure should freed using the function sb_samples_destroy . |
sb_t_err sb_image_info_get_tiles_svl | ( | SB_HANDLE | handle, |
sb_t_tiles_info **const | ptiles | ||
) |
Retrieves the svl tiles information.
If tiling is applied during training, you can know exactly how tiling grid is applied over the image and know which tiles have been used or not in the procedure.
[in] | handle | SqueezeBrains image info handle. |
[out] | ptiles | On successful return, this parameter will be filled with the pointer to the svl tiles information structure. The structure must be destroyed with the function sb_tiles_info_destroy . |
sb_t_err sb_image_info_get_type | ( | SB_HANDLE | image_info, |
const char *const | model_name, | ||
sb_t_image_info_type *const | type | ||
) |
Retrieves the SqueezeBrains image info handle type.
If an image is in the SVL collection, you can know if the image is used or not for learning.
[in] | image_info | SqueezeBrains image info handle. |
[in] | model_name | Name of the model to be considered. If NULL all models will be considered. |
[out] | type | On successful return, this parameter will be filled with the image type. |
sb_t_err sb_image_info_get_version | ( | const char *const | image_file, |
sb_t_version * | version, | ||
char *const | version_str, | ||
int | size_version_str | ||
) |
Gets the version of the image information file.
[in] | image_file | Name of the image file. |
[out] | version | Pointer of the structure. |
[out] | version_str | Pointer of the string. This parameter can be left to NULL if not necessary. |
[in] | size_version_str | Size of the version_str string. |
sb_t_err sb_image_info_load | ( | SB_HANDLE * | image_info, |
const char *const | image_file, | ||
SB_HANDLE | module_handle | ||
) |
Creates a SqueezeBrains image info handle.
The function open the file with extension SB_IMAGE_INFO_EXT relative to the image.
image_file | Description |
---|---|
not exists | The function prepares an "image info handle" with uuid and type of the module_handle |
exists | The function loads the information about the specified module_handle. If the project is not found, the function prepares an handle with uuid and type of the specified module_handle |
[out] | image_info | Pointer to the handle of SqueezeBrains image info. On successful return, this parameter will be updated with the pointer of the handle. |
[in] | image_file | Name of the image file or of the SB_IMAGE_INFO_EXT file. The file may not exist. |
[in] | module_handle | handle of the project, it cannot be NULL. |
sb_t_err sb_image_info_remove_project | ( | const char *const | image_file, |
const char *const | project_uuid | ||
) |
Remove the project with the specified UUID from the data associated to the image.
[in] | image_file | Name of the image file. |
[in] | project_uuid | UUID of the project to be removed. |
Erases all the data from the SqueezeBrains image info handle.
The function sets the type of the image to SB_IMAGE_INFO_TYPE_NONE .
[in] | image_info | SqueezeBrains image info handle. |
Saves the SqueezeBrains image info handle into the image file.
[in] | image_info | SqueezeBrains image info handle. |
Set a note into SqueezeBrains image info handle.
[in] | image_info | SqueezeBrains image info handle. |
[in] | str | String to be written. The string must be compliant to UTF-8 format. |
Set the project name in the image info handle.
[in] | image_info | SqueezeBrains image info handle. |
[in] | project_name | New project name to be set |
Set the results of the detection in the image info handle.
[in] | image_info | SqueezeBrains image info handle. |
[in] | res | pointer to the result structure. If NULL the results of the image are deleted. |
Sets the ROI in a SqueezeBrains image info handle.
The array of the roi is encoded with rle.
[in] | image_info | SqueezeBrains image info handle. |
[in] | roi | Pointer to the ROI. |
Sets the surface defects ROI on a SqueezeBrains image info handle.
The array of the roi is encoded with rle. The function returns the error SB_ERR_PROJECT_TYPE with Retina and Deep Cortex projects.
[in] | defects | Pointer to the ROI. |
[in] | image_info | SqueezeBrains image info handle. |
sb_t_err sb_image_info_set_samples | ( | SB_HANDLE | image_info, |
const sb_t_samples *const | samples | ||
) |
Saves the samples in the corresponding SqueezeBrains image info handle.
[in] | image_info | SqueezeBrains image info handle. |
[in] | samples | Pointer to the structure of the samples. |
sb_t_err sb_image_info_set_type | ( | SB_HANDLE | image_info, |
sb_t_image_info_type | type | ||
) |
Sets the type of the SqueezeBrains image info.
The function clears all the information set by SVL except the case where the image is already SB_IMAGE_INFO_TYPE_SVL or SB_IMAGE_INFO_TYPE_SVL_USED and type is SB_IMAGE_INFO_TYPE_SVL.
The function returns the error SB_ERR_WRONG_PARAMETER if type is equal to SB_IMAGE_INFO_TYPE_SVL_USED because only the sb_svl_run function can set this value.
[in] | image_info | SqueezeBrains image info handle. |
[in] | type | Type of the image |