Namespace test fails when adding a new op

Tags: #<Tag:0x00007fb8777f5f80>


Hi all,

I’m trying to an op to the Morphology namespace, but the namespace test keeps failing with:

[ERROR] Mismatched inputs:
	op = net.imagej.ops.morphology.hollow.Hollow
	method = public net.imglib2.RandomAccessibleInterval net.imagej.ops.morphology.MorphologyNamespace.hollow(net.imglib2.RandomAccessibleInterval,java.lang.Boolean)

In my code I declare an op method:

	@OpMethod(op = net.imagej.ops.morphology.hollow.Hollow.class)
	public <B extends BooleanType<B>> RandomAccessibleInterval<BitType> hollow(
		final RandomAccessibleInterval<B> in, final Boolean excludeEdges)
		final RandomAccessibleInterval<BitType> result =
			(RandomAccessibleInterval<BitType>) ops().run(Ops.Morphology.Hollow.class,
				in, excludeEdges);
		return result;

What am I missing?

Best regards,


After running maven on the hollow branch, I get:

-	net.imagej.ops.Ops$Morphology$Hollow(

1. 	(RandomAccessibleInterval out?) =
		RandomAccessibleInterval out?,
==>		RandomAccessibleInterval in,
		Boolean excludeEdges?)
	Inconvertible type: java.lang.Boolean => net.imglib2.RandomAccessibleInterval<capture of ?>

	at net.imagej.ops.morphology.hollow.HollowTest.testEdgeSquareExcludeEdgesFalse(

So this seems to be because the optional arguments are filled from left to right, and you’re trying to match the Boolean to your second input RandomAccessibleInterval ?!


Yes, it is true to that one of my tests failed in addition to the namespace test failing. I was confused by the op-methods of the extractHoles op. It looked like it had the same signature: a unary op with one optional @Parameter. However, with a fresh(er) set of eyes I noticed that in fact this op extends a different abstract class than mine. I changed my op to binary, fixed the op-methods and now tests pass OK. Thank you for your reply!