#include "ltivw.h"

L_LTIVW_API L_INT L_DispContainerCalibrateRuler(hCellWnd, nSubCellIndex, dLength, uUnit, uFlags)

L_HWND hCellWnd;

handle to the cell window

L_INT nSubCellIndex;

index into the image list attached to the cell

L_DOUBLE dLength;

length assigned to the ruler

L_UINT uUnit;

units of the length

L_UINT uFlags;


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

Parameter Description
hCellWnd A handle to the window that represents the cell on which the function's effect will be applied.
nSubCellIndex A zero-based index into the image list attached to the cell specified in nCellIndex. 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.
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.
uUnit Value that specifies the measurement unit of the length. Possible values are:
  Value Meaning
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 function was successful.

< 1

An error occurred. Refer to Return Codes.


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 L_DispContainerCalibrateCell 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 than the measurement unit of the viewer, the value to 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 was centimeter, the ruler length will be 2.54 centimeter).

To obtain the measurement unit of the viewer, call the L_DispContainerGetRulerUnit function.

To change the measurement unit of the viewer, call the L_DispContainerSetRulerUnit function.

Required DLLs and Libraries


For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also


L_DispContainerCreate, L_DispContainerDestroy, L_DispContainerSetAction, L_DispContainerAddAction, L_DispContainerGetRulerUnit, L_DispContainerSetRulerUnit, L_DispContainerCalibrateCell, L_DispContainerSetCellTag, L_DispContainerSetSubCellTag.


Working with Annotations

Image Viewer Functions: Working with Annotations


Calibrate the ruler using the Cm.

L_INT DispContainerCalibrateRulerExample(HDISPCONTAINER hCon, L_DOUBLE dValue) 
   L_UINT uUnit; 
   if (L_DispContainerGetCellCount(hCon, 0) == 0) 
      MessageBox(NULL, TEXT("you must at least have one cell added to the viewer"), TEXT("No Cell attached"), MB_OK); 
      return FAILURE; 
   HWND hCellWnd = L_DispContainerGetCellWindowHandle(hCon, 0, 0); 
   L_DispContainerGetRulerUnit(hCellWnd, &uUnit, 0); 
      L_DispContainerSetRulerUnit(hCellWnd, CONTAINER_RULERUNIT_CENTIMETERS, 0); 
   L_DispContainerCalibrateRuler(hCellWnd, 0, dValue, CONTAINER_RULERUNIT_CENTIMETERS, 0); 
   return SUCCESS; 

Help Version 19.0.2017.10.18
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Medical Image Viewer C API Help