SB SDK 1.11
Image information file

Collection of functions to manage the image information file associated to an image. More...

Collaboration diagram for Image information file:

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_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_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...
 

Detailed Description

Collection of functions to manage the image information file associated to an image.

See also
Management of information relative to an image

Macro Definition Documentation

◆ SB_IMAGE_INFO_EXT

#define SB_IMAGE_INFO_EXT   "rtn"

Extension of the image information file associated to an image.

See also
Management of information relative to an image.

Definition at line 10808 of file sb.h.

Enumeration Type Documentation

◆ 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.

See also
sb_image_info_get_type
Enumerator
SB_IMAGE_INFO_TYPE_NONE 

Image is not used.

SB_IMAGE_INFO_TYPE_TEST 

Image is used for test.

SB_IMAGE_INFO_TYPE_SVL 

Image is used for SVL and not used for training.

SB_IMAGE_INFO_TYPE_SVL_USED 

Read-only value. Image is used for SVL and for training.

Definition at line 10817 of file sb.h.

Function Documentation

◆ sb_image_info_add_sample()

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.

Parameters
[in]image_infoSqueezebrains image info handle.
[in]samplePointer to the structure of the sample.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image

◆ sb_image_info_apply_par_changes()

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.

Parameters
[in]image_infoSqueezebrains image info handle.
[in]infoInformations about the parameters changes
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image
Solution and projects management

◆ sb_image_info_change_project()

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.

Parameters
[in]image_fileName of the image file.
[in]project_info_oldIdentification of the project to be changed.
[in]module_handle_newHandle of new project.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image

◆ sb_image_info_clone()

sb_t_err sb_image_info_clone ( SB_HANDLE  src,
SB_HANDLE pdst,
SB_HANDLE  module_handle 
)

Clones the Squeezebrains image info.

Parameters
[in]srcThe source image info handle.
[out]pdstThe pointer to the new image info handle.
[in]module_handleThe pointer to the project handle
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
sb_project_load
sb_image_info_destroy
sb_image_info_load

◆ sb_image_info_copy_labeling()

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 copied is represented by the ROI and by the:

  • Defects for SURFACE projects.
  • Samples for RETINA projects.
    Parameters
    [in]dstThe destination image info handle.
    [in]image_fileName of the image file of the source project.
    [in]src_prjThe source project information.
    [in]roiSet to 1 if you need to copy ROI analysis.
    [in]ground_truthSet to 1 if you need to copy ground truth (i.e. samples or ROI defects).
    [out]copiedThis flag is set to 1 if the labeling info has been copied to the destination.
    Returns
    If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
    See also
    sb_project_load
    sb_image_info_destroy
    sb_image_info_load

◆ sb_image_info_destroy()

sb_t_err sb_image_info_destroy ( SB_HANDLE image_info)

Destroys the Squeezebrains image info handle.

Parameters
[in,out]image_infoSqueezebrains image info handle. It is set to NULL.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image
sb_image_info_load

◆ sb_image_info_destroy_details()

sb_t_err sb_image_info_destroy_details ( sb_t_image_info_details **const  details)

Destroys the array of the images info details.

Parameters
[in,out]detailsArray of the images info details
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image
sb_image_info_get_details

◆ sb_image_info_get_custom_par_root()

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.

Attention
The handle returned by the function must not the destroyed.
Parameters
[in]handleSqueezebrains image info handle.
[out]node_rootThe variable is filled with the xml root node of your own custom parameters.
The handle returned by the function must not the destroyed.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image
Manage custom parameters
sb_xml_node_get
sb_xml_node_get_child
sb_xml_node_next
sb_xml_node_add
sb_xml_node_set
sb_xml_node_get_name
sb_xml_node_set_attribute
sb_xml_node_get_attribute
sb_xml_node_set_itself
sb_xml_node_count
sb_xml_node_get_string
sb_xml_node_get_string_malloc
sb_xml_node_remove
sb_xml_node_remove_itself

◆ sb_image_info_get_details()

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.

Parameters
[in]image_fileName of the image file.
[out]detailsPointer to the array of the image info details.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image
sb_image_info_destroy_details

◆ sb_image_info_get_name()

sb_t_err sb_image_info_get_name ( SB_HANDLE  image_info,
char *const  str,
int  str_size 
)

Retrieves the name of the image.

Parameters
[in]image_infoSqueezebrains image info handle.
[out]strPointer to the string.
[in]str_sizeNumber of bytes of the string str.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image

◆ sb_image_info_get_notes()

sb_t_err sb_image_info_get_notes ( SB_HANDLE  image_info,
char **const  str 
)

Gets the note from the Squeezebrains image info handle.

Parameters
[in]image_infoSqueezebrains image info handle.
[out]strPointer 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 .
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image
sb_image_info_set_notes

◆ sb_image_info_get_results()

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.

Parameters
[in]image_infoSqueezebrains image info handle.
[in]resPointer to the result structure. The structure is allocated by the function and MUST be destroyed with sb_res_destroy.
[in]compressedIf TRUE the results are compressed, otherwise they are decompressed
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image
sb_res_destroy
sb_image_info_set_results

◆ sb_image_info_get_roi()

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.

If the ROI isn't found in the image file, and parameters width, height are different from -1, a rectangular ROI with size (width, height) is created.

Parameters
[in]image_infoSqueezebrains image info handle.
[in,out]roiPointer to the pointer of the ROI.
On successful return, this parameter will be updated with the pointer of the handle.
[in]widthIf the ROI isn't found in the image file, width of the created ROI
[in]heightIf the ROI isn't found in the image file, height of the created ROI
[in]compressedSet to 1 if you want to maintain the ROI in compressed format
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
ROI management
Management of information relative to an image
sb_roi_destroy
sb_image_info_set_roi

◆ sb_image_info_get_roi_defects()

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.

If the ROI isn't found in the image file, and parameters width, height are different from -1, a rectangular ROI with size (width, height) is created.

Parameters
[in,out]defectsPointer to the pointer of the ROI.
On successful return, this parameter will be updated with the pointer of the handle.
[in]image_infoSqueezebrains image info handle.
[in]widthIf the ROI isn't found in the image file, width of the created ROI
[in]heightIf the ROI isn't found in the image file, height of the created ROI
[in]compressedSet to 1 if you want to maintain the ROI in compressed format
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
ROI management
Management of information relative to an image
sb_roi_destroy
sb_image_info_set_roi_defects

◆ sb_image_info_get_samples()

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.

Parameters
[in]image_infoSqueezebrains image info handle.
[out]samplesPointer 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 .
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image
sb_image_info_set_samples
sb_image_info_load
sb_samples_destroy

◆ sb_image_info_get_type()

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.

Warning
If you set the image type to SB_IMAGE_INFO_TYPE_SVL the function sb_image_info_get_type can return both SB_IMAGE_INFO_TYPE_SVL and SB_IMAGE_INFO_TYPE_SVL_USED.
Parameters
[in]image_infoSqueezebrains image info handle.
[in]model_nameName of the model to be considered. If NULL all models will be considered.
[out]typeOn successful return, this parameter will be filled with the image type.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image
sb_image_info_set_type

◆ sb_image_info_get_version()

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.

Parameters
[in]image_fileName of the image file.
[out]versionPointer of the structure.
[out]version_strPointer of the string. This parameter can be left to NULL if not necessary.
[in]size_version_strSize of the version_str string.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.

◆ sb_image_info_load()

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
Parameters
[out]image_infoPointer to the handle of Squeezebrains image info.
On successful return, this parameter will be updated with the pointer of the handle.
[in]image_fileName of the image file. The file may not exist.
[in]module_handlehandle of the project, it cannot be NULL.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image
sb_image_info_destroy
sb_image_info_save

◆ sb_image_info_remove_project()

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.

Parameters
[in]image_fileName of the image file.
[in]project_uuidUUID of the project to be removed.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image
sb_image_info_get_details
sb_image_info_change_project

◆ sb_image_info_reset()

sb_t_err sb_image_info_reset ( SB_HANDLE  image_info)

Erases all the data from the Squeezebrains image info handle.

The function sets the type of the image to SB_IMAGE_INFO_TYPE_NONE .

Parameters
[in]image_infoSqueezebrains image info handle.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image

◆ sb_image_info_save()

sb_t_err sb_image_info_save ( SB_HANDLE  image_info)

Saves the Squeezebrains image info handle into the image file.

Parameters
[in]image_infoSqueezebrains image info handle.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image
sb_image_info_load

◆ sb_image_info_set_notes()

sb_t_err sb_image_info_set_notes ( SB_HANDLE  image_info,
const char *const  str 
)

Set a note into Squeezebrains image info handle.

Parameters
[in]image_infoSqueezebrains image info handle.
[in]strString to be written. The string must be compliant to UTF-8 format.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image
sb_image_info_get_notes

◆ sb_image_info_set_project_name()

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.

Parameters
[in]image_infoSqueezebrains image info handle.
[in]project_nameNew project name to be set
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image
sb_project_set_name

◆ sb_image_info_set_results()

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.

Parameters
[in]image_infoSqueezebrains image info handle.
[in]respointer to the result structure.
If NULL the results of the image are deleted.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image
sb_image_info_get_results

◆ sb_image_info_set_roi()

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.

The array of the roi is encoded with rle.

Parameters
[in]image_infoSqueezebrains image info handle.
[in]roiPointer to the ROI.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image
sb_image_info_get_roi

◆ sb_image_info_set_roi_defects()

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.

The array of the roi is encoded with rle.

Parameters
[in]defectsPointer to the ROI.
[in]image_infoSqueezebrains image info handle.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
ROI management
Management of information relative to an image
sb_image_info_get_roi_defects

◆ sb_image_info_set_samples()

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.

Parameters
[in]image_infoSqueezebrains image info handle.
[in]samplesPointer to the structure of the samples.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image
sb_image_info_get_samples

◆ sb_image_info_set_type()

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.

Parameters
[in]image_infoSqueezebrains image info handle.
[in]typeType of the image
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Management of information relative to an image
SVL - training
sb_image_info_get_type