◐ Shell
clean mode source ↗

Current projection APIs are hard to use

It's especially tough to use from scripts:

#@ OpEnvironment ops

print(ops.helpVerbose("transform.project"))
transform.project:
	- org.scijava.ops.image.transform.project.project.DefaultProjectParallel
		> input : net.imglib2.RandomAccessibleInterval<T>
		> op : org.scijava.function.Computers.Arity1<java.lang.Iterable<T>, V>
		> dim : java.lang.Integer
		> output : @CONTAINER net.imglib2.RandomAccessibleInterval<V>
	- org.scijava.ops.image.transform.project.project.ProjectRAIToIterableInterval
		> input : net.imglib2.RandomAccessibleInterval<T>
		> op : org.scijava.function.Computers.Arity1<java.lang.Iterable<T>, V>
		> dim : java.lang.Integer
		> output : @CONTAINER net.imglib2.IterableInterval<V>

Looking at these signatures, your op needs to work on an arbitrary Interval (because under the hood the project Ops make their own Interval subclass. We could do it differently, but that's beside the point I'm making). That's impossible to match without Nils, since Interval is an interface, and I don't want Nils in scripts.

Secondly, that output cannot be created through adaptation, because we need to remove a dimension from the input, and the index of that dimension won't be known until execution time. We should make some helper Ops that wrap the Computer up into a Function.