Skip to main content

operator returning CollectionImage or CollectionOp

3 replies [Last post]
Joined: 2008-04-29


Long, long ago in this thread:

> On Tue, 19 Apr 2005, Fritz Cathey wrote:
> I have code that takes a certain kind of source image and computes
> two related images, more or less in parallel. I would like to embed this in
> an operator which, when rendered, produces a collection with the two
> images. Can CollectionOp be used here somehow?

This seems to be one of the only mentions of CollectionOp that I can find. Does this mean it is never used ? Or is its use so obvious that only I am confused ?

I would like to do the same style of operation as described above: one source image -> one or more result images. In my case the operator is sampling the values in each source pixel's neighbourhood (defined by a kernel) and computing summary statistics, each of which I would like to write to a separate output image.

I'd be very grateful for any example code for operators like this that people could point me to, or any general tips about how to code the OpImage class.


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2008-04-29

OK, answering my own question [do I get a point :)... ]

I now have something working but it's hopelessly inefficient so I'd appreciate it if someone can offer advice on how to do it better.

The story so far...

I have an operator for the "KernelStats" operation which works in Collection mode. As stated previously, this operator is used to calculate one or more summary statistics on values in the neighbourhood of each source pixel. The neighbourhood is defined with a kernel. The summary stats can be mean, max, min, standard deviation.. that sort of thing.

At the moment I have this arrangement

KernelStatsCIF implements CollectionImageFactory

KernelStatsOpImage extends CollectionImage

KernelStatsDescriptor with a createCollection method that returns Collection

The op image class delegates the task of collecting neighbourhood data and performing calculations to a KernelStatsWorker class that descends from AreaOpImage.

The code for all this can be found here...

So far so good in that the above works, but obviously it's not sensible to move the kernel over the image for each statistic. What I want to do is collect the data for each neighbourhood and use it to calculate all statistics. But I can't quite see how to set that up as a rendering chain.

Suggestions ?


Message was edited by: cafeanimal

Fork Labs

Hello Michael,

It has been a while since I have worked with CollectionOp, but my
project jai-operators uses many CollectionOp. You can find this
project at:


Daniel Léonard

To unsubscribe, e-mail:
For additional commands, e-mail:

Joined: 2008-04-29

Thanks for that Daniel - much appreciated.

Since my last post I rejigged the operator so that it is now simply an AreaOp which returns a multiband image: one band for each statistic being calculated.

However, I'm still interested in CollectionOp for other uses and I will certainly study your code.

All the best,