This page overlaps with the Getting started page, but goes into more detail.
All of the following processes should be trivial if you use Maven 2 with ShapeLogic:
ShapeLogic uses http://maven.apache.org for building.
This is very simple to learn and makes the build process trivial.
Install Maven 2.
Download ShapeLogic and unpack it.
After these initial steps the build process only contains 2 steps:
Step 1: Go into the shapelogic dir and run this command:
mvn package
This will run all unit tests and if there are no errors, build the jar file.
Step 2: When the build is successful moved shapelogic/target/shapelogic_-1.0.jar to ImageJ/plugin/shapelogic dir, this will make it available in ImageJ.
The latest jar file is called shapelogic_-1.0.jar.
It has to have an underscore in the name in order for ImageJ to treat it as a plugin.
All the files that are PlugInFilter needs to be placed in the default package dir: shapelogic/src/main/java, and they need to have a name that is ending in a underscore e.g. MaxDistanceVectorizerTest_.java.
In ShapeLogic the source files that live there are thin wrappers around the real classes that live under other packages, e.g.: shapelogic/src/main/java/org/shapelogic/imageprocessing/MaxDistanceVectorizerTest.java
In order to run ShapeLogic you need to place all the jar files that it depends on in the ImageJ/plugin director:
These jar file can be found in:
shapelogicplugin1.0.zip ShapeLogic 1.0 plugin for ImageJ with all dependent jar files
Steps to install:
Just start the debugger from Eclipse, with these setting:
Debugging class: ij.ImageJ (main ImageJ class) Start directory: ImageJ directory: VM setting: -Xmx50m
The test classes open an image from a file and directly calls the Processor on it directly.
See the AbstractImageProcessingTests.java. Here is the main setup part:
public ByteProcessor runPluginFilterOnImage(String fileName, PlugInFilter plugInFilter) { Opener opener = new Opener(); ImagePlus image = opener.openImage(fileName); ByteProcessor bp = (ByteProcessor) image.getProcessor(); plugInFilter.setup("", image); plugInFilter.run(bp); return bp; }
ShapeLogic is mainly only using libraries that are in Maven repository. Maven downloads them automatically when running mvn test or mvn package.
It is a little harder to work with libraries that are not in the Maven repository.
There are only 2 of those: Scripting engines and ImageJ 1.38.
This is one thing that does not work directly with Maven
In other to get it to work you have to download jsr223-engines.zip from https://scripting.dev.java.net/servlets/ProjectDocumentList
After that you have to unpack it, and install it into the Maven repository:
mvn install:install-file -Dfile=groovy-engine.jar -DgroupId=org.codehaus.groovy -DartifactId=groovy-engine -Dversion=1.5.1 -Dpackaging=jar
You will not need to do this, since ShapeLogic is already setup when down loaded.
This useful if you are setting your own ImageJ project up and you want to use similar simple build, debug and unit test processes.
Here is a good description of setting up Maven 2 in five minutes.
mvn archetype:create -DgroupId=org.shapelogic -DartifactId=shapelogic_
Install the the Maven 2 plugin for Eclipse: http://m2eclipse.codehaus.org/update
To generate the Eclipse project file for ShapeLogic run this command:
mvn eclipse:eclipse
Open Eclipse and import the project.
That is all there was to it.
To create a project for IntelliJ instead run this command:
mvn idea:idea