Getting Started
You can use ShapeLogic in different ways:
- User mode
- Development mode
Testing ShapeLogic as a user is very simple and only takes a few minutes after ImageJ is installed.
User mode
Steps to get ShapeLogic working from within ImageJ, from binary distribution
- Install ImageJ
- Download shapelogicplugin0.8.zip
- Unzip it
- This will create a directory named shapelogicplugin
- Take everything from this directory and copy it into ./ImageJ/plugins/
Testing ShapeLogic letter matching from within ImageJ
- Open ImageJ
- Create a new image, 100 x 100 pixels works well
- Draw a letter in black on white background
- Go to the shapelogic menu and select CapitalLetterMatch, which does the following
- Convert the image to a binary image
- Call ImageJ's build in Skeletonize
- Vectorize into bitmap into polygon
- Clean up the vectorized polygon
- Then annotate the polygon
- Then match the polygon against all the rules for all the capital letters
- With a little luck you will see a dialog box saying what letter was matched
- If more than one letter matches, the match will fail
- If the match fails then all the properties of the polygon will be written to the console for debugging
Result of match
Dialog with results of match
Vectorized M with skeletonized letter in black and polygon in gray
Steps to get ShapeLogic working from within ImageJ manually
If you need a different version of shapelogic_-0.8.jar, e.g. one compiled for JDK 1.5.
- Create a ShapeLogic dir under ImageJ: ./ImageJ/plugins/shapelogic
- Take the jar file for ShapeLogic: shapelogic_-0.8.jar, and move it to that directory
- Add the jar files that ShapeLogic is dependent on to the ImageJ/plugin dir:
- antlr-runtime-3.0.jar
- commons-collections-3.2.jar
- commons-jexl-1.1.jar
- commons-logging-1.0.4.jar
- commons-math-1.1.jar
- guice-1.0.jar
These jar file can be found on any Maven 2 repository:
E.g. commons-math-1.1.jar can be found here: http://repo1.maven.org/maven2/commons-math/commons-math/1.1/
Or they can be taken out of the shapelogicplugin0.8.zip
When you open ImageJ there will be a ShapeLogic menu containing commands.
You can get the binary distribution from the download page or compile it yourself.
Separating Java and logic rules
If you need to add you own rules to ShapeLogic you need to add your changes and compile ShapeLogic.
The goal is to separate the databases with the logical rules from the executable jar file, so you do not have to recompile.
Development mode
ShapeLogic is build using Maven 2.
This makes several build tasks very easy, so this is the recommended way of doing builds, but the code should run fine without Maven.
Currently the project is set up to work directly with Eclipse 3.3, Java 1.6, but you can use: NetBeans, IntelliJ, JBuilder, emacs or vi.
- Steps to compile and run unit tests
Check ShapeLogic out into a local directory.
Do a cd into that directory.
Run:
- mvn test runs the unit tests locally
- mvn package runs the unit tests locally, and if they passes it will create the jar file
- Changing JDK version when building with Maven
You will have to change the JDK target in pom.xml:
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>