ShapeLogic is an open source toolkit for declarative programming, image processing and computer vision.
The first real application for ShapeLogic is a particle analyzer
. It will find and categorize particles on a relatively uniform background then make a report of geometric properties for each of the particles. The main application is for recognizing cells in medical image processing.
Code hosted on http://code.google.com/p/shapelogic/
. From there you can download both source files and binary distributions.
Join the ShapeLogic mailing list
for announcements, questions, bug reports, suggestions and feature requests. You can help improving the stability of ShapeLogic by filing a bug report.
The first ShapeLogic implementation is in Java. ShapeLogic C++
was started in September 2008.
Started in ShapeLogic 1.5 the particle categorization, can either be handwritten rules or generated by machine learning
. The first machine learning technique in ShapeLogic is a multi-layer feed forward neural network that is trained externally but run internally.
Main ideas and motivation
ShapeLogic is a library for
While ShapeLogic's declarative programming system was initially developed for image processing and computer vision, it is widely applicable. It is currently difficult to combine declarative programming and image processing. ShapeLogic is intended as basic plumbing software that turns a logic engine into a simple plugin component to ease entry into vision and image analysis. ShapeLogic also fills gaps missing from current Java image processing libraries, and uses a commercially friendly license.
ShapeLogic has an automatic color particle analyzer
and a letter matching example
- Declarative lazy stream driven logic engine with lazy computations
- Specialized for the domain of image processing and computer vision
- The user can store rules in either a flat file or database, decreasing user reliance on Java programming
- User rules are written with Java or the Java 6 Scripting interface JSR 223. Groovy
have been tested
- Implementation of 2D geometry primitives, vectorization and segmentation
- It is free (as in free speech and free beer)
- Commercially friendly MIT open source software license, also called the X11 License
- Annotations of point as different type of junctions, end points, hard or soft points
- Annotations of lines as straight, curved, concave or inflection points
- Programmed in Java
- Can be used as a plugin for ImageJ, the leading Java open source project used in medical image processing
ShapeLogic 1.5 contains a color particle analyzer
Here is an example particle image embryos.jpg
Here is the result of running the non-customized particle analyzer on it.
The categories for the particles are only examples, it is easy to setup different rules for categorizing particles.
In ShapeLogic 1.6 train a neural network to categorize specific cells
ShapeLogic 1.5 also contains the second version of a color particle counter. It also prints a smaller report of the particle's properties.
To run as a library for functional and declarative programming there are no requirements.
To run as an ImageJ plugin ShapeLogic uses the following libraries:
ShapeLogic can either run as a plugin in popular ImageJ framework or stand alone in pure Java2D
- Commons math
: Math library for geometry
: For parsing build in filter language
You can run all current image processing algorithms outside ImageJ
, using just a BufferedImage should you want to embed ShapeLogic in your application.
These are used in unit tests, builds or old versions of image processing functionalities:
Development Status: Beta
- ShapeLogic is in Beta, as of version 1.0.
- Particle counter and particle analyzer
working directly on color images without manual user intervention.
- Working example where ShapeLogic is used for matching capital letters.
- Image processing algorithms now work both in ImageJ and on Java's BufferedImage
- The API is still under development.
- Contains a framework for declarative and functional programming.
- ShapeLogic currently consists of 35,000 lines of Java code including 550 unit tests.
started as an attempt to port some algorithms from ShapeLogic Java. ImageJ makes image processing programming very accessible under Java. While there are great open source libraries in C++ there did not appear to be anything like ImageJ with an commercially friendly OSS license. Before algorithms could be ported from ShapeLogic Java some of the functionality of ImageJ had to be established. Simplicity of programming is a main concern.
This was mainly a question of finding the best OSS C++ libraries and getting them to work together. After a good deal of experimenting this was the libraries that were chosen:
2009/04/09 ShapeLogic Java 1.5 with machine learning released
- Start combining machine learning
and declarative programming
- The categorize in Color Particle Analyzer can now either use rules or a multi-layer feed forward neural network, and it easier to select which particle properties to print out
The neural network need to be trained externally and you need override a class to import the weights. This override is simple but does require some knowledge of Java.
Documentation will soon be updated to reflect ShapeLogic 1.5.
2009/03/22 ShapeLogic C++ 0.5 released
- Added binary thresholds operations
- Threshold with fixed limit of 127
- Adaptive threshold with a small block size of 3
- Added morphological operations
2008/11/28 ShapeLogic Java 1.4 released
- Added mask option to particle analyzer
- Vectorize skeletonized
image, output points, lines, polygons and annotations, e.g. T-junction
- In Color Particle Analyzer output average color in R, G and B channels, to better handle particles in co-localization images
- Improve the color replacer plugin, to take separate RGB values as input
- Change annotation of points and lines to be on individual images instead of global
- Improved stability of particle analyzer
- Improved stability of lazy stream library: fixed bugs and added unit tests
- Built for JDK 1.5 / Java 5 so it should work on the Mac without updates
2008/11/14 ShapeLogic C++ 0.4 released
- Images are now internally stored in OpenCV's IplImage format
- More image formats: BMP, DIB, JPEG, JPG, JPE, PNG, PBM, PGM, PPM, SR, RAS, TIFF, TIF
- Made a few OpenCV image processing algorithm available:
- Canny edge detector
- Flip RB color
- Flip horizontally
- Flip vertically
- Made Boost Build Jamfiles that works both on Windows and other operating systems
- First release with development status Alpha
Future plans for ShapeLogic
For more up to date information on ongoing development work look at these
ShapeLogic 1.6 Java improve neural network
- Extend Multi-layer feed forward neural network to work with letter matcher
- Add functionality to load neural network from file
- Train a neural network to categorize specific cells
Low hanging fruits for ShapeLogic Java
- Expand OCR to cover lower case letters using neural network matching
- Make custom rules to recognize specific cells
. In v 1.4 the user has to make rules themselves. Mainly pending finding a relevant test case.
- Component framework
for hybrid and complex vision problems
- HSV mode for the particle analyzer
ShapeLogic C++ 0.6 soon to be released
- Make more OpenCV image processing algorithm available in menus
- Make generic dialog to get parameters for algorithms
Low hanging fruits for ShapeLogic C++
- Optimize draw
- Draw continues line instead of points
- More pen sizes for draw
- Change brushes to to have a class each brush, that takes parameters
- Macro system
The test images for the particle analyzer
Here are 2 other test image for the particle analyzer. They are taken from the sample images from ImageJ.
- Automatic color and gray scale particle counter and analyzer
, first medical image processing example.
- Letter matching example
. Very rudimentary OCR.
- Mathematical problems
from Project Euler
. This is a list of 193 mathematical problems that can be solved by computers. They vary in complexity from simple to hard. The goal is to test ShapeLogic's new declarative and functional constructs on real problems and make sure they are terse and intuitive.