[Insight-developers] VectorLinearInterpolateImageFunction

Lydia Ng lng at insightful.com
Wed, 12 May 2004 10:49:31 -0700


This is a multi-part message in MIME format.

------_=_NextPart_001_01C43849.7AED6106
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Jim,
=20
In a way VectorInterpolateImageFunction mirrors the way
InterpolateImageFunction is used.
=20
For example, InterpolateImageFunction always return =
TInputImage::RealType and
it's up to the calling class/object (e.g ResampleImageFilter) to do the
conversion to whatever type is finally required
=20
Currently the VectorReampleImageFilter can resample any vector-type =
images
(Vector, CovariantVector, Point) because it internally does the =
conversion
from FixedArray to the right vector/point etc type.
=20
Would the proposed changes also mean separate ResampleImageFilter for
Vectors, CovariantVectors, and Points etc?
=20
-Lydia
=20
-----Original Message-----
From: Miller, James V (Research) [mailto:millerjv at crd.ge.com]=20
Sent: Wednesday, May 12, 2004 7:25 AM
To: Insight-developers (E-mail)
Subject: [Insight-developers] VectorLinearInterpolateImageFunction
=20
The documentation for VectorLinearInterpolateImageFunction says the
OutputType is
Vector<double, dimension>.  But it really gets the OutputType from its
superclass.
=20
Its superclass, VectorInterpolateImageFunction says the OutputType is =
really
FixedArray<RealType, Dimension> (where RealType is the realtype of the =
input
image pixel component type). =20
=20
I want to perform linear interpolation on a image of Vector<float, 2>.  =
But
the return type from Evaluate(), gives me a FixedArray<double, 2>. Of =
course,
we have no conversion
operators that will take a FixedArray<double, 2> to a Vector<float, 2>.
=20
I imagine in general, we cannot have the return type of Evaluate() be =
the
pixel type of the=20
input image.  If someone has an image of Vector<short, 2> the =
interpolated
value should probably be a Vector<RealType, 2>.
=20
However, since my image was already of Vector<float, 2>, I expected the
interpolated
value to be a Vector<float, 2>. I wasn't expecting to get a FixedArray.=20
=20
That being said, I understand why it written this way. As it is written =
now,
the VectorLinearInterpolateImageFunction can be applied to an image of
anything that supports the API of FixedArray (Vector, CovariantVector,
Point).  But the output is always a FixedArray<double, D>. (I assumed =
with a
name of VectorLinearInterpolateImageFunction, that the image function
interpolated images of Vectors.)
=20
But if we wanted the output to be the same subclass of FixedArray with a
different component type (Vector<short, 2) --> Vector<RealType, 2>) then =
we
would probably need
separate ImageFunctions to interpolate Vectors, CovariantVectors, and =
Points.
Or we could use some scary non-portable template magic.
=20
Aside from fixing the documentation, does anyone have any other =
suggestions
before I dive into compiler magic?
=20
Jim Miller=20
_____________________________________
Visualization & Computer Vision
GE Research
Bldg. KW, Room C218B
P.O. Box 8, Schenectady NY 12301

millerjv at research.ge.com
james.miller at research.ge.com
(518) 387-4005, Dial Comm: 8*833-4005,=20
Cell: (518) 505-7065, Fax: (518) 387-6981=20
=20

------_=_NextPart_001_01C43849.7AED6106
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:st1=3D"urn:schemas-microsoft-com:office:smarttags" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">


<meta name=3DProgId content=3DWord.Document>
<meta name=3DGenerator content=3D"Microsoft Word 10">
<meta name=3DOriginator content=3D"Microsoft Word 10">
<link rel=3DFile-List href=3D"cid:filelist.xml at 01C4380E.CE094C70">
<o:SmartTagType =
namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"
 name=3D"country-region"/>
<o:SmartTagType =
namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"
 name=3D"place"/>
<!--[if gte mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:DoNotRelyOnCSS/>
 </o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:DocumentKind>DocumentEmail</w:DocumentKind>
  <w:EnvelopeVis/>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]--><!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
  at font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:1627421319 -2147483648 8 0 66047 0;}
 at font-face
	{font-family:Verdana;
	panose-1:2 11 6 4 3 5 4 4 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:536871559 0 0 0 415 0;}
 at font-face
	{font-family:"Comic Sans MS";
	panose-1:3 15 7 2 3 3 2 2 2 4;
	mso-font-charset:0;
	mso-generic-font-family:script;
	mso-font-pitch:variable;
	mso-font-signature:647 0 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
p
	{mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
span.EmailStyle19
	{mso-style-type:personal-reply;
	mso-style-noshow:yes;
	mso-ansi-font-size:10.0pt;
	mso-bidi-font-size:10.0pt;
	font-family:Arial;
	mso-ascii-font-family:Arial;
	mso-hansi-font-family:Arial;
	mso-bidi-font-family:Arial;
	color:navy;}
span.SpellE
	{mso-style-name:"";
	mso-spl-e:yes;}
span.GramE
	{mso-style-name:"";
	mso-gram-e:yes;}
 at page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */=20
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:"";
	mso-padding-alt:0in 5.4pt 0in 5.4pt;
	mso-para-margin:0in;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";}
</style>
<![endif]-->
</head>

<body lang=3DEN-US link=3Dblue vlink=3Dblue style=3D'tab-interval:.5in'>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Jim,<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>In a way <span =
class=3DSpellE>VectorInterpolateImageFunction</span>
mirrors the way <span class=3DSpellE>InterpolateImageFunction</span> is =
used.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>For example, <span =
class=3DSpellE>InterpolateImageFunction</span>
always return <span class=3DSpellE>TInputImage::RealType</span> and =
it&#8217;s up
to the calling class/object (<span class=3DSpellE>e.g</span> <span =
class=3DSpellE>ResampleImageFilter</span>)
to do the conversion to whatever type is finally =
required<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Currently the <span =
class=3DSpellE>VectorReampleImageFilter</span>
can resample any vector-type images </span></font><font size=3D2 =
face=3DVerdana><span
style=3D'font-size:10.0pt;font-family:Verdana'>(Vector, <span =
class=3DSpellE>CovariantVector</span>,
Point) because it internally does the conversion from <span =
class=3DSpellE>FixedArray</span>
to the right vector/point etc type.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;
font-family:Verdana'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;
font-family:Verdana'>Would the proposed changes also mean separate <span
class=3DSpellE>ResampleImageFilter</span> for Vectors, <span =
class=3DSpellE>CovariantVectors</span>,
and Points etc?<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;
font-family:Verdana'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;
font-family:Verdana'>-</span></font><st1:country-region><st1:place><font
  size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;font-family:Verdana'>Lydia</span></font></st1:p=
lace></st1:country-region><font
size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;font-family:Verdana'><o:p></o:p></span></font><=
/p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div style=3D'border:none;border-left:solid blue 1.5pt;padding:0in 0in =
0in 4.0pt'>

<p class=3DMsoNormal><font size=3D2 face=3DTahoma><span =
style=3D'font-size:10.0pt;
font-family:Tahoma'>-----Original Message-----<br>
<b><span style=3D'font-weight:bold'>From:</span></b> Miller, James V =
(Research)
[mailto:millerjv at crd.ge.com] <br>
<b><span style=3D'font-weight:bold'>Sent:</span></b> Wednesday, May 12, =
2004 7:25
AM<br>
<b><span style=3D'font-weight:bold'>To:</span></b> Insight-developers =
(E-mail)<br>
<b><span style=3D'font-weight:bold'>Subject:</span></b> =
[Insight-developers]
VectorLinearInterpolateImageFunction</span></font></p>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<div>

<p class=3DMsoNormal><font size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;
font-family:Verdana'>The documentation for =
VectorLinearInterpolateImageFunction
says the OutputType is</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;
font-family:Verdana'>Vector&lt;double, dimension&gt;.&nbsp; But it =
really gets
the OutputType from its superclass.</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;
font-family:Verdana'>Its superclass, VectorInterpolateImageFunction says =
the
OutputType is really FixedArray&lt;RealType, Dimension&gt; (where =
RealType is
the realtype of the input image pixel component type).&nbsp; =
</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;
font-family:Verdana'>I want to perform linear interpolation on a image =
of
Vector&lt;float, 2&gt;.&nbsp; But the return type from Evaluate(), gives =
me a
FixedArray&lt;double, 2&gt;. Of course, we have no =
conversion</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;
font-family:Verdana'>operators that will take a FixedArray&lt;double, =
2&gt; to
a Vector&lt;float, 2&gt;.</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;
font-family:Verdana'>I imagine in general, we cannot have the return =
type of
Evaluate() be the pixel type of the </span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;
font-family:Verdana'>input image.&nbsp; If someone has an image of
Vector&lt;short, 2&gt; the interpolated value should probably be a
Vector&lt;RealType, 2&gt;.</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;
font-family:Verdana'>However, since my image was already of =
Vector&lt;float,
2&gt;, I expected the interpolated</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;
font-family:Verdana'>value to be a Vector&lt;float, 2&gt;. I wasn't =
expecting
to get a FixedArray. </span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;
font-family:Verdana'>That being said, I understand why it written this =
way. As
it is written now, the VectorLinearInterpolateImageFunction can be =
applied to
an image of anything that supports the API of FixedArray (Vector,
CovariantVector, Point).&nbsp; But the output is always a =
FixedArray&lt;double,
D&gt;. (I assumed with a name of VectorLinearInterpolateImageFunction, =
that the
image function interpolated images of =
Vectors.)</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;
font-family:Verdana'>But if we wanted the output to be the same subclass =
of
FixedArray with a different component type (Vector&lt;short, 2) --&gt;
Vector&lt;RealType, 2&gt;) then we would probably =
need</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;
font-family:Verdana'>separate ImageFunctions to interpolate Vectors,
CovariantVectors, and Points. Or we could use some scary non-portable =
template
magic.</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;
font-family:Verdana'>Aside from fixing the documentation, does anyone =
have any
other suggestions before I dive into compiler =
magic?</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p style=3D'margin:0in;margin-bottom:.0001pt'><b><font size=3D3 =
color=3Dnavy
face=3D"Comic Sans MS"><span =
style=3D'font-size:12.0pt;font-family:"Comic Sans MS";
color:navy;font-weight:bold'>Jim Miller</span></font></b> <br>
<b><i><font size=3D2 color=3Dred face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial;color:red;font-weight:bold;font-style:italic'>_________=
____________________________</span></font></i></b><br>
<em><i><font size=3D1 color=3Dblack face=3DArial><span =
style=3D'font-size:7.5pt;
font-family:Arial;color:black'>Visualization &amp; Computer =
Vision</span></font></i></em><i><font
size=3D1 color=3Dblack face=3DArial><span =
style=3D'font-size:7.5pt;font-family:Arial;
color:black;font-style:italic'><br>
<em><i><font face=3DArial><span style=3D'font-family:Arial'>GE =
Research</span></font></i></em><br>
<em><i><font face=3DArial><span style=3D'font-family:Arial'>Bldg. KW, =
Room C218B</span></font></i></em><br>
<em><i><font face=3DArial><span style=3D'font-family:Arial'>P.O. Box 8, =
Schenectady
NY 12301</span></font></i></em><br>
<br>
</span></font></i><em><i><u><font size=3D1 color=3Dblue face=3D"Times =
New Roman"><span
style=3D'font-size:7.5pt;color:blue'><a =
href=3D"mailto:millerjv at research.ge.com">millerjv at research.ge.com</a></sp=
an></font></u></i></em><o:p></o:p></p>

<p style=3D'margin:0in;margin-bottom:.0001pt'><em><i><u><font size=3D1 =
color=3Dblue
face=3D"Times New Roman"><span =
style=3D'font-size:7.5pt;color:blue'>james.miller at research.ge.com</span><=
/font></u></i></em><br>
<i><font size=3D1 color=3Dblack face=3DArial><span =
style=3D'font-size:7.5pt;font-family:
Arial;color:black;font-style:italic'>(518) 387-4005, Dial Comm: =
8*833-4005, </span></font></i><br>
<i><font size=3D1 color=3Dblack face=3DArial><span =
style=3D'font-size:7.5pt;font-family:
Arial;color:black;font-style:italic'>Cell: (518) 505-7065, Fax: (518) =
387-6981</span></font></i>
<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

</div>

</div>

</body>

</html>

------_=_NextPart_001_01C43849.7AED6106--