Setting up a KNIME development environment (including KNIME-IP (Image Processing) and ClearVolume plugin)

This is mostly a not to self… please do not expect a human-readable post… ūüėČ

To prevent the decay of knowledge my brain is suffering I note here how things should run:

  • Follow instructions from README here:¬†https://github.com/knime/knime-sdk-setup
    • Once you double click KNIME.target, add the following update sites and select KNIME Image Processing in both of them
      • http://update.knime.org/community-contributions/trusted/3.4
      • http://update.knime.org/community-contributions/3.4
    • Wait until workspace is built (see bottom right in Eclipse), then click ‘Set as Target Platform’ on the top right.
    • In Arguments tab, set a more reasonable value for Xmx (default is 2G).
  • We then cloned and imported¬†https://github.com/knime-ip/knip into Eclipse.
    • Here the clone URL: git@github.com:knime-ip/knip.git
    • Then import all projects within this repo into Eclipse.

Here some notes on how to implement on Clear Volume from this setup:

  • Import imglib-clearvolume into eclipse. This is easy, its a Maven plugin.
  • You need to also install clearvolume, cleargl, and clearcuda. This is harder since those are Gradle projects…
    • One option is to first install the Eclipse Gradle plugin, if you installed Eclipse 3.4, it would be on this update site:¬†http://download.eclipse.org/buildship/updates/e46/releases/2.x
    • Then you can import Existing Gradle Projects (the ones named above).
    • Since this Gradle Eclipse plugin sucked for me I used this:¬†http://www.thejavageek.com/2015/05/22/create-eclipse-project-with-gradle/
      • Loic supported it already I guess since gradle eclipse just did the right thing.
      • After it you can import project as existing Eclipse project.
  • Gradle magic to remember
    • Use the gradlew¬†script instead of cradle itself. This is how it works is what I’ve been told…
    • ./gradlew clean build -Preleasebuild¬†… building ClearVolume release version
    • ./gradlew collectDependencies¬†… does what you would expect. Can then be found in ./build/dependecies
  • Maven magic to remember
    • `mvn dependency:copy-dependencies` allows you to collect all dependencies of a given maven project.
      • note: this needs you to add the `maven-dependency-plugin` to the pom.xml (google it).

Notes on how to get KNIME to run our Keras stuff (Sept. 2017)

Disclaimer: this is more a ‘note to self’ than anything else.

  1. Download KNIME (without all the stuff) from www.knime.com
  2. Add the nightly build update site to it: http://update.knime.org/analytics-platform/nightly
  3. Add our workflow (which uses a bunch of KNIP and Python nodes — this will cause KNIME to ask you to install a bunch of extensions.
  4. Unfortunately KNIME will not know that we also need this one thing that enables images to be sent back and forth between ImgLib2 and numpy.
    1. Therefore go to ‘Help – Install new Software’ and look for ‘KNIME Image Processing — Python Extensions’ and ‘KNIME Python Scripting Extension’ which comes on ‘KNIME Community Contributions (nightly)’

Here, a list of all extensions that where installed in order to use python and Keras from within KNIME:

  • KNIME Image Processing (1.5.5.x)
  • KNIME Python Integration (Labs…) (3.4.2v…)
  • KNIME Image Processing — Python Extension (1.0.4v…) ¬† // this I found on Stable Community Contributions update site
  • KNIME Deep Learning — Keras Integration (3.5.0v…)

And there is a funny bug at the moment: after you installed everything, Python nodes will only work correctly after a new Python node is pulled into the workflow. It can immediately be deleted again, but all old (existing) nodes will only work correctly after a new one was instantiated once. Hard to find, good to know! ūüėČ

 

Good bye and thanks for all the fish,

Florian

Example for a simple IJ2 / Fiji Plugin

Wonder how to write a IJ2 / Fiji Plugin (Command) that can run nicely from within Eclipse and Fiji or ImageJ2?

There are several answer Google gives you, and most of them go the old IJ (1) way. If you want to use ops or any of the IJ2 services you will appreciate this:

https://github.com/imagej/imagej-tutorials/blob/9baa3bffded39736c0e41cb46ddba7dc15f88260/simple-commands/src/main/java/OpenImage.java#L92-L105

Or this one (which also uses ops to work on images):

https://github.com/imagej/imagej-tutorials/blob/master/simple-commands/src/main/java/OpenScaleSaveImage.java

Using maven to deploy directly to a Fiji installation

This is extremely useful just before you want to upload your plugin(s) to your/a update site. If this really is you use case, you might want to check that the parent POM version you are using coincides with the one of the latest Fiji release!

The command for this is:

mvn -Dimagej.app.directory=/Applications/Fiji.app/ -Ddelete.other.versions=true clean install

And in case the enforcer annoys you — it can be turned off like this:

mvn -Dimagej.app.directory=/Applications/Fiji.app/ -Ddelete.other.versions=true -Denforcer.skip=true clean install

Enjoy,
Florian