--------------77528B8B18EDB96B55AC3F64 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I don't think interpolation should be part of the base image class. Many methods don't need interpolation. Shouldn't these be part of a derived class? Otherwise, anytime anyone wants to add a new type of interpolation, they have to modify our base image class. Also, this adds to the complexity of an already complex class. s Paul Hughett wrote: > Here is a proposed interface for adding pixel interpolation methods > (and some related methods) to the Image class. Comments are welcome. > > Paul Hughett > > /** > * Interpolation method > * > * The possible values of this enum select among different methods for > * interpolating the value of an image at points between those defined. > * NearestNeighbor takes the value at the defined pixel nearest the > * desired point. Linear interpolates linearly between the nearest > * neighbors along each coordinate axis, using a total of 2^N > * neighboring pixels (where N is the number of dimensions). > * CubicSpline uses a cubic spline interpolation along each axes, using > * a total of 4^N * neighboring pixels. > */ > > enum InterpolationType {NearestNeighbor, Linear, CubicSpline}; > > /** > * Interpolate pixel value at random point > * > * This method interpolates to estimate the pixel value at points between > * the sample points of the image, using a given interpolation method. > * If the given point is near or outside the RequestedRegion of the image, > * the missing points are assumed to have the value given by pad; in effect, > * the RequestedRegion of the image is treated as if it were embedded in > * an infinite image of pad values. By default, the point is assumed to > * be in the physical coordinates defined by the Origin and Spacing attributes > * of the Image. If useindex is set to true, then index coordinates are used > * instead; this may improve efficiency if many points are computed using > * some transformation that can be composed with the physical-to-index > * transformation. > */ > > PixelType > Image:: > InterpolatePixel( > const Point<VImageDimension,double> &point, > const InterpolationType type, > const PixelType &pad = 0, > const bool useindex = 0) const; > > /** > * Get pixel value or default > * > * If the given index is inside the RequestedRegion, return the value > * of the pixel at that index; otherwise return the default value. > * This method may be useful in algorithms that can treat an image > * as embedded in a infinite image of some default value; for example, > * convolution and resampling algorithms would use a default of zero. > * (Note that morphological operators might want a non-zero default.) > */ > > PixelType > Image:: > GetPixelOrDefault( > const IndexType &index, > const PixelType &default) const; > > /** > * Return physical-to-index transform > * > * This method returns the AffineTransform which defines the transformation > * from physical to index coordinates for this Image. > */ > > AffineTransform<double, VImageDimension> > Image:: > GetPhysicalToIndexTransform() const; > > /** > * Return index-to-physical transform > * > * This method returns the AffineTransform which defines the transformation > * from index to physical coordinates for this Image. > */ > > AffineTransform<double, VImageDimension> > Image:: > GetIndexToPhysicalTransform() const; > > _______________________________________________ > 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 --------------77528B8B18EDB96B55AC3F64 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> I don't think interpolation should be part of the base image class.Many methods don't need interpolation.
Shouldn't these be part of a derived class? Otherwise, anytime anyone wants to add a new type of interpolation, they have to modify our base image class. Also, this adds to the complexity of an already complex class.
s
Paul Hughett wrote:
Here is a proposed interface for adding pixel interpolation methods
(and some related methods) to the Image class. Comments are welcome.Paul Hughett
/**
* Interpolation method
*
* The possible values of this enum select among different methods for
* interpolating the value of an image at points between those defined.
* NearestNeighbor takes the value at the defined pixel nearest the
* desired point. Linear interpolates linearly between the nearest
* neighbors along each coordinate axis, using a total of 2^N
* neighboring pixels (where N is the number of dimensions).
* CubicSpline uses a cubic spline interpolation along each axes, using
* a total of 4^N * neighboring pixels.
*/enum InterpolationType {NearestNeighbor, Linear, CubicSpline};
/**
* Interpolate pixel value at random point
*
* This method interpolates to estimate the pixel value at points between
* the sample points of the image, using a given interpolation method.
* If the given point is near or outside the RequestedRegion of the image,
* the missing points are assumed to have the value given by pad; in effect,
* the RequestedRegion of the image is treated as if it were embedded in
* an infinite image of pad values. By default, the point is assumed to
* be in the physical coordinates defined by the Origin and Spacing attributes
* of the Image. If useindex is set to true, then index coordinates are used
* instead; this may improve efficiency if many points are computed using
* some transformation that can be composed with the physical-to-index
* transformation.
*/PixelType
Image::
InterpolatePixel(
const Point<VImageDimension,double> &point,
const InterpolationType type,
const PixelType &pad = 0,
const bool useindex = 0) const;/**
* Get pixel value or default
*
* If the given index is inside the RequestedRegion, return the value
* of the pixel at that index; otherwise return the default value.
* This method may be useful in algorithms that can treat an image
* as embedded in a infinite image of some default value; for example,
* convolution and resampling algorithms would use a default of zero.
* (Note that morphological operators might want a non-zero default.)
*/PixelType
Image::
GetPixelOrDefault(
const IndexType &index,
const PixelType &default) const;/**
* Return physical-to-index transform
*
* This method returns the AffineTransform which defines the transformation
* from physical to index coordinates for this Image.
*/AffineTransform<double, VImageDimension>
Image::
GetPhysicalToIndexTransform() const;/**
* Return index-to-physical transform
*
* This method returns the AffineTransform which defines the transformation
* from index to physical coordinates for this Image.
*/AffineTransform<double, VImageDimension>
Image::
GetIndexToPhysicalTransform() const;_______________________________________________
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