Type<T> + Type<T> = Type<RGB>?

Hello,
Is there a way to take in two RandomAccessibleInterval<T> and combine them with a math operation with the output being RandomAccessibleInterval<ARGB>?

Is this possible to do with just imglib2 native functions or otherwise?

Thanks,
Varun

Hi @kapoorlab!

Linking to a thread below with some discussion.
ImageJ ops has something like this, but I’m not an expert so will leave it to others, it’s something like

ij.op().run("math.multiply", image1, image2)

The imglib2 only way is more verbose, because you need to allocate the destination image.

RandomAccessibleInterval<IntType> aImg = ...
RandomAccessibleInterval<IntType> bImg = ...
RandomAccessibleInterval<ARGBType> cImg = ...
LoopBuilder.setImages(aImg,bImg,cImg).forEachPixel( (a,b,c) -> 
	{
		c.set( a.get() + b.get() );
	});

John

1 Like