This tutorial will show you how to display and visually manipulate your image data
//load ImageJ
%classpath config resolver imagej.public https://maven.imagej.net/content/groups/public
%classpath add jar /home/gabe/code/imagej/imagej-common/target/imagej-common-0.27.0-SNAPSHOT.jar
%classpath add jar /home/gabe/code/gselzer/imagej-notebook/target/imagej-notebook-0.3.0-SNAPSHOT.jar
%classpath add mvn net.imagej imagej 2.0.0-rc-67
//create ImageJ object
ij = new net.imagej.ImageJ()
Added new repo: imagej.public
net.imagej.ImageJ@15b66095
Let's say that you used an Op
within the notebooks:
input = ij.scifio().datasetIO().open("http://imagej.net/images/cat.jpg")
sigmas = [3, 3, 0]
gaussed = ij.op().run("gauss", input, sigmas)
null
[INFO] Populating metadata
null
All you have to do to display your output is give Jupyter the reference to your imageJ object on the last line of the cell:
gaussed
ImageJ has given Jupyter the ability to display any RandomAccessibleInterval
or DatasetView
as is using this method. However there is only scratching the surface of what we can visually modify. Let's use the view
method of ImageJ-notebook to turn our RandomAccessibleInterval
into a DefaultDatasetView
:
dataset = ij.notebook().view(gaussed)
println(dataset)
import net.imagej.display.ColorTables
import net.imagej.axis.Axes
dataset.setColorTable(ColorTables.RED, 0)
dataset.setColorTable(ColorTables.GREEN, 1)
dataset.setColorTable(ColorTables.BLUE, 2)
view.rebuild()
view
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 at net.imagej.display.DefaultDatasetView.setColorTable(DefaultDatasetView.java:196) at net.imagej.display.DatasetView$setColorTable.call(Unknown Source) at this cell line 5 at com.twosigma.beakerx.groovy.evaluator.GroovyCodeRunner.runScript(GroovyCodeRunner.java:94) at com.twosigma.beakerx.groovy.evaluator.GroovyCodeRunner.call(GroovyCodeRunner.java:59) at com.twosigma.beakerx.groovy.evaluator.GroovyCodeRunner.call(GroovyCodeRunner.java:32)