Output arguments in ImageJ Ops

tutorials
imagej-ops
Tags: #<Tag:0x00007fb87d74f9b8> #<Tag:0x00007fb87d74f828>

#1

Hi,
I’m going over the excellent Beaker notebook. (thanks - @etarena and @ctrueden) It is very well written and the code works very nicely. I have a question about ImageJ Ops:

When I look for information about a certain Op:

ij.op().help("copy.rai")

Available operations:
	(RandomAccessibleInterval out?) =
	net.imagej.ops.copy.CopyRAI(
		RandomAccessibleInterval out?,
		RandomAccessibleInterval in)

I understand the input argument, but I don’t understand what the optional output argument means. If I use a RandomAccessibleInterval output argument, I guess it means that the function would return a RandomAccessibleInterval object. But what would happen if I would not give an output argument - what type of image would be returned then?

Thanks,
Avital


#2

Hi Avital,

the output of this op will always be of type RandomAccessibleInterval, but as the question marks (out?) indicate, it is optional to provide an output as a parameter, or to ask for the return value.

That means this op can be used both as a function (with a return value):

out = f(in)

or as a computer (with a provided, pre-allocated output that will contain the result after running the op):

f(out, in)

More information about Functions, Computers, and also Inplaces as well as their various combinations (Hybrids) is available in the javadoc, and in this Intro to ImageJ-Ops presentation.


#3

Thanks, @imagejan - that will make it so much easier for me to follow the rest of the examples in the notebook, since I forgot about f(out, in) which is used a lot in ImageJ1’s macro language but not in Javascript with the ImageJ1 API.