SuperDraw

Synopsis

The SuperDraw user macro is an enhanced polyline editor. It is possible to add new points at the end of the polyline or between two existing points in the polyline. It is also possible to move or delete individual points in he polyline. The whole polyline can be translated or deleted. The created polyline can be made either open or closed.

Input Ports

Name Type Description

parent UIconnection Connection to the User Interface.
obj_in GDobject_templ Object that defines canvas dimensions.
view_in GDview_templ Output of the viewer; connection to the current object.

Parameters

Name Type Description UI Control

command int Current drawing type. Radio Box
type int Defines if polyline should be closing. Toggle

Output Ports

Name Type Description

out_points float[][2] Coordinates of the created polyline points.
out_mesh Polyline Mesh Points and connectivity which represent the data.
out_obj DefaultObject Directly renderable output object.

Description

The SuperDraw macro allows the user to generate and edit a polyline in 2D space. As such it is similar to the Click_Sketch AVS/Express macro. However the SuperDraw macro is a much more comprehensive macro. It allows the user to construct a polyline by sequentially adding points at the end of the polyline. However it also allows the user to add points in between two existing points. It allows the user to move or delete existing points and translate the whole polyline. Finally the polyline can be opened or closed at any point. The SuperDraw macro could be used for many different purposes. For instance it could be used to segment an image by hand. The other macros in this project(LineResampler and RegionResampler) are intended to build on this macro and extend its functionality. They provide ways of generating more points from the a polyline hence allowing it to be used as, for example, a probe.

The SuperDraw macro is actually used by first selected a drawing operation and then holding down Ctrl and right clicking in the main viewer. It is possible to either click twice at the start and end of a segment or click and drag. If you click and drag a 'rubber-band' will appear to indicate where the current segment will be created. However with both of these methods it is essential that you always hold down Ctrl and use the right mouse button. If you do not do this then nothing will happen.

If you are moving or deleting points then the point nearest to the mouse click will be either moved or deleted. The user inteface also provides an option for deleting all points of the polyline and translating the line in the 2D space. Translating the line is also achieved by Ctrl right dragging. Finally an option is available to close the curve. This simply connects the first point of the polyline to the last point.

Inputs

parent : UIconnection

This is the port that automatically connects the user interface of the module to the user interface of AVS/express.

obj_in : GDobject_templ

DataObject input that is used to get a coordinate space to draw on. If, for example, a picture is being segmented this input will be the image.

view_in : GDview_templ

Output of the 2D viewer that is being used for drawing input. This input is used to received the inputs that the user makes by clicking the mouse in the viewer window.

Parameters

command

Integer parameter that is used to specify which drawing operation should be performed. This parameter can have the following values:

  1. Inactive : Disables the SuperDraw macro.
  2. Append point : Adds a point at the end of the polyline.
  3. Add point between : Adds a point between two existing polyline points.
  4. Move point : Moves an existing point.
  5. Delete point : Deletes an existing point.
  6. Delete all points : Deletes entire polyline, and automatically sets SuperDraw macro to be inactive.
  7. Translate line : Moves entire polyline.

type

Integer parameter that specifies if the polyline should be closed. If set the last point in the polyline will be connected to the first point and a closed loop will be formed.

Outputs

out_points : float[][2]

This output represents all points of the polyline. Its values are saved in 2D coordinate space and it can be used for further processing of the polyline. The other macros in this project accept this output.

out_obj : DefaultObject

This port is suitable for direct connection to a viewer. A 2D viewer is recommended since the generated polyline only has 2D coordinates.

out_mesh : Polyline Mesh

This mesh output represents the polyline. It is a combination of the points output and the connectivity between the points. It can be input into other AVS/Express modules for further processing of the polyline.

Example

The SuperDrawEg example application illustrates how the SuperDraw macro can be used. It reads an image and then allows the user to draw on the image.

Files

iac_proj/draw/drawmods.v Creates the DrawMods library containing the low-level modules RegionResamplerCore, LineResamplerCore, SuperDrawCore and the parameter blocks DrawLineParams and LineResamplerParams.

iac_proj/draw/drawmacs.v Creates the DrawMacs library containing the user interface macros SuperDrawUI and LineResamplerUI, the functional macros SuperDrawFunc and LineResampleFunc, and the user macros SuperDraw, LineResampler and RegionResampler.

iac_proj/draw/drawapps.v Creates the DrawApps library containing the example applications SuperDrawEg, LineResamplerEg, and RegionResamplerEg.

Other Notes

The low-level DrawMods library containing the low-level modules does not specify a process. By default the express process will be used.

Author

Mario Valle,
AVS Inc.

Modifications

Anja Bindrich, Andrew Dodd,
International AVS Centre

Contact

International AVS Centre
Manchester Visualization Centre
Manchester Computing
University of Manchester
Oxford Road
Manchester
United Kingdom
M13 9PL

See Also