[Insight-developers] Fwd: Possible bug in ITK

Bill Hoffman bill.hoffman@kitware.com
Wed, 11 Sep 2002 10:10:21 -0400


--=====================_1122844224==_.ALT
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit


>Date: Wed, 11 Sep 2002 15:49:40 +0200
>Subject: Possible bug in ITK
>From: Jahn Otto Næsgaard Andersen <Jahn.O.Andersen@unimed.sintef.no>
>To: bill.hoffman@kitware.com
>X-Mailer: Apple Mail (2.543)
>
>Hi, I have discovered a possible bug in itk:: CastImageFilter. 
>
>
>Given this code (run on Mac OS X): 
>
>
>// Import data from VTK to ITK (using my own VtkToItkGateway class) 
>VtkToItkGateway<unsigned char>* vtk2itk = new VtkToItkGateway<unsigned char>(this->input); 
>    
>    printf("gatewayed size: %i, %i, %i\n", vtk2itk->GetOutput()->GetLargestPossibleRegion().GetSize().GetSize()[0], vtk2itk->GetOutput()->GetLargestPossibleRegion().GetSize().GetSize()[1], vtk2itk->GetOutput()->GetLargestPossibleRegion().GetSize().GetSize()[2]); // Shows correct size 
>    
>    // Convert input data to float 
>    itk::CastImageFilter<UCharImageType, FloatImageType>::Pointer uchar2float = itk::CastImageFilter<UCharImageType, FloatImageType>::New(); 
>    uchar2float->SetInput(vtk2itk->GetOutput()); 
>
>    printf("casted size: %i, %i, %i\n", uchar2float->GetOutput()->GetLargestPossibleRegion().GetSize().GetSize()[0], uchar2float->GetOutput()->GetLargestPossibleRegion().GetSize().GetSize()[1], uchar2float->GetOutput()->GetLargestPossibleRegion().GetSize().GetSize()[2]); // Shows incorrect size (0,0,0) 
>
>
>It seems like the image size is not copied into the CastImageFilter output. What do you think? 
>
>
>Jahn Otto 
>
></blockquote></x-html> 

--=====================_1122844224==_.ALT
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

<html>
<br>
<blockquote type=cite class=cite cite>Date: Wed, 11 Sep 2002 15:49:40
+0200<br>
Subject: Possible bug in ITK<br>
From: Jahn Otto Næsgaard Andersen
&lt;Jahn.O.Andersen@unimed.sintef.no&gt;<br>
To: bill.hoffman@kitware.com<br>
X-Mailer: Apple Mail (2.543)<br>
<br>
Hi, I have discovered a possible bug in itk:: CastImageFilter. <br>
<br>
<br>
Given this code (run on Mac OS X): <br>
<br>
<br>
// Import data from VTK to ITK (using my own VtkToItkGateway class) 
<br>
<tt>VtkToItkGateway&lt;<font color="#760F50">unsigned</font>
<font color="#760F50">char</font>&gt;* vtk2itk = <font color="#760F50">new</font> VtkToItkGateway&lt;<font color="#760F50">unsigned</font> <font color="#760F50">char</font>&gt;(<font color="#760F50">this</font>-&gt;input); <br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; printf(<font color="#891315">&quot;gatewayed size: %i, %i, %i\n&quot;</font>, vtk2itk-&gt;GetOutput()-&gt;GetLargestPossibleRegion().GetSize().GetSize()[<font color="#0000FF">0</font>], vtk2itk-&gt;GetOutput()-&gt;GetLargestPossibleRegion().GetSize().GetSize()[<font color="#0000FF">1</font>], vtk2itk-&gt;GetOutput()-&gt;GetLargestPossibleRegion().GetSize().GetSize()[<font color="#0000FF">2</font>]); // Shows correct size <br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; <font color="#236E25">// Convert input data to float</font> <br>
&nbsp;&nbsp;&nbsp; itk::CastImageFilter&lt;UCharImageType, FloatImageType&gt;::Pointer uchar2float = itk::CastImageFilter&lt;UCharImageType, FloatImageType&gt;::New(); <br>
&nbsp;&nbsp;&nbsp; uchar2float-&gt;SetInput(vtk2itk-&gt;GetOutput()); <br>
<br>
&nbsp;&nbsp;&nbsp; printf(<font color="#891315">&quot;casted size: %i, %i, %i\n&quot;</font>, uchar2float-&gt;GetOutput()-&gt;GetLargestPossibleRegion().GetSize().GetSize()[<font color="#0000FF">0</font>], uchar2float-&gt;GetOutput()-&gt;GetLargestPossibleRegion().GetSize().GetSize()[<font color="#0000FF">1</font>], uchar2float-&gt;GetOutput()-&gt;GetLargestPossibleRegion().GetSize().GetSize()[<font color="#0000FF">2</font>]); // Shows incorrect size (0,0,0) <br>
</tt><br>
<br>
It seems like the image size is not copied into the CastImageFilter output. What do you think? <br>
<br>
<br>
Jahn Otto <br>
<br>
&lt;/blockquote&gt;&lt;/x-html&gt; </blockquote></html>

--=====================_1122844224==_.ALT--