5. Image Filters

This section explains how to create and edit image filters.

5.1. Usage

An image filter is an algorithm that will be run on one or more images to create another image.

Parameters can be specified to the algorithm.

This image filter extension rely on the filter plugin OrsPythonPlugins.OrsSimpleFilters.OrsSimpleFilters. Most of the methods to be overloaded in this extension come from the abstract filter plugin class ORSServiceClass.OrsPlugin.orsabstractfilterplugin.OrsAbstractFilterPlugin.

5.2. File location

To be recognized by the application, image filters should be located in one of these folders:

  • %LocalAppData%/ORS/Dragonfly(version)/pythonUserExtensions/PythonPluginExtensions/SimpleFilters/filters (available for the current user)
  • %ProgramData%/ORS/Dragonfly(version)/pythonAllUsersExtensions/PythonPluginExtensions/SimpleFilters/filters (available for all users)
  • %ProgramData%/ORS/Dragonfly(version)/python/OrsPythonPlugins/OrsSimpleFilters/filters (distributed with the application)

5.3. File creation

To create an image filter, start the application, start the OrsPythonPlugins.OrsSimpleFilterGenerator.OrsSimpleFilterGenerator (found in Developer/Simple Dataset Filter Generator), fill in the required fields and press the button Create filter.

5.4. File edition

Open the file in a text editor. Fill in the required methods.

5.5. Demos

Local filter

Source code example:

In this demonstration, a filter is made based on the Roberts’ cross operator, from the scikit-image package. This filter is local because the result at a given pixel depends only of the pixel in a close neighborhood.

  1. Download the file;
  2. Put that file into an image filter extension folder;
  3. Start the application;
  4. Import a dataset;
  5. Go to Tools/Image Processing Toolbox to start the Image Processing;
  6. In the combo box of operations, go to the section Demos to select DemoImageFilterRoberts;
  7. Press the button Compute Selected Preview to execute the filter on the dataset.

2D global filter

Source code example:

In this demonstration, a filter is made to classify each slice of a dataset in a number of classes specified by the user, based on Gaussian mixture models (GMM). This filter is 2D global because the result at a given pixel depends on the data of the whole slice.

  1. Download the file;
  2. Put that file into an image filter extension folder;
  3. Start the application;
  4. Import a dataset;
  5. Go to Tools/Image Processing Toolbox to start the Image Processing;
  6. In the combo box of operations, go to the section Demos to select DemoImageFilterGMM;
  7. In the options of the filter, in the field Class count, select the number of classes in which to classify (usually 2, 3 or 4);
  8. Press the button Compute Selected Preview to execute the filter on the dataset.