<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV>
<DIV 
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none"></DIV></DIV>
<DIV 
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV>Hi</DIV>
<DIV>&nbsp;</DIV>
<DIV>I am trying to do conversion of image from Cartesian to polar using 
itk::ResampleImageFilter but result is not proper.</DIV>
<DIV>&nbsp;</DIV>
<DIV>I am doing polar and Cartesian vice versa conversion using code given at 
</DIV>
<DIV><A title=http://www.insight-journal.org/browse/publication/130 
href="http://www.insight-journal.org/browse/publication/130">http://www.insight-journal.org/browse/publication/130</A></DIV>
<DIV>&nbsp;</DIV>
<DIV>But it does not producing perfect image as output. Any one can tell me what 
I am doing wrong ?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Here is code of my example.</DIV>
<DIV>&nbsp;</DIV>
<DIV>#include "itkImage.h"</DIV>
<DIV>#include "itkImageFileReader.h"</DIV>
<DIV>#include "itkImageFileWriter.h"</DIV>
<DIV>#include "itkResampleImageFilter.h"</DIV>
<DIV>#include "itkAffineTransform.h"</DIV>
<DIV>#include "itkNearestNeighborInterpolateImageFunction.h"</DIV>
<DIV>#include "itkCartesianToPolarTransform.h"</DIV>
<DIV>#include "itkPolarToCartesianTransform.h"</DIV>
<DIV>&nbsp;</DIV>
<DIV>int main( int argc, char * argv[] )</DIV>
<DIV>{</DIV>
<DIV>&nbsp; if( argc &lt; 3 )</DIV>
<DIV>&nbsp;&nbsp;&nbsp; {</DIV>
<DIV>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "Usage: " &lt;&lt; std::endl;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; argv[0] &lt;&lt; "&nbsp; 
inputImageFile&nbsp; outputImageFile"; </DIV>
<DIV>&nbsp;&nbsp;&nbsp; return EXIT_FAILURE;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; }</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; const&nbsp;&nbsp;&nbsp;&nbsp; unsigned int&nbsp;&nbsp; Dimension = 
2;</DIV>
<DIV>&nbsp; typedef&nbsp;&nbsp; unsigned char&nbsp; InputPixelType;</DIV>
<DIV>&nbsp; typedef&nbsp;&nbsp; unsigned char&nbsp; OutputPixelType;</DIV>
<DIV>&nbsp; typedef itk::Image&lt; InputPixelType,&nbsp; Dimension 
&gt;&nbsp;&nbsp; InputImageType;</DIV>
<DIV>&nbsp; typedef itk::Image&lt; OutputPixelType, Dimension &gt;&nbsp;&nbsp; 
OutputImageType;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; typedef itk::ImageFileReader&lt; InputImageType&nbsp; &gt;&nbsp; 
ReaderType;</DIV>
<DIV>&nbsp; typedef itk::ImageFileWriter&lt; OutputImageType &gt;&nbsp; 
WriterType;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; ReaderType::Pointer reader = ReaderType::New();</DIV>
<DIV>&nbsp; WriterType::Pointer writer = WriterType::New();</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; reader-&gt;SetFileName( argv[1] );</DIV>
<DIV>&nbsp; writer-&gt;SetFileName( argv[2] );</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; typedef 
itk::ResampleImageFilter&lt;InputImageType,OutputImageType&gt; FilterType;</DIV>
<DIV>&nbsp; FilterType::Pointer filter = FilterType::New();</DIV>
<DIV>&nbsp;</DIV>
<DIV>typedef itk::CartesianToPolarTransform&lt;double,Dimension&gt;&nbsp; 
TransformType;</DIV>
<DIV>&nbsp; TransformType::Pointer transform = TransformType::New();</DIV>
<DIV>&nbsp; filter-&gt;SetTransform( transform );</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; typedef itk::NearestNeighborInterpolateImageFunction&lt; </DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
InputImageType, double &gt;&nbsp; InterpolatorType;</DIV>
<DIV>&nbsp; InterpolatorType::Pointer interpolator = 
InterpolatorType::New();</DIV>
<DIV>&nbsp; filter-&gt;SetInterpolator( interpolator );</DIV>
<DIV>&nbsp; filter-&gt;SetDefaultPixelValue( 0 );</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; double spacing[ Dimension ];</DIV>
<DIV>&nbsp; spacing[0] = 1.0; // pixel spacing in millimeters along X</DIV>
<DIV>&nbsp; spacing[1] = 1.0; // pixel spacing in millimeters along Y</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; filter-&gt;SetOutputSpacing( spacing );</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; double origin[ Dimension ];</DIV>
<DIV>&nbsp; origin[0] = 0.0;&nbsp; // X space coordinate of origin</DIV>
<DIV>&nbsp; origin[1] = 0.0;&nbsp; // Y space coordinate of origin</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; filter-&gt;SetOutputOrigin( origin );</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; InputImageType::DirectionType direction;</DIV>
<DIV>&nbsp; direction.SetIdentity();</DIV>
<DIV>&nbsp; filter-&gt;SetOutputDirection( direction );</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; InputImageType::SizeType&nbsp;&nbsp; size;</DIV>
<DIV>&nbsp; size[0] = 512;&nbsp; // number of pixels along X</DIV>
<DIV>&nbsp; size[1] = 512;&nbsp; // number of pixels along Y</DIV>
<DIV>&nbsp; filter-&gt;SetSize( size );</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; filter-&gt;SetInput( reader-&gt;GetOutput() );</DIV>
<DIV>&nbsp; writer-&gt;SetInput( filter-&gt;GetOutput() );</DIV>
<DIV>&nbsp; writer-&gt;Update();</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; return EXIT_SUCCESS;</DIV>
<DIV>}</DIV></DIV></DIV></DIV></DIV></DIV></BODY></HTML>