<DIV>Hello,</DIV>  <DIV> </DIV>  <DIV>I am having problem in resampling an image. The code is given below and appreciate if somebody help me out:</DIV>  <DIV> </DIV>  <DIV>#if defined(_MSC_VER)<BR>#pragma warning ( disable : 4786 )<BR>#endif</DIV>  <DIV>#include "itkImage.h"<BR>#include "itkImageFileReader.h"<BR>#include "itkImageFileWriter.h"<BR>#include "itkResampleImageFilter.h"<BR>#include "itkAffineTransform.h"<BR>#include "itkNearestNeighborInterpolateImageFunction.h"</DIV>  <DIV><BR>int main( int argc, char * argv[] )<BR>{<BR>  if( argc < 3 )<BR>    {<BR>    std::cerr << "Usage: " << std::endl;<BR>    std::cerr << argv[0] << "  inputImageFile  outputImageFile";<BR>   std::cerr << std::endl;<BR>    return EXIT_FAILURE;<BR>    }</DIV>  <DIV>  const     unsigned int   Dimension = 3;<BR> 
 typedef   unsigned char  InputPixelType;<BR>  typedef   unsigned char  OutputPixelType;</DIV>  <DIV> </DIV>  <DIV>  typedef itk::Image< InputPixelType,  Dimension >   InputImageType;<BR>  typedef itk::Image< OutputPixelType, Dimension >   OutputImageType;</DIV>  <DIV> </DIV>  <DIV>  typedef itk::ImageFileReader< InputImageType  >  ReaderType;<BR>  typedef itk::ImageFileWriter< OutputImageType >  WriterType;</DIV>  <DIV> </DIV>  <DIV>  ReaderType::Pointer reader = ReaderType::New();<BR>  WriterType::Pointer writer = WriterType::New();</DIV>  <DIV> </DIV>  <DIV>  reader->SetFileName( argv[1] );<BR>  writer->SetFileName( argv[2] );</DIV>  <DIV> </DIV>  <DIV>  typedef itk::ResampleImageFilter<<BR>                 
 InputImageType, OutputImageType >  FilterType;<BR>  FilterType::Pointer filter = FilterType::New();<BR>  <BR>  typedef itk::AffineTransform< double, Dimension >  TransformType;<BR>  TransformType::Pointer transform = TransformType::New();<BR>  transform->SetIdentity();<BR>  filter->SetTransform( transform );<BR>  <BR>  typedef itk::NearestNeighborInterpolateImageFunction< <BR>                       InputImageType, double >  InterpolatorType;<BR>  InterpolatorType::Pointer interpolator = InterpolatorType::New();</DIV>  <DIV>  filter->SetInterpolator( interpolator );</DIV>  <DIV> </DIV>  <DIV>  filter->SetOutputOrigin(reader->GetOutput()->GetOrigin());<BR> <BR>  double spacing[ Dimension ];<BR>  spacing[0] = 0.5; // pixel spacing in
 millimeters along X<BR>  spacing[1] = 0.5; // pixel spacing in millimeters along Y<BR>  spacing[2] = 0.5; // pixel spacing in millimeters along Z<BR>  filter->SetOutputSpacing( spacing );</DIV>  <DIV> </DIV>  <DIV>  InputImageType::SizeType   size;<BR>  size[0] = 80;  // number of pixels along X<BR>  size[1] = 128;  // number of pixels along Y<BR>  size[2] = 128;  // number of pixels along Z<BR>  filter->SetSize( size );</DIV>  <DIV> </DIV>  <DIV>  filter->SetInput( reader->GetOutput() );<BR>  writer->SetInput( filter->GetOutput() );</DIV>  <DIV> </DIV>  <DIV>  filter->SetDefaultPixelValue( 0 );</DIV>  <DIV> </DIV>  <DIV>  try <BR>  { <BR>   writer->Update();<BR>  } <BR>  <BR>  catch( itk::ExceptionObject & err ) <BR>  { <BR>   std::cout << "ExceptionObject caught !" << std::endl;
 <BR>   std::cout << err << std::endl; <BR>   system("pause");<BR>   return EXIT_FAILURE;<BR>  }<BR>  <BR>  return EXIT_SUCCESS;<BR>}</DIV>  <DIV> </DIV>  <DIV>Thanks<BR>Shahab</DIV><p> 
                <hr size=1><a href="http://us.rd.yahoo.com/evt=43256/*http://advision.webevents.yahoo.com/mailbeta"> All-new Yahoo! Mail </a>- Fire up a more powerful email and get things done faster.