Quantum GIS plugins
Please see Quantum GIS access to OTB applications
- 1 Context
- 2 Currently Implemented OTB-QGIS Functions
- 3 QGIS Plugin architecture
- 4 C++ QGIS plugin - How it works
- 5 Installation
- 6 Processing
- 7 Plugin 0.1
- 8 Plugin 0.2
- 9 Plugin Monteverdi Edition
- 10 TODO list
- 11 Future development: design
- 12 Known Issues
Orfeo Toolbox (OTB) is a free software that provides satellite image processing tools (classification, segmentation, object extraction). More information is available on the Orfeo Toolbox website at http://www.orfeo-toolbox.org/
Quantum GIS (often abbreviated to QGIS) is a free software desktop Geographic Information Systems (GIS) application that provides data viewing, editing, and analysis capabilities. More information is available on Quantum GIS website at http://www.qgis.org/
Currently Implemented OTB-QGIS Functions
- Segmentation using Region Growing
- SVM Classification
- KMeans Clustering
- SOM Clustering
- Disparity Map estimation and coregistration
- Call to full Monteverdi application, with layers open in Qgis accessible to Monteverdi as well.
QGIS Plugin architecture
QGIS has been designed with a plugin architecture. This allows new features/functions to be easily added to the application. Many of the features in QGIS are actually implemented as core or external plugins.
- Core Plugins are maintained by the QGIS Development Team and are automatically part of every QGIS distribution. They are written in one of two languages: C++ or Python.
- External Plugins are currently all written in Python. They are stored in external repositories and maintained by the individual authors. They can be added to QGIS using the Plugin Installer.
|Python plugin||C++ plugin|
|Facility of integration of OTB code||+||+++|
|Documentation available in QGIS||++||+|
C++ QGIS plugin - How it works
C++ QGIS plugin are shared library in the plugins directory.
- QGIS check all the .so library available in the plugins directory
- Check if all the library linked to the plugin are loadable (set LD_LIBRARY_PATH by adding the path of shared libraries called by your plugin if your plugin does not appear in the plugin manager)
The source code is available on the repository via :
hg clone http://hg.orfeo-toolbox.org/OTB-Qgis-plugins/
The OTB plugins are compiled as any other OTB based project, based on CMake. So you should create a specific build directory, cd into it, and then :
The necessary Cmake variables to set (if not automatically found) are :
For Windows users: OTB is compiled with a statically linked version of GDAL, qgis by default uses a dynamically linked version from osgeo4w. Switch QGIS to the static version. There will be duplicate symbol definitions in the plugin use /FORCE:MULTIPLE compiler option in MSVC.
For Linux users: if OTB libraries are not in a standard accessible way from the PATH, you need to add their location in the LD_LIBRARY_PATH. Otherwise the OTB plugins does not appear in the qgis plugin manager (see known issue below for more details).
Architecture of the plugin:
Proposition of a generic architecture of OTB plugins.
The first plugin developed process a segmentation using a region growing algorithm. The user have to browse image on his desktop. It is a plugin but it works more like a standalone application (like most of qgis plugins).
- Need to browse the input raster from a file (not from the list of raster data loaded in the QGIS panel)
This version focus on a more reliable integration of OTBs functions in QGIS. The user browses now the raster layer loaded in QGIS and create a QGIS vector layer.
If the segmentation succeed, the plugin automatically adds a vector layer in the Quantum GIS legend (this layer refers to a shapefile which is the result of the segmentation).
OTB Plugin Interface
OTB Plugin Output
Plugin Monteverdi Edition
This is an attempt to link the entire Monteverdi application to the QGis application. All the layers (file based) loaded in QGis become available to Monteverdi and these can used to perform filtering, classification etc.
- Refining the architecture for developing QGIS plugin outside Quantum GIS (for now plugins are developed inside QGIS sources.
- Streamline Qgis plugin creation technique.
- Browse a QGIS layer and not a file in the GUI of the OTB plugin (in dev)
- Refactor OTB plugins codes to allow generation of automatic plugin interface
- Generation of GUI for OTB functions (generic GUI).
- Structure of OTB plugin GUI?
- Which OTB functions need to be integrate in priority?
- Data provider into QGIS to load the orbit based unorthorectified and orthorectify on the fly (SAR Models and RPC/Aerial Models).
- Reuse ossim on the fly reprojection capability to add raster reprojection in Qgis.
Future development: design
The current plugins (as of August 2010) rely on writing the data on the disk after processing before reopening it to be available in QGIS. The goal is to provide directly the result of the processing without going thought disk writing.
- an otbImageToQImageFilter which take the QgsRectangle (viewExtent) and spacing (pixelWidth and pixelHeight) and output a QImage. This filter will be at the end of the pipeline defined by the plugin and provided to the otbprovider (see below).
- an otbprovider modeled after the WMSProvider. This provider contains and internal pointer to an instance of an otbImageToQImageFilter (provided by the plugin). The draw() method of the provider call the Update method on the otbImageToQImageFilter and retrieve the QImage as an output.
- plugin: the plugin defines the processing pipeline, finish it by an instance of otbImageToQImageFilter. The plugin creates an otbprovider and pass it the otbImageToQImageFilter (cf details on the grass plugin?).
- Plugin does not appear anymore in the plugin manager of qgis : path of a library use by the plugin is missing (add OTB's libraries path to ld_library_path)
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/otb/otb-build/bin
- or launch as qgis_install/bin$ LD_LIBRARY_PATH=$HOME/OTB/OTB-Binary/bin:$HOME/OTB/Monteverdi-Binary/bin ./qgis
- Conversion between QChar * (output of the GUI) and char * (input in OTB) :
- best practices : qstring -> qbytearray -> char *
- itk::ERROR: PNGImageIO(0x219f750): Pixel type currently not supported. typeid.name = N3itk8RGBPixelIhEE
- compile OTB and Monteverdi as static with CMAKE_CXX_FLAGS, CMAKE_C_FLAGS and CMAKE_EXE_LINKER_FLAGS with -fPIC
- same -fPIC for QGis
- for more information, see http://lists.osgeo.org/pipermail/qgis-developer/2010-August/010763.html