I am trying to make a trivial program to add 2 images together.
In the example is
// add a constant value to an image
ops.math().add(sinusoid, 13.0)
where sinusoid
is a double type image, so that it makes sense to add 13.0
I took an ECT image which is an array of short integers. My groovy script is
// @ImageJ ij
// @OpService ops
// @CommandService cmd
// @UIService ui
ect1 = ij.io().open("/home/ilan/Documents/ect1/ECT1.dcm")
ui.show("ect", ect1)
ops.math().add(ect1, 20)
I am trying to add an integer to a short, but I understand that groovy is intelligent enough to not exceed a short integer, and 20 is very far away from the maximum value.
I get back
groovy.lang.MissingMethodException: No signature of method: net.imagej.ops.math.MathNamespace.add() is applicable for argument types: (net.imagej.DefaultDataset, java.lang.Integer) values: [ECT1.dcm, 20]
Possible solutions: add(int, int), add(net.imglib2.img.array.ArrayImg, int), add(net.imglib2.img.planar.PlanarImg, int), add(double, double), add(float, float), add(long, long)
I think it is complaining about my short but I’m not totally sure. I certainly want to keep the native value of the input image as short, so I don’t know what to do with the suggestions I am getting - presumably it wants me to convert to an integer (even if I don’t want to do so)?
Thanks,
Ilan