PyOSSIM : Google Summer of Code, 2011 Project Page

Student Name
Vipul Raheja

Aim of the project
The aim is to expose the OSSIM and OSSIMPlanet API to Python in order to extend their functionalities to other essential GIS and remote sensing analysis tools like GRASS, QuantumGIS and libraries like GDAL etc. The software package consists of:

  • Software libraries,
  • Command line tools, and
  • GUI applications

OSSIM already has some API exposed using the SWIG interface as wrapper. Hence, The Python bindings for the core library will be used to write a toolbox based on the OSSIM function as an extension to GRASS and QGIS for image analysis while the python bindings for the OSSIMPlanet API will be used to extend the PlanetSasha functionalities inside the respective GRASS and QGIS plug-in.

Project Proposal is listed at:
GSoC Proposal

Old Page can be seen at:

Project repository present at:
Github Code Repository

Week 1 Report

Work Done

  • Delved into the requirements for PyOSSIM by understanding the source code structure better
  • Set up the following:
    • Wiki Page
    • Code Repository
    • Local development environment by downloading and building the OSSIM Source

Problems Faced
Mostly I had issues with the building part only. There were problems when I disabled video to keep the ossimPredator disabled and out of the build - this was done initially to handle problems posed by ffmpeg while building, so it was decided to keep it out of the build and make a cleaner build. But that had many other dependencies to be taken care of including the various CMakeLists.txt files to handle the same. Due to incomplete handling, the build was giving problems and not compiling completely.
But later, the build compiled smoothly on a fresh machine running Ubuntu Maverick (earlier it was Lucid).

Work to be done in Week 2

  • Read and understand about Python/C++ API
  • Start to read and learn about SWIG wrapping techniques and so as to understand the general python wrapping better and the problems exposed by it in context of OSSIM
  • Get an idea about oms.i - the SWIG-Java wrapping interface for OSSIM, and start understanding it to 'Pythonize' it in the future.

Week 2 Report

Work Done

  • Read quite a chunk of the SWIG 2.0 Documentation so as to understand the lower-level details of language wrapping techniques, specifically in context of Python and C/C++.
  • Read about Python embedding and extension, so as to understand how Python facilitates the addition of a new set of commands for extending it's interpreter with new modules.

Problems Faced
None as yet

Work to be done in Week 3

  • Continue reading and start dive into the OSSIM SWIG interface.

Week 3 Report

Work Done

  • Completed the reading aspect of development of SWIG skills. Including the Python and SWIG aspect.
  • Coded a Python-SWIG Interface for ossimjni. Compilation and testing still in progress.

Problems Faced

  • Some issues regarding the compilation of osssimjni-Python interface are yet to be solved. Working on the same.
  • The code could not be committed on the repository due to an upgrade in my college firewall. I have requested for permission for external access from the concerned authorities.

Work to be done in Week 4

  • Learning more about which API are exposed in the SWIG-Java wrapper and start the Python porting.

Week 4 Report

Work Done

  • Solved most of the compilation problems that were occurring last week in the building of ossimjni Python interface.
  • Found a workaround to proxy-tunnel through my college firewall. Will commit the code today (June 18, 2011) itself on github page.

Problems Faced

  • Only one outstanding issue remains - that of libossimjni not being created in the build which is leading to all the problems. Working on that with Massimo and David Burken.

Work to be done in Week 5

  • Study about Python distutils for future integration.
  • Get access to svn repository so as to commit and update code directly to the repository here.
  • Start working on the oms.i - the main Java-Swig interface of OSSIM, and begin working on Pythonizing it.

Week 5 Report

Work Done

  • Read the Python-Distutils documentation and learnt about the Python package distribution mechanism.
  • Updated the GitHub project page with the code (chiefly the local environment). The Python-version of ossimjni extension can be found here.

Problems Faced

  • I did start coding the core PyOSSIM code based on the pre-existing Java-OSSIM Wrapper Interface oms, but after some discussions with the community, the work was stopped till my mentor Massimo was back (26 June) to give guidance and resolve. In the meantime, I devoted my time to studying about Python-Distutils and completed it.
  • Could not get svn access since Massimo is travelling. Should be available soon.

Work to be done in Week 6

  • Get access to svn repository so as to commit and update code directly to the repository here.
  • Study about NumPy and PIL (Python Imaging Library) to learn the "Array passing functionality" with OSSIM and Python.
  • Resume coding the SWIG-Python Interface for OSSIM.

Week 6 Report

Work Done

  • Completed reading about Python Imaging Library (PIL) to understand more about image handling using the pre-existing library Python.
  • Dived into some aspects of Numpy, will complete reading this week and understand about handling the 'Image Array Passing' with reference to OSSIM.
  • Coded the basic swig-wrapper interface classes for the OSSIM imaging and init modules. I am still working on projection and base classes and will continue doing so over the next week.
  • Code committed to GitHub Page.

Problems Faced

  • No major blocking issues as such.

Work to be done in Week 7

  • Continue coding the projection and base module swig-wrappers.
  • Read about Numpy.
  • Draft a hierarchy for the classes wrapped for easing out future code readability, understanding and maintenance.

Week 7 Report

Work Done
This week was quite progressive and much work reached completion this week.

  • Finalized on the hierarchy of wrapped classes as the one similar to the existing one i.e. functionality-based for easy understanding and maintainability of code.
  • Coded the basic swig-wrapper interface classes for the OSSIM projection and base modules. This completed the coding of some basic classes of the library.
  • Compiled and tested the init and imaging interface wrappers coded earlier by importing the pyossim module from a Python console and calling different functions of respective classes. The porting has been good so far, giving smooth results.
  • Code has been committed to GitHub Page. (In the init and imaging modules). The init module also contains the compiled files, SWIG-generated files and the resulting python library.

Problems Faced

  • Out of total 36 wrapped classes in the imaging and init modules, 3 still need cleaning up due to Swig errors. Working on them.
  • There were small issues here and there relating to improper wrapping of Macros. But they were solved and there are no outstanding major blocking issues as such.

Work to be done in Week 8

  • Continue the compilation and testing for the projection and base module swig-wrappers.
  • Upon completion of the compilation/Testing process, evaluate the API missed, and proceed accordingly based on the testing/compilation feedback as well as requirement of additional functionality needed to be wrapped.
  • Begin work on the packaging of the PyOSSIM API in a Python module.
  • Fill out the Midterm evaluation on Melange.

Week 8 Report

Work Done

  • Filled in the Mid-Term Evaluation on Melange.
  • Coded additional swig-wrapper interface classes for the OSSIM base and projection modules. This completed the coding of some basic classes of the library.
  • Compiled and tested the base and projection interface wrappers coded earlier by importing the pyossim module from a Python console and calling different functions of respective classes. The porting has been giving smooth results, much like the earlier init and imaging modules.
  • Also, I coded some interface wrappers for elevation and font modules. Compilation and individual testing also done.
  • Code has been committed to GitHub Page.

Problems Faced

  • No major blocking issues.

Work to be done in Week 9

  • Work on the packaging of the PyOSSIM API in a Python module, i.e. creating a single .so library out of all the compiled ones.
  • Work on creating a test-suite for easy usage of the wrapped library, as well as for the binding testing.

Week 9 Report

Work Done

  • I tried packaging the classes into a single module in Python but the methods I tried didn't work out. I also contacted people on the SWIG developer mailing lists but even their methods did not work. There is one brute force way to make things work but we are avoiding it since it will make the code lose its modularity and turn it into a big mess. Work is still on in this regard. I have also contacted the GDAL list for help.

Currently, all classes individually compile and a '' file gets created, which can be smoothly imported from Python also (via an 'import pyossim' command, but it is accessible for only one class at a time. What we want is access to all classes from a single compilation. Hence the packaging issue.

  • I also spent a lot of time travelling back home this week, so to save time, I have started reading up on SIP in order to stay on track with the project timeline.

Problems Faced

  • The packaging issue mentioned above. Work is on for this, help expected from the GDAL people.

Work to be done in Week 10

  • Continue reading up SIP.
  • Work on solutions to solve the issue with packaging.

Week 10 Report

Work Done

  • I was not able to do much work this week since I was travelling the past week and was busy with the administrative chores owing to the beginning of a new academic semester, hence I could not work for quite some days.
  • However, I had a major breakthrough, because of which the code has been drastically reduced (~70%). Also, I was also able to package the entire PyOSSIM as a single module, which was seeming difficult earlier.

Problems Faced

Work to be done in Week 11

  • Complete the restructuring of wrapped code and implement the optimization changes.
  • Start work on wrapping the OSSIM PyQt API.

Week 11 Report

Work Done

  • Restructured the pyOSSIM-SWIG wrapper code, i.e. I made the changes that were required because of the optimization that was found last week. The SWIG-wrapper code was toned, made very modular and structured. The code is now very easy to understand and maintain, and has been committed on the GitHub repository.
  • Finished up reading the SIP documentation required for wrapping the ossimPlanetQt API.
  • Set up the PyQt and SIP environments on my local system. This step took a long time due to problems with debian-based packages. I had to then do a manual build with the help of PyQt people.
  • Started work on creating a test-suite for pyOSSIM. There is a blocking issue which needs to be solved in this regard.
  • Began working on the wrappping of ossimPlanetQt. I was able to create a library(.so file) out of the wrapped classes, but there is an issue with accessing it from the Python console. Work is in progress. If this issue is cleared, completion of wrapping for ossimPlanetQt is just a matter of time.

Problems Faced

  • As mentioned above, there is an issue while accessing the .so file from the Python console. The library gets created but upon invoking it from a Python console, it gives an ImportError. Working on solving it with the PyQt people. After this is solved, pyOssimPlanetQt wrapping will be completed.
  • There was an issue while developing the pyOSSIM test-suite regarding the wrapping of a Python list to a char**. I mailed the SWIG mailing list 2 days back but didn't get any replies. No replies on stackoverflow either.
  • There was another problem that cropped up while pyOSSIM testing. The library works fine in Python but when one exits the console, it exits with a segmentation fault. Working on the same with Python-list people.

Work to be done in Week 12

  • By solving the above-mentioned blocking issues, we will more or less close-in on most of the project objectives of pyOssim wrapping, pyOssimPlanetQt wrapping and building a test-suite for the same.

Week 12 Report

Work Done

  • This week I devoted my time in handling the issues that were blocking progress. I was able to progress a bit with every problem, but wasn't able to completely solve each. I have been in constant touch with people from SWIG-dev, Python-list, PyQt-dev and OSSIM-dev lists as well as on IRC.
  • I was able to create a .so in pyOSSIMQt but there are further issues with SIP which are taking time due to lack of documentation and support.
  • I have almost completed coding the testing suite, I was able to create a mini-library for testing. With some more help from David Burken, should be able to complete it fully.
  • Added around 70 more classes to base and imaging modules of pyossim.
  • The PyQt and Python-segfault issues are at the backseat as of now.

Problems Faced

  • Same as last week, but with some progress in each one. Work is on.

Work to be done in Week 13

  • Wrapping up of testing module.
  • If time permits, handling the Qt issues.

Week 13 Report

Work Done

  • Major breakthroughs were made this week. Apart from a change in project scope and plan, major additions were done this week and progress made.
  • The issues regarding the basic test-suite and segmentation fault were found and solved.
  • The basic testing suite was completed, based on the lines of ossimjni API.
  • Significant number of more classes were added to the pyOSSIM core library. These included major additions in imaging (~90 classes added) and base (~30 classes added) modules. The pyOSSIM library now contains close to 300 wrapped classes, as opposed to ~130 two weeks back.

Problems Faced

  • Same as past two weeks, but were eventually solved.


  • The documentation explaining directory structure and compilation instructions was completed earlier itself.
  • The basic tests are there in place, I shall be working on the project further, mainly on making the test-suite better and intensive.
Last modified 13 years ago Last modified on Aug 20, 2011, 10:05:45 AM
Note: See TracWiki for help on using the wiki.