//load ImageJ
%classpath config resolver imagej.public https://maven.imagej.net/content/groups/public
%classpath add mvn net.imagej imagej 2.0.0-rc-67
//create ImageJ object
ij = new net.imagej.ImageJ()
This Op
can be used to clean up your code, if you find yourself needing to perform two different Op
s in succession multiple times in a row.
input = ij.scifio().datasetIO().open("http://imagej.net/images/clown.png")
ij.notebook().display(input)
We can call the Op
as follows:
ij.op().help('join')
There are a lot of different options here, but the join()
Op
s really only come in two flavors:
Join2
: These Op
s take two UnaryOp
s as arguments, as well as the input to the first Op
and, in the case of Computer
joiners, the output to the second Op
.
JoinN
: Similar to the Join2
, it takes an input to the first Op
and an output in the case of Computer
s, however instead of taking two separate Op
s as arguments JoinN
takes a List<UnaryComputerOp>
or a List<UnaryInplaceOp>
. Note that with this flavor you cannot mix and match Inplace
and Computer
Op
s like you could with Join2
.
Also note that NullaryOp
s and BinaryOp
s are not allowed.
Let's say that we want to make a join()
Op
that binarizes an image. This requires two steps to do, which makes this perfect for a join()
Op
. First we have to crop the image to make it grayscale, and then we have to make a new BitType()
image using our grayscale image as a template.
import net.imglib2.FinalInterval
width = input.dimension(0); height = input.dimension(1)
cropInterval = FinalInterval.createMinSize(0, 0, 0, width, height, 1)
grayscaleOp = Computers.unary("")