[Insight-developers] ImageFunction class

Stephen Aylward aylward@cs.unc.edu
Thu, 19 Oct 2000 21:57:52 -0400


--------------42368570D78F7822C86772A9
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

We are working on something that might help...

We have an NDInterpolant class that contains an instance of a
1DInterpolant class.
The NDInterpolant class applies the 1DInterpolant in N dimensions
(seperably) to calculate values at non-integer point locations.

The 1DInterpolant class is derived to provide linear, cubic, nearest
neighbor, Gaussian, etc interpolation.   Each derivation must provide
functions for value, first-derivative, second-derivation, and jet (first
and second derivative). Each derivation specifies the size of a
neighborhood it needs about a point to calculate a value at that point
(i.e., covolution kernel size).

The 1DInterpolant class is templated to receive a function that provides
values at integer locations - i.e., to specify values at spline control
points. The 1DInterpolant class has an internal structure to archive
values at integer locations so that this function is called as few times
as possible.

This way, to do different types of data (or image) interpolation, all
you have to do is provide a function that returns the values at integer
data (image voxel) locations.

This class set ties in with a set of optimizer classes (same hierarchy,
NDOptimizer, 1DOptimizer, derivatives of 1DOptimizer for Brendt's,
golden mean, etc. optimizers - these classes are templated to take a
function that returns values at integer data locations).

Okay - interpolation is convolution, so there is some overlap with the
neighborhood operators, but we've found these classes to be nice in that
they operate on any data format (not just images) as well as data
calculated on the fly (via functions).

I think nether single approach is sufficient, both should be provided.
I just wanted you to know that there are other options.

I hope this helps.   I expect these classes will be released in a few
(really, one or two) weeks.   We've been using them (in non-itk form)
for years.   They only require the numerics library - they don't use the
image class directly.

Comments anyone?

Thanks,
Stephen

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

--
===============================================
Stephen R. Aylward, Ph.D.
Assistant Professor of Radiology
Adjunct Assistant Professor of Computer Science
http://www.cs.unc.edu/~aylward
aylward@unc.edu
(919)966-9695



--------------42368570D78F7822C86772A9
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
Hi,

We are working on something that might help...

We have an NDInterpolant class that contains an instance of a 1DInterpolant class.
The NDInterpolant class applies the 1DInterpolant in N dimensions (seperably) to calculate values at non-integer point locations.

The 1DInterpolant class is derived to provide linear, cubic, nearest neighbor, Gaussian, etc interpolation.   Each derivation must provide functions for value, first-derivative, second-derivation, and jet (first and second derivative). Each derivation specifies the size of a neighborhood it needs about a point to calculate a value at that point (i.e., covolution kernel size).

The 1DInterpolant class is templated to receive a function that provides values at integer locations - i.e., to specify values at spline control points. The 1DInterpolant class has an internal structure to archive values at integer locations so that this function is called as few times as possible.

This way, to do different types of data (or image) interpolation, all you have to do is provide a function that returns the values at integer data (image voxel) locations.

This class set ties in with a set of optimizer classes (same hierarchy, NDOptimizer, 1DOptimizer, derivatives of 1DOptimizer for Brendt's, golden mean, etc. optimizers - these classes are templated to take a function that returns values at integer data locations).

Okay - interpolation is convolution, so there is some overlap with the neighborhood operators, but we've found these classes to be nice in that they operate on any data format (not just images) as well as data calculated on the fly (via functions).

I think nether single approach is sufficient, both should be provided.   I just wanted you to know that there are other options.

I hope this helps.   I expect these classes will be released in a few (really, one or two) weeks.   We've been using them (in non-itk form) for years.   They only require the numerics library - they don't use the image class directly.

Comments anyone?

Thanks,
Stephen

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

-- 
===============================================
Stephen R. Aylward, Ph.D.
Assistant Professor of Radiology
Adjunct Assistant Professor of Computer Science
http://www.cs.unc.edu/~aylward
aylward@unc.edu
(919)966-9695
  --------------42368570D78F7822C86772A9--