Skip to content
Kaspar Schmid edited this page Apr 16, 2015 · 3 revisions

init() is called once, when your plugin is created by the user. Use this method to initialize your class members, set basic process settings, add inputs and outputs and add process properties.

Init members

If you have private members which need to be initialized, do it here.

// init
 _result     = NULL;

Basic settings

  • setClassName: is used to identify the process at runtime
  • setTitle: is presented to the user in ImagePlay, for example in the Process Library
  • setCategory: is used to assign your plugin to one of ImagePlay's categories in the Process Library
  • CATEGORY_UNDEFINED
  • CATEGORY_IO
  • CATEGORY_CONVERSIONS
  • CATEGORY_ARITHMETIC
  • CATEGORY_GEOMETRY
  • CATEGORY_POINTOPERATIONS
  • CATEGORY_LOCALOPERATIONS
  • CATEGORY_MORPHOLOGY
  • CATEGORY_HISTOGRAM
  • CATEGORY_EDGES
  • CATEGORY_GRADIENTS
  • CATEGORY_FOURIER
  • CATEGORY_OBJECTS
  • setOpenCVSupport: define if your process uses OpenCV.
  • OPENCV_NONE: the process only provides an own implementation
  • OPENCV_OPTIONAL: the user can choose to use either OpenCV or your own implementation
  • OPENCV_ONLY: the process only provides a OpenCV implementation
  • setDescription: a short description of your algorithm which will be displayed below the process settings
  • setKeywords: additional keywords which will be used to find your process in the process library when the user types to filter.
// basic settings
setClassName("TutorialAlgorithmPlugin::TutorialAlgorithm");
setTitle("TutorialAlgorithm");
setCategory(IPLProcess::CATEGORY_POINTOPERATIONS);
setOpenCVSupport(IPLOpenCVSupport::OPENCV_NONE);
setDescription("This algorithm shows how to create a simple plugin");
setKeywords("TutorialAlgorithm");

Inputs and outputs

A process can have multiple inputs and outputs. Add them here to indicate to the user what type of data your algorithm will take and produce. The input name will be presented to the user.

  • addInput: Define as many inputs as your algorithms takes. Inputs can only be connected once.
  • addOutput: Define as many output as your algorithms produces. Outputs can only be connected indefinitely.
// inputs and outputs
addInput("Image", IPLData::IMAGE_COLOR);
addOutput("Grayscale Image", IPLData::IMAGE_GRAYSCALE);

Process properties

All variables which can be changed by the user must be added as process property which then automatically generates GUI elements. Changing the GUI elements automatically requests the execution of your algorithm and presents the results to the user.

A process property is a combination of data type and widget type. Use the following methods to add different data types:

  • addProcessPropertyInt
  • addProcessPropertyUnsignedInt
  • addProcessPropertyDouble
  • addProcessPropertyFloat
  • addProcessPropertyBool
  • addProcessPropertyString
  • addProcessPropertyVectorInt
  • addProcessPropertyColor
  • addProcessPropertyPoint

Use the following widget types to define how the property can be changed by the user:

  • IPL_WIDGET_HIDDEN
  • IPL_WIDGET_CHECKBOXES
  • IPL_WIDGET_RADIOBUTTONS
  • IPL_WIDGET_COMBOBOX
  • IPL_WIDGET_SLIDER
  • IPL_WIDGET_SPINNER
  • IPL_WIDGET_SLIDER_ODD
  • IPL_WIDGET_SLIDER_EVEN
  • IPL_WIDGET_TEXTFIELD
  • IPL_WIDGET_LABEL
  • IPL_WIDGET_TITLE
  • IPL_WIDGET_FILE_OPEN
  • IPL_WIDGET_FILE_SAVE
  • IPL_WIDGET_FOLDER
  • IPL_WIDGET_KERNEL
  • IPL_WIDGET_BINARY_MORPHOLOGY
  • IPL_WIDGET_BINARY_MORPHOLOGY_TRISTATE
  • IPL_WIDGET_GRAYSCALE_MORPHOLOGY
  • IPL_WIDGET_COLOR_RGB
  • IPL_WIDGET_COLOR_HSL
  • IPL_WIDGET_COLOR_HSV
  • IPL_WIDGET_POINT
  • IPL_WIDGET_BUTTON
// properties
addProcessPropertyDouble("threshold", "Threshold", "0.0 < threshold < 1.0", 0.5, IPL_WIDGET_SLIDER, 0.0, 1.0);