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.6.jar to ImageJ/plugin/shapelogic dir, this will make it available in ImageJ.
The latest jar file is called shapelogic_-1.6.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.6.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:
static public ImageProcessor runPluginFilterOnImage(String fileName, PlugInFilter plugInFilter) { Opener opener = new Opener(); ImagePlus image = opener.openImage(fileName); ImageProcessor ip = image.getProcessor(); plugInFilter.setup("", image); plugInFilter.run(ip); return ip; }
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.40.
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:
Download jar, source and doc from ImageJ download.
mvn install:install-file -Dfile=groovy-engine.jar -DgeneratePom=true -DgroupId=org.codehaus.groovy -DartifactId=groovy-engine -Dversion=1.5.1 -Dpackaging=jar
Installing ImageJ into local Maven repository:
mvn install:install-file -Dfile=ij.jar -DgeneratePom=true -DgroupId=imagej -DartifactId=imagej -Dversion=1.41 -Dpackaging=jar
Installing ImageJ sources into local Maven repository:
mvn install:install-file -Dfile=ij141o-src.zip -DgeneratePom=true -DgroupId=imagej -DartifactId=imagej -Dversion=1.41 -Dclassifier=sources -Dpackaging=jar
Installing ImageJ javadoc into local Maven repository:
mvn install:install-file -Dfile=api.zip -DgeneratePom=true -DgroupId=imagej -DartifactId=imagej -Dversion=1.41 -Dclassifier=javadoc -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
cd NetBeansProjects svn checkout http://shapelogic.googlecode.com/svn/trunk/ shapelogic-read-only
Maven gloals can be run directly from NetBeans. Just rigthclick on shapelogic project, select Custom, Goals. Type the name of the goal, e.g. package. This comes with word compleation.
The site goals could not be run from NetBeans because of a Maven version conflict, but ran fine from command line:
cd NetBeansProjects/shapelogic mvn site
This was tested with NetBeans 6.0, 6.1 and 6.5.
ShapeLogic is pure Java and should run under most platforms and IDEs. ShapeLogic development has taken place under Linux, Windows, Eclipse and NetBeans. All works fine. And each has some advantages.
There seems to be some problems with debugging under Eclipse 3.4.
They are related to the 2 directories for compiled class files:
Maven will create class files in shapelogic/target while Eclipse 3.4 will create class files in shapelogic/eclipse-target. However when you start to run or debug, it will first find the class files in shapelogic/target. You can override this when you are debugging something, but it appear that you have to do it each time.