[Insight-developers] RFC: Proposal for Pixel Interpolation Methods

Vikram Chalana vikram@statsci.com
Fri, 5 Jan 2001 12:53:26 -0800


This is a multi-part message in MIME format.

------=_NextPart_000_0026_01C07716.7F99DDF0
Content-Type: text/plain;
	charset="US-ASCII"
Content-Transfer-Encoding: 7bit

I agree with Stephen. I thought interpolation would be performed using the
Image Adapter classes that Luis proposed or the ImageFunction type classes
that Lydia checked in.

Vikram
  -----Original Message-----
  From: insight-developers-admin@public.kitware.com
[mailto:insight-developers-admin@public.kitware.com]On Behalf Of Stephen
Aylward
  Sent: Friday, January 05, 2001 12:38 PM
  To: Paul Hughett
  Cc: insight-developers@public.kitware.com
  Subject: Re: [Insight-developers] RFC: Proposal for Pixel Interpolation
Methods


  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::

erpolatePixel( 
        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


------=_NextPart_000_0026_01C07716.7F99DDF0
Content-Type: text/html;
	charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">


<META content=3D"MSHTML 5.00.3103.1000" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN =
class=3D620445020-05012001>I=20
agree with Stephen. I thought interpolation would be performed using the =
Image=20
Adapter classes that Luis proposed or the ImageFunction type classes =
that Lydia=20
checked in. </SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D620445020-05012001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D620445020-05012001>Vikram</SPAN></FONT></DIV>
<BLOCKQUOTE>
  <DIV align=3Dleft class=3DOutlookMessageHeader dir=3Dltr><FONT =
face=3DTahoma=20
  size=3D2>-----Original Message-----<BR><B>From:</B>=20
  insight-developers-admin@public.kitware.com=20
  [mailto:insight-developers-admin@public.kitware.com]<B>On Behalf Of=20
  </B>Stephen Aylward<BR><B>Sent:</B> Friday, January 05, 2001 12:38=20
  PM<BR><B>To:</B> Paul Hughett<BR><B>Cc:</B>=20
  insight-developers@public.kitware.com<BR><B>Subject:</B> Re:=20
  [Insight-developers] RFC: Proposal for Pixel Interpolation=20
  Methods<BR><BR></DIV></FONT>I don't think interpolation should be part =
of the=20
  base image class.=20
  <P>Many methods don't need interpolation.=20
  <P>Shouldn't these be part of a derived class?&nbsp;&nbsp; Otherwise, =
anytime=20
  anyone wants to add a new type of interpolation, they have to modify =
our base=20
  image class.&nbsp;&nbsp; Also, this adds to the complexity of an =
already=20
  complex class.=20
  <P>s=20
  <P>Paul Hughett wrote:=20
  <BLOCKQUOTE TYPE=3D"CITE">Here is a proposed interface for adding =
pixel=20
    interpolation methods <BR>(and some related methods) to the Image=20
    class.&nbsp; Comments are welcome.=20
    <P>Paul Hughett=20
    <P>/** <BR>&nbsp;* Interpolation method <BR>&nbsp;* <BR>&nbsp;* The =
possible=20
    values of this enum select among different methods for <BR>&nbsp;*=20
    interpolating the value of an image at points between those defined. =

    <BR>&nbsp;* NearestNeighbor takes the value at the defined pixel =
nearest the=20
    <BR>&nbsp;* desired point.&nbsp; Linear interpolates linearly =
between the=20
    nearest <BR>&nbsp;* neighbors along each coordinate axis, using a =
total of=20
    2^N <BR>&nbsp;* neighboring pixels (where N is the number of =
dimensions).=20
    <BR>&nbsp;* CubicSpline uses a cubic spline interpolation along each =
axes,=20
    using <BR>&nbsp;* a total of 4^N * neighboring pixels. <BR>&nbsp;*/=20
    <P>enum InterpolationType {NearestNeighbor, Linear, CubicSpline};=20
    <P>/** <BR>&nbsp;* Interpolate pixel value at random point =
<BR>&nbsp;*=20
    <BR>&nbsp;* This method interpolates to estimate the pixel value at =
points=20
    between <BR>&nbsp;* the sample points of the image, using a given=20
    interpolation method. <BR>&nbsp;* If the given point is near or =
outside the=20
    RequestedRegion of the image, <BR>&nbsp;* the missing points are =
assumed to=20
    have the value given by pad; in effect, <BR>&nbsp;* the =
RequestedRegion of=20
    the image is treated as if it were embedded in <BR>&nbsp;* an =
infinite image=20
    of pad values.&nbsp; By default, the point is assumed to <BR>&nbsp;* =
be in=20
    the physical coordinates defined by the Origin and Spacing =
attributes=20
    <BR>&nbsp;* of the Image.&nbsp; If useindex is set to true, then =
index=20
    coordinates are used <BR>&nbsp;* instead; this may improve =
efficiency if=20
    many points are computed using <BR>&nbsp;* some transformation that =
can be=20
    composed with the physical-to-index <BR>&nbsp;* transformation. =
<BR>&nbsp;*/=20

    <P>PixelType <BR>Image:: <BR>InterpolatePixel( =
<BR>&nbsp;&nbsp;&nbsp; const=20
    Point&lt;VImageDimension,double&gt; &amp;point, =
<BR>&nbsp;&nbsp;&nbsp; const=20
    InterpolationType type, <BR>&nbsp;&nbsp;&nbsp; const PixelType =
&amp;pad =3D 0,=20
    <BR>&nbsp;&nbsp;&nbsp; const bool useindex =3D 0) const;=20
    <P>/** <BR>&nbsp;* Get pixel value or default <BR>&nbsp;* =
<BR>&nbsp;* If the=20
    given index is inside the RequestedRegion, return the value =
<BR>&nbsp;* of=20
    the pixel at that index; otherwise return the default value. =
<BR>&nbsp;*=20
    This method may be useful in algorithms that can treat an image =
<BR>&nbsp;*=20
    as embedded in a infinite image of some default value; for example,=20
    <BR>&nbsp;* convolution and resampling algorithms would use a =
default of=20
    zero. <BR>&nbsp;* (Note that morphological operators might want a =
non-zero=20
    default.) <BR>&nbsp;*/=20
    <P>PixelType <BR>Image:: <BR>GetPixelOrDefault( =
<BR>&nbsp;&nbsp;&nbsp; const=20
    IndexType &amp;index, <BR>&nbsp;&nbsp;&nbsp; const PixelType =
&amp;default)=20
    const;=20
    <P>/** <BR>&nbsp;* Return physical-to-index transform <BR>&nbsp;*=20
    <BR>&nbsp;* This method returns the AffineTransform which defines =
the=20
    transformation <BR>&nbsp;* from physical to index coordinates for =
this=20
    Image. <BR>&nbsp;*/=20
    <P>AffineTransform&lt;double, VImageDimension&gt; <BR>Image::=20
    <BR>GetPhysicalToIndexTransform() const;=20
    <P>/** <BR>&nbsp;* Return index-to-physical transform <BR>&nbsp;*=20
    <BR>&nbsp;* This method returns the AffineTransform which defines =
the=20
    transformation <BR>&nbsp;* from index to physical coordinates for =
this=20
    Image. <BR>&nbsp;*/=20
    <P>AffineTransform&lt;double, VImageDimension&gt; <BR>Image::=20
    <BR>GetIndexToPhysicalTransform() const;=20
    <P>_______________________________________________ =
<BR>Insight-developers=20
    mailing list <BR>Insight-developers@public.kitware.com <BR><A=20
    =
href=3D"http://public.kitware.com/mailman/listinfo/insight-developers">ht=
tp://public.kitware.com/mailman/listinfo/insight-developers</A></P></BLOC=
KQUOTE><PRE>--&nbsp;
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Stephen R. Aylward, Ph.D.
Assistant Professor of Radiology
Adjunct Assistant Professor of Computer Science
<A =
href=3D"http://www.cs.unc.edu/~aylward">http://www.cs.unc.edu/~aylward</A=
>
aylward@unc.edu
(919)966-9695</PRE>&nbsp; </BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0026_01C07716.7F99DDF0--