[Insight-users] Function definition error

Radhika Sivaramakrishna Radhika Sivaramakrishna" <radshashi at earthlink . net
Mon, 22 Dec 2003 10:18:16 -0800


This is a multi-part message in MIME format.

------=_NextPart_000_0007_01C3C874.EA27BC20
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Luis,
I was trying to define a function templated over the pixel type to which =
four images along with some other numbers of type float are passed and =
it returns a float.
I am getting an error that I cannot understand. I am sure it is very =
straightforward. Could you tell me whats the problem? I have enclosed =
below the error I am getting, the way I am calling the function from =
main and also how the function has been defined.

Radhika

error C2784: 'float __cdecl BSI(class itk::SmartPointer<class =
itk::Image<PixelType,`template-parameter258'> >,class =
itk::SmartPointer<class itk::Image<PixelType,`template-parameter258'> =
>,class itk::SmartPoint
er<class itk::Image<PixelType,`template-parameter258'> >,class =
itk::SmartPointer<class itk::Image<PixelType,`template-parameter258'> =
>,float,float,float)' : could not deduce template argument for 'class =
itk::SmartPointer<class itk::Image<TObjectType
,`template-parameter258'> >' from 'class itk::Image<unsigned char,3> *'

int main()
{
... =20

float bsivalue =3D =
BSI(readerimage1->GetOutput(),readerimage2->GetOutput(),readermask1->GetO=
utput(),readermask2->GetOutput(),i1,i2,K); =20
...
}

template <class PixelType> float BSI(itk::Image< PixelType, 3>::Pointer =
image1,itk::Image< PixelType, 3>::Pointer image2,itk::Image< PixelType, =
3>::Pointer mask1,itk::Image< PixelType, 3>::Pointer mask2,float =
i1,float i2,float K)
{
// Body of function
}



------=_NextPart_000_0007_01C3C874.EA27BC20
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi Luis,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I was trying to define a function =
templated over=20
the pixel type to which four images along with some other numbers of =
type float=20
are passed and it returns a float.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I am getting an error that I cannot =
understand. I=20
am sure it is very straightforward. Could you tell me whats the problem? =
I have=20
enclosed below the error I am getting, the way I am calling the function =
from=20
main and also how the function has been defined.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Radhika</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>error C2784: 'float __cdecl BSI(class=20
itk::SmartPointer&lt;class =
itk::Image&lt;PixelType,`template-parameter258'&gt;=20
&gt;,class itk::SmartPointer&lt;class=20
itk::Image&lt;PixelType,`template-parameter258'&gt; &gt;,class=20
itk::SmartPoint<BR>er&lt;class=20
itk::Image&lt;PixelType,`template-parameter258'&gt; &gt;,class=20
itk::SmartPointer&lt;class =
itk::Image&lt;PixelType,`template-parameter258'&gt;=20
&gt;,float,float,float)' : could not deduce template argument for 'class =

itk::SmartPointer&lt;class=20
itk::Image&lt;TObjectType<BR>,`template-parameter258'&gt; &gt;' from =
'class=20
itk::Image&lt;unsigned char,3&gt; *'</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>int main()</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>{</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>...&nbsp; </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>float bsivalue =3D=20
BSI(readerimage1-&gt;GetOutput(),readerimage2-&gt;GetOutput(),readermask1=
-&gt;GetOutput(),readermask2-&gt;GetOutput(),i1,i2,K);</FONT><FONT=20
face=3DArial size=3D2>&nbsp; </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>template &lt;class PixelType&gt; float=20
BSI(itk::Image&lt; PixelType, 3&gt;::Pointer image1,itk::Image&lt; =
PixelType,=20
3&gt;::Pointer image2,itk::Image&lt; PixelType, 3&gt;::Pointer=20
mask1,itk::Image&lt; PixelType, 3&gt;::Pointer mask2,float i1,float =
i2,float=20
K)<BR>{</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>// Body of function</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0007_01C3C874.EA27BC20--