<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EstiloCorreo18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:70.9pt 70.9pt 70.9pt 70.9pt;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=ES link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Hi Frederic,<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>You cannot do what you
intend. This is a C++ issue. With typedef you are defining new types which are
valid only in the space between the braces and those types no longer exist (go out
of scope) after them. So when you reach the point where you define the image
types, InputPixelType and OutputPixelType don&#8217;t exist because they cannot
be seen.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>The class itk::Image is
not intended for changing the pixel type dinamically. If you need to use several
pixel types then you need to use several image types and you need to know them
and define them beforehand, that is at compile time. For example :<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>typedef itk::Image&lt;unsigned
char,2&gt;   UCharImageType;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>typedef itk::Image&lt;short,2&gt;  
             ShortImageType;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>and then use each image
type where necessary. <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>The only way of managing
itk images independently of the pixel type is using polymorphism by recurring
to pointers to itk::ImageBase which is depends only on the image dimension. But
this is only practical if you need to do something like storing images in
containers. <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>Best regards<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>Ivan<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>De:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
insight-users-bounces+imacia=vicomtech.es@itk.org
[mailto:insight-users-bounces+imacia=vicomtech.es@itk.org] <b><span
style='font-weight:bold'>En nombre de </span></b>Frédéric Stevens<br>
<b><span style='font-weight:bold'>Enviado el:</span></b> jueves, 24 de mayo de
2007 14:27<br>
<b><span style='font-weight:bold'>Para:</span></b> Insight-users@itk.org<br>
<b><span style='font-weight:bold'>Asunto:</span></b> [Insight-users] Changing
InputPixelType in an easy way?</span></font><o:p></o:p></p>

</div>

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

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>Hi,<br>
<br>
I was wondering if you could change the InputPixelType easily ? <br>
I have tried something like :<br>
<br>
&nbsp; &nbsp;&nbsp; int test = 1;&nbsp;&nbsp;&nbsp; // just to be sure it
enters the first if for InputPixeltype to be defined<br>
&nbsp;&nbsp;&nbsp;&nbsp; if( test == 1)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; typedef&nbsp; unsigned char
InputPixelType; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; typedef&nbsp; unsigned char
OutputPixelType; <br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; else<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; typedef&nbsp; short InputPixelType; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; typedef&nbsp; short OutputPixelType; <br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;<br>
typedef itk::Image&lt; InputPixelType,&nbsp; 2 &gt;&nbsp;&nbsp; InputImageType;<br>
typedef itk::Image&lt; OutputPixelType, 2&gt;&nbsp;&nbsp; OutputImageType;<br>
<br>
But It doesn't work: gives that error &quot; Error&nbsp;&nbsp;&nbsp;
4&nbsp;&nbsp;&nbsp; error C2065: 'InputPixelType' : undeclared
identifier&nbsp;&nbsp;&nbsp;
e:\tmp\Imageimport\binarytest.cxx&nbsp;&nbsp;&nbsp; 62&nbsp;&nbsp;&nbsp; &quot;
<br>
If i put directly one type it works, but if i put an &quot;if&quot;, even
though I am sure in goes in, the InputPixelType isn't known. Could you explain
me why it doesn't recognize it ?<br>
<br>
Thank you in advance, <br>
Regards,<br>
<br>
Frédéric<br>
<br>
<br>
<br>
<br>
<o:p></o:p></span></font></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>No virus
found in this incoming message.<br>
Checked by AVG Free Edition.<br>
Version: 7.5.467 / Virus Database: 269.7.7/816 - Release Date: 23/05/2007 15:59</span></font><o:p></o:p></p>

</div>

</body>

</html>
<BR>

<P><FONT SIZE=2>No virus found in this outgoing message.<BR>
Checked by AVG Free Edition.<BR>
Version: 7.5.467 / Virus Database: 269.7.7/816 - Release Date: 23/05/2007 15:59<BR>
</FONT> </P>