Table of Contents

ShapeLogic

Main ShapeLogic menu

Introduction

The ShapeLogic plugin add the ability to create rule based programming under ImageJ, for categorizing particles and lines. ShapeLogic has a framework for functional and declarative programming, using lazy streams.

Author

Sami Badawi

Applications

Currently there are 2 applications and a few utilities.

Color Particle Analyzer

This works directly on a color image and find gray and color average color of each particle.

Can run in different modes:

Algorithm:

Currently there is only a example categorization, based on the aspect ration and color intensity. The syntax for the rules for this categorization is the same as for the letter match. See below.

Usage

Part of ImageJ sample image embryos.jpg

 Part of ImageJ test image embryos.jpg

Output if mask option was checked

 Output if mask option was checked

Set input parameters manual and automatic mode

 Input dialog  Input dialog

Particle count dialog

 Particle count

Particle property result table

 Particle properties

Since ShapeLogic 1.4 there is also a mean R, B and G channel for color images

OCR example

ShapeLogic also contains a rudimentary OCR example that analyzes skeletonized lines and matches the to rules for capital letters.

This is a proof of concept not an attempt to make a The point was not to set up a

Usage

Input example:

Call ShapeLogic → CapitalLettersMatch

You will see the skeletonized lines, and the vectorized polygon in gray lines

Result is presented as a dialog box with a letter match for each polygon

Rule syntax

Rule for the letter A in the letter match example:

rule("A", POINT_COUNT, "==", 5., letterFilter);
rule("A", HOLE_COUNT, "==", 1., letterFilter);
rule("A", T_JUNCTION_LEFT_POINT_COUNT,"==", 1., letterFilter);
rule("A", T_JUNCTION_RIGHT_POINT_COUNT,"==", 1., letterFilter);
rule("A", END_POINT_BOTTOM_POINT_COUNT, "==", 2., letterFilter);
rule("A", HORIZONTAL_LINE_COUNT, "==", 1., letterFilter);
rule("A", VERTICAL_LINE_COUNT, "==", 0., letterFilter);
rule("A", END_POINT_COUNT, "==", 2., letterFilter);
rule("A", SOFT_POINT_COUNT, "==", 0., letterFilter);

There is a digit matcher that show how to make your own categorizer. Currently you have to do it in Java, but it is trivial to load the rules from database or flat file instead.

Machine learning

The user will be able to choose between handwritten rules and rules generated by machine learning for particle categorization. Starting in ShapeLogic 1.6 this will be ported to OCR. First machine learning technique is a multi-layer feed forward neural network that is trained externally but run internally.

Documentation

Project web site http://www.shapelogic.org

Downloads

Both source files and binary distributions can be downloaded here: http://code.google.com/p/shapelogic/downloads/list .

License

MIT license