[Insight-developers] ImageFunction class

Joshua Cates cates@cayenne.cs.utah.edu
Fri, 20 Oct 2000 13:50:43 -0600 (MDT)


Hi Lydia,

Here's how I relate the neighborhood tools with the ImageFunctions:
In the STL component-space, your ImageFunctions are functions 
(algorithms), while the neighborhood objects are containers and iterators.

Like you we saw the need for an API below the pipeline layer to manipulate
image data.  Because of the nature of our first deliverables, however, we
chose to develop a lower-level API than what you are working on.  Our goal
was a generalized set of basic mathematical operators (more of a
matlab-style interface), not a specific set of algorithms.

Of course our low-level interface does not negate the usefulness of
function objects like you describe.  But rather than being an instance of
an ImageFunction-like class, the intention of the neighborhood tools is
that they are the means to build interfaces like ImageFunction.  If the
algorithm embedded in an ImageFunction performs some local image geometry
calculations, for example, then the neighborhood tools are there to build 
that algorithm.

So I would urge you to consider using the neighborhood tools where
appropriate.  Of course, they are not extensively tested yet and the API
will need some fine-tuning--so these are more delays on the path
to actual deliverables.  But I think the benefits of working together to
develop these low-level generic programming components are well worth the
struggle.

Josh.


+--+--+--+--+--+--+--+--+--+--+--+--
 Josh Cates			
 Department of Computer Science	
 University of Utah
 Email: cates@cs.utah.edu
 Phone: (801) 587-7697
 URL:   www.cs.utk.edu/~cates
--+--+--+--+--+--+--+--+--+--+--+---

On Fri, 20 Oct 2000, Lydia Ng wrote:

> Hi Josh,
> 
> Thanks for the reply.
> 
> I think that the neighborhood iterators are one instance of the family of
> classes that I propose.
> 
> I envisage that ImageFunctions are used to create virtual read-only Images
> where the data is not stored but generated on the fly 
> when someone access it.
> These virtual images could be smaller or larger than the input Image.
> They could have values at non-integer coordinates.
> 
> ImageFunctions would have an interface that supports GetPixel(...) to
> facilitate random access. For optimized sequential access/processing,
> iterator versions could be built which subclass ImageIterator.
> 
> ImageFunctions can then be used as building blocks for higher level
> algorithms. If these classes were nicely encapsulated, we should be able
> swap and change them without having to change the higher level algorithm.
> 
> It doesn't seem like there is an existing class I can run with at the
> moment. Given that we have deliverables in December,
>  I will keep on going in this direction and hopefully we can unify things
> later.
> 
> Lydia
> 
> > -----Original Message-----
> > From: insight-developers-admin@public.kitware.com
> > [mailto:insight-developers-admin@public.kitware.com]On Behalf 
> > Of Joshua
> > Cates
> > Sent: Thursday, October 19, 2000 5:44 PM
> > To: Lydia Ng
> > Cc: Insight-developers@public.kitware.com
> > Subject: Re: [Insight-developers] ImageFunction class
> > 
> > 
> > Hello Lydia,
> > 
> > We have checked tools into the repository that are designed to do the
> > types of things that you describe.  The difference is that 
> > our tools are
> > optimized for sequential processing and not random access 
> > (although random
> > access is possible).
> > 
> > Basically what we have is this:  
> > 
> > - An image iterator that references a pixel neighborhood.  You could
> > subclass this to a random access iterator.
> > 
> > - A set of operations on pixel neighborhoods like convolution, inner
> > product, addition, subtraction, etc.
> > 
> > - Some predefined operators that can be applied to pixel 
> > neighborhoods to
> > calculate special values (derivative operators, gaussian smoothing,
> > dilation, erosion,...). We would like to develop with others 
> > a large set
> > of these operators for doing common tasks like you describe.
> > 
> > Take a look at the neighborhood iterators and neighborhood 
> > operators and
> > let me know if you think they can do what you need.  Then we should
> > probably talk about a unified approach with the basic 
> > architecture folks.
> > 
> > Josh.
> > 
> > (I sent an email out early last week with more info about the
> > neighborhood tools which I can forward to you.)
> > 
> > 
> > 
> > +--+--+--+--+--+--+--+--+--+--+--+--
> >  Josh Cates			
> >  Department of Computer Science	
> >  University of Utah
> >  Email: cates@cs.utah.edu
> >  Phone: (801) 587-7697
> >  URL:   www.cs.utk.edu/~cates
> > --+--+--+--+--+--+--+--+--+--+--+---
> > 
> > On Thu, 19 Oct 2000, Lydia Ng wrote:
> > 
> > > Hi,
> > >  
> > > For my algorithm I need to calculate values such as the curvature 
> > > at a particular point. It would be good to do this using something 
> > > much lighter weight than a process object. 
> > > 
> > > The two main reasons are: 
> > > 1) I may only want to calculate the curvature 
> > > at specific pixels where the algorithm hasn't 
> > > converged yet, or 
> > > 2) because of memory constraints, I may not want to 
> > > store the curvature for every pixel in the image. 
> > > I just want to use it at each pixel and then throw it 
> > > away. 
> > > 
> > > I am implementing light weight class called ImageFunction, 
> > > templated over 
> > > 
> > > a) the pixel type of the image to be processed, 
> > > 
> > > c) the pixel type for the output. 
> > > 
> > > b) the dimension of the image and 
> > > 
> > > template<class TInputPixel, class TOutputPixel,
> > > 	unsigned int VImageDimension = 2> 
> > > class ImageFunction 
> > > { 
> > >         ... 
> > > }; 
> > > 
> > > Like an ImageIterator, ImageFunction would be initialized 
> > > with an input image and keeps a reference to the image. 
> > > 
> > > The API would have a function 
> > >   
> > > TOutputPixel Evaluate(Index& index); 
> > > 
> > > which will return the value of that function at a 
> > > particular pixel. 
> > > 
> > > Depending on the function, it may be able to return 
> > > values at non-integer coordinates eg: 
> > > 
> > > TOutputPixel Evaluate(double * coord); 
> > > 
> > > With this, I can have a ImageCurvature subclass which 
> > > calculates the curvature at a requested location. 
> > > Other possibilities include 
> > > interpolation, upwind derivatives etc. 
> > > 
> > > So not to duplicate efforts,
> > > have any of you got a similar class already?
> > > 
> > > Cheers, 
> > > Lydia 
> > > 
> > > 
> > > _______________________________________________
> > > Insight-developers mailing list
> > > Insight-developers@public.kitware.com
> > > http://public.kitware.com/mailman/listinfo/insight-developers
> > > 
> > 
> > 
> > _______________________________________________
> > Insight-developers mailing list
> > Insight-developers@public.kitware.com
> > http://public.kitware.com/mailman/listinfo/insight-developers
>