[Insight-developers] ImageFunction class

Lydia Ng lng at statsci.com
Thu Oct 19 19:25:46 EDT 2000


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 





More information about the Insight-developers mailing list