| Customize Help
| Save Settings

MclassDraw



Function Map
Synopsis
Draw specific features of a predefined CNN classifier context, a dataset context, or a CNN prediction result buffer.
Syntax
void MclassDraw(
MIL_ID ContextGraId, //in
MIL_ID ContextOrResultClassId, //in
MIL_ID DstImageBufOrListGraId, //in
MIL_INT64 Operation, //in
MIL_INT64 Index, //in
MIL_INT64 ControlFlag //in
)
Description

This function draws specific features of a predefined CNN classifier context, an images dataset context, a features dataset context, or a CNN prediction result buffer. Drawing operations are typically performed in a destination image buffer. Note, you cannot draw from a tree ensemble classifier context or a tree ensemble prediction result buffer.

By default, this function performs the drawing operation for every class in the specified context or result. To draw for a specific class, specify its index (Index).

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see which MIL system’s documentation you should use in its place and any possible differences.
Parameters
This function is not supported on the selected boards.
This function reference has not been updated for the selected MIL system. To show the content of this page, choose a second MIL system; refer to the MIL system's release note to see which MIL system’s documentation to choose and any possible differences.
Parameters
ContextGraId

Specifies the identifier of the 2D graphics context to use when drawing. This parameter must be set to one of the following values:

function map For specifying the 2D graphics context
Click to summarizeValue Description
Click to summarize M_DEFAULT

Specifies that the default 2D graphics context of the current MIL application is used.

Note that there is a different default 2D graphics context for each thread.

(summarize)
Click to summarize MIL 2D graphics context identifier

Specifies a valid 2D graphics context identifier, which you have allocated using MgraAlloc().

ContextOrResultClassId

Specifies the identifier of the predefined CNN classifier context, dataset context, or CNN prediction result buffer from which to draw.

function map For specifying the predefined CNN classifier context, dataset context, or CNN prediction result buffer
Click to summarizeValue Description
Click to summarize ContextClassifierCNNPredefinedId

Specifies the identifier of the predefined CNN classifier context. This context is allocated using MclassAlloc() with M_CLASSIFIER_CNN_PREDEFINED.

(summarize)
Click to summarize ContextDatasetId

Specifies the identifier of an images or features dataset context. These contexts must have been previously allocated on the required system using MclassAlloc() with M_DATASET_IMAGES or M_DATASET_FEATURES.

(summarize)
Click to summarize ResultClassPredictId

Specifies the identifier of the CNN prediction result buffer. This buffer is allocated using MclassAllocResult() with M_PREDICT_CNN_RESULT.

(summarize)
DstImageBufOrListGraId

Specifies the identifier of the destination image buffer or LUT buffer in which to draw. You should typically specify an image, which can be any valid MIL image buffer allocated using MbufAlloc...(). By drawing into a display's overlay buffer, you can also annotate an image non-destructively. To specify a LUT, you must use the M_DRAW_CLASS_COLOR_LUT drawing operation.

When drawing from a CNN prediction result buffer, the expected size of the destination image buffer is, by default, the same as the target image. This assumes prediction results are from a typical image classification process.

Note, if your image classification results are from a coarse segmentation prediction, be aware that the classification map (the output of the network) is, by default, scaled by M_CLASSIFICATION_MAP_SCALE_X and M_CLASSIFICATION_MAP_SCALE_Y, and placed at M_CLASSIFICATION_MAP_OFFSET_X and M_CLASSIFICATION_MAP_OFFSET_Y (these scale and map values are retrievable using MclassGetResult()). If you add M_REPLICATE_BORDER to the drawing operation, MIL expands (copies) the edges of the classification map to reach the edges of the destination buffer.

You can modify the default scale and offset map behavior by adding M_CLASSIFICATION_MAP_SIZE to the drawing operation. This performs the drawing operation according to the exact classification map (output of the network) without scaling or expanding. In this case, the destination buffer size should be equal to the resulting X- and Y-size of the classification map; to retrieve these dimensions, call MclassGetResult() with M_CLASSIFICATION_MAP_SIZE_X and M_CLASSIFICATION_MAP_SIZE_Y.

Operation

Specifies the drawing operation to perform.

The following Operation parameter values can be set for a predefined CNN classifier context or a features dataset context.

function map For a predefined classifier context or a dataset context
Click to summarizeValue Description
Click to summarize M_DRAW_CLASS_COLOR_LUT

Draws the color (LUT) associated to the class. This color is defined using MclassControl() with M_CLASS_DRAW_COLOR.

When performing this operation, you must set the destination buffer (DstImageBufOrListGraId) to the identifier of a MIL LUT buffer. To inquire the width of this LUT, use M_NUMBER_OF_CLASSES.

(summarize)
Click to summarize M_DRAW_CLASS_ICON

Draws the icon image associated to the class. This image is defined using MclassControl() with M_CLASS_ICON_ID.

When performing this operation, you must set the destination buffer (DstImageBufOrListGraId) to the identifier of a MIL image buffer. To inquire the format of this buffer (DstImageBufOrListGraId), such as the X- and Y-size, use M_CLASS_ICON_ID (the dimension of the destination image in which you draw should be the same as the class description's icon image).

(summarize)

The following Operation parameter values can be set for a CNN prediction result buffer. These operations require an image buffer as the destination in which to draw (DstImageBufOrListGraId).

function map For a CNN prediction result buffer
Click to summarizeValue Description
Click to summarize M_DRAW_BEST_INDEX_CONTOUR_IMAGE +

Draws the contours of the best classes. If you do not specify the M_PSEUDO_COLOR combination value, MIL uses the result type M_CLASS_MAP_INDEX_IMAGE_TYPE to determine the type of the image to use. If you specify M_PSEUDO_COLOR, the image type must be 3 bands, 8-bit unsigned.

(summarize)
Click to summarize M_DRAW_BEST_INDEX_IMAGE +

Draws an image using the index value of the best class at each point. If you do not specify the M_PSEUDO_COLOR combination value, MIL uses the result type M_CLASS_MAP_INDEX_IMAGE_TYPE to determine the type of the image to use. If you specify M_PSEUDO_COLOR, the image type must be 3 bands, 8-bit unsigned.

(summarize)
Click to summarize M_DRAW_BEST_SCORE_IMAGE +

Draws an image using the best score at each point. If you do not specify the M_PSEUDO_COLOR combination value, the image type must be float or unsigned. If you specify M_PSEUDO_COLOR, the image type must be 3 bands, 8-bit unsigned.

(summarize)
Click to summarize M_DRAW_CLASSIFICATION_SCORE +

Draws (fills) an image using the scores of a specific class. This drawing operation is not possible when drawing general results; you must set the Index parameter to a specific class.

If you specify the M_CLASSIFICATION_MAP_SIZE combination value, the drawing is done with the classification map size (the ControlFlag parameter must be set to its default). If you do not specify the M_CLASSIFICATION_MAP_SIZE combination value, you can set the ControlFlag parameter to M_BILINEAR_INTERPOLATION or M_RECEPTIVE_FIELD_PATCH.

You cannot use the M_PSEUDO_COLOR combination value with this drawing operation.

In all cases, when using M_CLASSIFICATION_MAP_SIZE, the image type must be float or 8-bit unsigned.

(summarize)

You can add one or more of the following values to the above-mentioned values to specify a modification to the drawing operation.

function map For modifying the drawing operation
Click to summarizeCombination value Description
Click to summarize M_CLASSIFICATION_MAP_SIZE

Draws according to the exact classification map size (output of the network) without scaling or expanding. In this case, the expected size of the destination buffer (DstImageBufOrListGraId) is the same as the X- and Y-size of M_CLASSIFICATION_MAP_SIZE.

You cannot use M_CLASSIFICATION_MAP_SIZE with M_REPLICATE_BORDER.

(summarize)
Click to summarize M_PSEUDO_COLOR

Draws using the pseudo colors defined by calling MclassControl() with M_CLASS_DRAW_COLOR. For all drawing operations, if you specify M_PSEUDO_COLOR, the destination buffer (DstImageBufOrListGraId) image type must be 3 bands, 8-bit unsigned.

Depending on the draw operation, you can use M_PSEUDO_COLOR with other combination values.

(summarize)
Click to summarize M_REPLICATE_BORDER

Draws with borders expanded to the size of the destination buffer (DstImageBufOrListGraId).

You cannot use M_REPLICATE_BORDER with M_CLASSIFICATION_MAP_SIZE.

(summarize)
Index

Specifies what to use to perform the drawing operation.

Set this parameter to one of the following values:

function map For specifying what to use to perform the drawing operation
Click to summarizeValue Description
Click to summarize M_DEFAULT

Same as M_CONTEXT, if the ContextOrResultClassId parameter is a predefined CNN classifier context or an images dataset context; same as M_GENERAL, if the ContextOrResultClassId is a CNN prediction result buffer.

Click to summarize
M_CLASS_INDEX(
MIL_INT Index
)

Specifies that the drawing operation is for a specific class in the predefined CNN classifier context, dataset context, or CNN prediction result buffer (ContextOrResultClassId).

(summarize)
Parameters

Set this parameter to the following:

Value

Specifies the index of the class for which to draw.

Click to summarize M_CONTEXT

Specifies that the drawing operation is for every class in the predefined CNN classifier context or the dataset context (ContextOrResultClassId).

Click to summarize M_GENERAL

Specifies that the drawing operation is for every class in the CNN prediction result buffer (ContextOrResultClassId).

ControlFlag

Specifies how to control the drawing operation.

For all drawing operations except M_DRAW_CLASSIFICATION_SCORE, set this parameter to M_DEFAULT. Typically, these drawing operations apply to prediction results from a coarse segmentation.

function map For specifying how to control the classification score drawing
Click to summarizeValue Description
Click to summarize M_DEFAULT

Implements the default behavior. This is the only possible setting for all drawing operations except M_DRAW_CLASSIFICATION_SCORE.

(summarize)
Click to summarize M_BILINEAR_INTERPOLATION

Scales the classification map with a bilinear calculation, when using M_DRAW_CLASSIFICATION_SCORE. The scale is network property and established in receptive field calculations. The scaled image is placed at the offset of the receptive field.

(summarize)
Click to summarize M_RECEPTIVE_FIELD_PATCH

Fills the corresponding receptive fields with calculated scores, when using M_DRAW_CLASSIFICATION_SCORE. Scores are drawn in order, from low to high. The best score is therefore drawn over lower scores.

(summarize)
Compilation information
Header Include mil.h.
Library Use mil.lib; milclass.lib.
DLL Requires mil.dll; milclass.dll.
DEFAULT PROC NONE DRAW CLASS COLOR LUT DRAW CLASS ICON DRAW BEST INDEX CONTOUR IMAGE DRAW BEST INDEX IMAGE DRAW BEST SCORE IMAGE DRAW CLASSIFICATION SCORE CLASSIFICATION MAP SIZE PSEUDO COLOR REPLICATE BORDER DEFAULT CONTEXT GENERAL DEFAULT BILINEAR INTERPOLATION RECEPTIVE FIELD PATCH