GDexIndex.gif Previous-2.gif Next-3.gif

Measure images (ImageMeasure)


One use of the DrawLine2D module is for probing and measuring images. The output of the DrawLine2D module, two XY positions, can be used in a number of different ways:

•      to measure the distance from the start to end point

•      to extract the values of the image at the end points of the line

•      to extract the values of the image of the points that are under the line

 

GENERATE/FH413304.gif

Starting up

  1. 1.      Start AVS/Express and choose None from the startup dialog, or if you have an existing AVS/Express session, delete or close any existing application workspaces that you have open.
  2. Instance the example

    Instance ImageMeasure into the empty NE workspace.

    This example is found in Libraries.Examples.Graphics_Display. Upon being instanced, the example renders a slice from wind.fld in the viewer's window.

    Probe the slice

    We are now ready to probe values in the slice.

    Select Editors->Modules to make the modules user interface panel visible. Select DrawLine2D from the Modules option menu. This causes the user interface for the DrawLine2D module to appear.

    Begin probing the view by drawing a line.

    The mouse operations that control the line drawing are:

    Mouse-controlled operations

     

    Gesture

     

    Draw line.

    Hold down right button, and drag the mouse.

     

    The DrawLine2D module draws a line from the start position to the end position As long as the right button is held down the a line is drawn from the start position to the current end position. When the right button is released, the line is converted into a field.

    The start and end points of the line are then displayed in the user interface for the DrawLine2D module. By default, the module updates the XY position immediately when the right button is released.

    The slice of wind.fld has dimensions of 25 by 32. Notice that when the line is inside the extents of the slice, the values displayed in the DrawLine2D user interface for X and Y are in that range.

    In the ModuleStack workspace, look at the slice values.

  3. 1.      Maximize interp_data.
  4. Open DVinterpolate_data.

    Open out_nd.

    Open the node_data array. It should look like "node_data[1]".

    Scroll up to find the node_data array. It should have two arrows on it to indicate that it is an array. Press the right arrow once to access the first (and only) entry of the array.

    Open the values array. It should look like "values[2][1]".

    Resize DVinterpolate_data so you can easily see both entries in the array.

    The entries in the array are in order the scalar value at the start point and the scalar value at the end point. In this case, the scalars are of type float.

    Cleanup

    This completes the example.

    Delete the ImageMeasure application.

     



    GDexIndex.gif Previous-2.gif Next-3.gif