LImageViewerCell::CalibrateRuler

Summary

Calibrates the selected ruler inside the specific cell or sub-cell.

Syntax

#include "ltwrappr.h"

L_INT LImageViewerCell::CalibrateRuler(nSubCellIndex, dLength, uUnit, uFlags)

Parameters

L_INT nSubCellIndex

A zero-based index of the image list attached to the cell. This image contains the ruler annotation object that the user chooses to calibrate. Pass -1 to apply this effect on all sub-cells. Pass -2 to apply this effect on the selected sub-cell.

L_DOUBLE dLength

Value that represents the length to be assigned to the ruler. The measurement unit of the length is specified by the value of uUnit parameter.

L_UINT uUnit

Value that specifies the measurement unit of the length.  Possible values are:

Value Meaning
CONTAINER_RULERUNIT_INCHES [0] Inches.
CONTAINER_RULERUNIT_FEET [1] Feet.
CONTAINER_RULERUNIT_MICROMETERS [2] Micrometers.
CONTAINER_RULERUNIT_MILLIMETERS [3] Millimeters.
CONTAINER_RULERUNIT_CENTIMETERS [4] Centimeters.
CONTAINER_RULERUNIT_METERS [5] Meters.

L_UINT uFlags

Flags that indicate the direction to which the calibration is applied. Possible values are:

Value Meaning
CONTAINER_CALIBRATERULER_BOTH [0] Calibrate both axes.
CONTAINER_CALIBRATERULER_VERTICAL [1] Calibrate vertical axis only.
CONTAINER_CALIBRATERULER_HORIZONTAL [2] Calibrate horizontal axis only.

The following flags that determine whether to apply the feature on the one cell only, or more than one cell. This value can only be used when the cell is attached to the LImageViewer through the function LImageViewer::InsertCell. Possible values are:

Value Meaning
CELL_APPLYTOTHIS [0x00000000] Apply the feature to this cell only.
CELL_APPLYTOALL [0x10000000] Apply the feature to all the cells in the Image Viewer.
CELL_APPLYTOSELECTED [0x20000000] Apply the feature to the selected cells in the Image Viewer.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

This function works only on the ruler annotation. To calibrate one or both axes, set the uFlags parameter. To calibrate the cell without having to use a ruler, use the LImageViewerCell::CalibrateCell function.

To calibrate the ruler it must be selected before calling the function; otherwise, the function will return ERROR_INV_PARAMETER.

If the measurement unit of the selected ruler differs from the measurement unit of the viewer, the value of the uUnit parameter will be ignored and the measurement unit of the viewer will be used instead. (For example: if the user calibrates the ruler to 1 inch, and the viewer measurement unit is centimeters, the ruler length will be 2.54 centimeters).

To obtain the measurement unit of the viewer, call the LImageViewerCell::GetRulerUnit function.

To change the measurement unit of the viewer, call the LImageViewerCell::SetRulerUnit function.

Image viewer must be created before calling this function using Create function or an error will be returned.

Required DLLs and Libraries

See Also

Functions

Topics

Example

Calibrate the ruler using the Cm.

L_INT LImageViewer_CalibrateRulerExample(LImageViewerCell& ImageViewerCell)  
{ 
   L_UINT uUnit;  
   L_DOUBLE dValue = 2; 
 
   ImageViewerCell.GetRulerUnit(&uUnit, 0);  
 
   if (uUnit != CONTAINER_RULERUNIT_CENTIMETERS)  
      ImageViewerCell.SetRulerUnit(CONTAINER_RULERUNIT_CENTIMETERS, 0);  
 
   ImageViewerCell.CalibrateRuler(0, dValue, CONTAINER_RULERUNIT_CENTIMETERS, 0);  
 
   return SUCCESS;  
} 

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Medical Image Viewer C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.