Hi Antoine,<br><br>probably I had the same problem with DICOM converted in NIFTI using MIPAV (<a href="http://mipav.cit.nih.gov/">http://mipav.cit.nih.gov/</a>). <br>I solved the problem flipping and shifting the NIFTI file:<br>
<br>int main( int argc, char ** argv )<br>{<br>  typedef short      PixelType;<br>  const   unsigned int        Dimension = 3;<br><br>  typedef itk::OrientedImage&lt; PixelType, Dimension &gt; ImageType;<br><br>  typedef itk::ImageFileReader&lt; ImageType &gt;  ReaderType;<br>
  typedef itk::ImageFileWriter&lt; ImageType &gt;  WriterType;<br><br>  ReaderType::Pointer reader = ReaderType::New();<br>  WriterType::Pointer writer = WriterType::New();<br><br>  const char * inputFilename  = argv[1];<br>
  const char * outputFilename = argv[2];<br><br> reader-&gt;SetFileName( inputFilename  );<br> writer-&gt;SetFileName( outputFilename );<br><br>reader-&gt;Update();<br>reader-&gt;GetOutput()-&gt;Print(std::cout);<br><br>typedef itk::FlipImageFilter&lt; ImageType&gt; FlipType;<br>
  FlipType::Pointer flip = FlipType::New();<br><br> FlipType::FlipAxesArrayType flipAxesSet;<br><br>  flipAxesSet[0] = 0;<br>  flipAxesSet[1] = -1;<br>  flipAxesSet[2] = 0;<br><br>  flip-&gt;SetFlipAxes(flipAxesSet);<br>  flip-&gt;FlipAboutOriginOff();<br>
  flip-&gt;SetInput(reader-&gt;GetOutput());<br>  flip-&gt;Update();<br>  flip-&gt;GetOutput()-&gt;Print(std::cout);<br><br>ImageType::Pointer image = ImageType::New();<br>  image = flip-&gt;GetOutput();<br>  image-&gt;SetOrigin(reader-&gt;GetOutput()-&gt;GetOrigin());<br>
  image-&gt;Print(std::cout);<br><br>  writer-&gt;SetInput(image);<br>}<br><br>In this way if I read the original DICOM with itk I obtain:<br><br>TransformMatrix = 1 0 0 0 1 0 0 0 1<br>Offset = -250 -250 -515.03<br>AnatomicalOrientation = RAI <br>
<br>The NIFTI image converted using MIPAV is:<br><br>TransformMatrix = 1 0 0 0 -1 0 0 0 1<br>Offset = -250 -250 -515.03<br>AnatomicalOrientation = RPI<br><br>While the NIFTI image after flip and shif is:<br><br>TransformMatrix = 1 0 0 0 1 0 0 0 1<br>
Offset = -250 -250 -515.03<br>AnatomicalOrientation = RAI<br><br>Also, if I use Paraview to see the images (after a conversion in .mhd format) the original and the flipped and shifted one are consistent (are the same) while the other (NIFTI from MIPAV) has a wrong position and orientation.<br>
<br>I hope this could help you...<br><br>Elena<br><br><br><br><br>&gt; From: Luis Ibanez &lt;<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>&gt;<br>&gt; Subject: Re: [Insight-users] Nifti vs Dicom orientation<br>
&gt;<br>&gt; Hi Antoine,<br>&gt;<br>&gt; Thanks for looking at the original image orientation.<br>&gt;<br>&gt; It seems that the problem lies in the interpretation<br>&gt; of orientation in the Nii file...<br>&gt; or... it may be a bug in dcm2nii...<br>
&gt;<br>&gt;<br>&gt; I would suggest to post the question about the assumed<br>&gt; orientation of the Nifti file format to the Nifti forum:<br>&gt;<br>&gt;     <a href="http://nifti.nimh.nih.gov/board/list.php?f=1">http://nifti.nimh.nih.gov/board/list.php?f=1</a><br>
&gt;<br>&gt; Of course, we will be interested in learning about their<br>&gt; reply.<br>&gt;<br>&gt; It may mean that we need to modify the NiftiImageIO<br>&gt; class in ITK...<br>&gt;<br>&gt;<br>&gt; ---<br>&gt;<br>&gt; On the other hand, please note that in practice you don&#39;t<br>
&gt; need to use &quot;dcm2nii&quot; since you can achieve exactly the<br>&gt; same goal by runing the example:<br>&gt;<br>&gt;<br>&gt;     Insight/Examples/IO<br>&gt;        DicomSeriesReadImageWrite2.cxx<br>&gt;<br>&gt; (reading DICOM and saving it as a nifti file).<br>
&gt;<br>&gt; Which should give you a consistent set of orientations.<br>&gt;<br>&gt;<br>&gt;     Thanks<br>&gt;<br>&gt;<br>&gt;        Luis<br>&gt;<br>&gt;<br>&gt; ------------------------<br>&gt; Antoine DUCHAMPS wrote:<br>
&gt;&gt; Hi Luis,<br>&gt;&gt;<br>&gt;&gt; I&#39;ve read the original DICOM with ITK and I&#39;ve obtained exactly the same<br>&gt;&gt; direction cosines:<br>&gt;&gt;<br>&gt;&gt;  0.9997  0.0000  0.0252<br>&gt;&gt;  0.0002  1.0000 -0.0072<br>
&gt;&gt; -0.0252  0.0072  0.9997<br>&gt;&gt;<br>&gt;&gt; So, should I assume a LAS orientation in nii image? (even when the<br>&gt;&gt; standard is RAS)<br>&gt;&gt;<br>&gt;&gt; Antoine.<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>
&gt;&gt; Le lundi 06 avril 2009 ? 11:47 -0400, Luis Ibanez a ?crit :<br>&gt;&gt;<br>&gt;&gt;&gt;Hi Antoine,<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;Could you please read the original DICOM series with ITK and<br>&gt;&gt;&gt;report the Direction that you get from the ITK image in that case ?<br>
&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;In this way we will be able to figure out if the problem is in<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;A) the conversion from DICOM to Nifti as processed by &quot;dcm2nii&quot;<br>
&gt;&gt;&gt;<br>&gt;&gt;&gt;                 or<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;B) the process of reading the nifti file with itkNiftiImageIo.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;Please post to the list the Direction cosines that you obtain<br>
&gt;&gt;&gt;when your read the original DICOM series with ITK.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;    Thanks<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;          Luis<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;-----------------<br>
&gt;&gt;&gt;On Mon, Apr 6, 2009 at 10:46 AM, Antoine DUCHAMPS<br>&gt;&gt;&gt;&lt;<a href="mailto:antoine.duchamps@gmail.com">antoine.duchamps@gmail.com</a>&gt; wrote:<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;Hi all,<br>&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;I have a DWI sequence (brain) acquired with a Siemens scanner in Dicom<br>&gt;&gt;&gt;&gt;format. After converting it to NIfTI with dcm2nii<br>&gt;&gt;&gt;&gt;(<a href="http://www.sph.sc.edu/comd/rorden/mricron/dcm2nii.html">http://www.sph.sc.edu/comd/rorden/mricron/dcm2nii.html</a>) I tried to read<br>
&gt;&gt;&gt;&gt;it an recover the orientation by using ITK (I&#39;ve copied the code below).<br>&gt;&gt;&gt;&gt;The matrix I obtain is the following:<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; 0.9997  0.0000  0.0252<br>&gt;&gt;&gt;&gt; 0.0002 -1.0000 -0.0072<br>
&gt;&gt;&gt;&gt;-0.0252 -0.0072  0.9997<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;However, the transforation matrix in the Dicom header is<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; 0.9997  0.0000  0.0252<br>&gt;&gt;&gt;&gt; 0.0002  1.0000 -0.0072<br>
&gt;&gt;&gt;&gt;-0.0252  0.0072  0.9997<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;If the Dicom image orientation is LPS, this means that the image<br>&gt;&gt;&gt;&gt;orientation in NIfTI is LAS (And not RAS as I believed). Could anybody<br>
&gt;&gt;&gt;&gt;clarify this please? Are there several possible orientations in NIfTI?<br>&gt;&gt;&gt;&gt;If so, how can I know the specific image orientation?<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;Antoine.<br>&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;#include &quot;itkImageFileReader.h&quot;<br>&gt;&gt;&gt;&gt;#include &quot;itkOrientedImage.h&quot;<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;const unsigned int Dimension = 4;<br>&gt;&gt;&gt;&gt;typedef short PixelType;<br>
&gt;&gt;&gt;&gt;typedef itk::OrientedImage&lt;PixelType, Dimension&gt; ImageType;<br>&gt;&gt;&gt;&gt;typedef ImageType::Pointer ImagePointerType;<br>&gt;&gt;&gt;&gt;typedef itk::ImageFileReader&lt; ImageType &gt; ReaderType;<br>
&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;int main(int argc, char* argv[])<br>&gt;&gt;&gt;&gt;{<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; ImageType::Pointer image = ImageType::New();<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; ReaderType::Pointer reader = ReaderType::New();<br>
&gt;&gt;&gt;&gt; reader-&gt;SetFileName(argv[1]);<br>&gt;&gt;&gt;&gt; reader-&gt;Update();<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; image = reader -&gt; GetOutput();<br>&gt;&gt;&gt;&gt; std::cout &lt;&lt; image-&gt;GetDirection() &lt;&lt; std::endl; std::cout.flush();<br>
&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;}<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;_____________________________________<br>&gt;&gt;&gt;&gt;Powered by <a href="http://www.kitware.com">www.kitware.com</a><br>&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;Visit other Kitware open-source projects at<br>&gt;&gt;&gt;&gt;<a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;Please keep messages on-topic and check the ITK FAQ at: <a href="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;Follow this link to subscribe/unsubscribe:<br>&gt;&gt;&gt;&gt;<a href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a><br>&gt;&gt;&gt;&gt;<br>
&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;<br>&gt;<br>&gt; ------------------------------<br>&gt;<br>&gt; Message: 2<br>&gt; Date: Wed, 8 Apr 2009 15:04:43 -0400<br>&gt; From: Bradley Lowekamp &lt;<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>&gt;<br>
&gt; Subject: Re: [Insight-users] Visible Human Dataset<br>&gt; To: Zein Salah &lt;<a href="mailto:salah@gris.uni-tuebingen.de">salah@gris.uni-tuebingen.de</a>&gt;<br>&gt; Cc: ITK Users &lt;<a href="mailto:insight-users@itk.org">insight-users@itk.org</a>&gt;<br>
&gt; Message-ID: &lt;<a href="mailto:30DAA271-C7D3-4C09-A11C-3D015A1B0CB9@mail.nih.gov">30DAA271-C7D3-4C09-A11C-3D015A1B0CB9@mail.nih.gov</a>&gt;<br>&gt; Content-Type: text/plain; charset=&quot;us-ascii&quot;; Format=&quot;flowed&quot;;<br>
&gt;        DelSp=&quot;yes&quot;<br>&gt;<br>&gt; Hello Zein,<br>&gt;<br>&gt; You can find all the information for the original data here:<br>&gt;<br>&gt; <a href="http://www.nlm.nih.gov/research/visible/visible_human.html">http://www.nlm.nih.gov/research/visible/visible_human.html</a><br>
&gt; <a href="http://www.nlm.nih.gov/research/visible/getting_data.html">http://www.nlm.nih.gov/research/visible/getting_data.html</a><br>&gt;<br>&gt; The uncompressed Fullcolor slices are 7471104 bytes. The original data<br>
&gt; on the ftp is losslessly &quot;Z&quot; compress, but the sizes of these files<br>&gt; very. They are originally named a_vm1001.raw.Z to a_vm2878.raw.Z<br>&gt;<br>&gt; Then the radiological frozenCT data is name c_vm1006.fro.Z to<br>
&gt; c_vm2882.fro.Z when they are decompressed they are only 527704 bytes.<br>&gt;<br>&gt; As your data does not match any of the original data, it has likely<br>&gt; been processed some how. Hopefully there is information contained in<br>
&gt; the .inf file to help you.<br>&gt;<br>&gt; Good luck,<br>&gt; Brad<br>&gt;<br>&gt;<br>&gt; On Apr 7, 2009, at 4:37 PM, Zein Salah wrote:<br>&gt;<br>&gt;&gt; Hello all,<br>&gt;&gt;<br>&gt;&gt; I have a copy of the Visible Human data (colored, male) which I<br>
&gt;&gt; downloaded some years ago. I am trying now to read it using itk. I<br>&gt;&gt; found information how to generate a .mhd file for the raw images<br>&gt;&gt; that I have. My problem is that I do not any more know the<br>
&gt;&gt; specification of the data, i.e. resolution, pixel type, etc.<br>&gt;&gt;<br>&gt;&gt; The data look like this:<br>&gt;&gt;<br>&gt;&gt; - There are raw files named as follows: c_vm1006.raw,<br>&gt;&gt; c_vm1007.raw, ..., c_vm2882.raw.<br>
&gt;&gt; - There is a file named vismale_fro.inf<br>&gt;&gt; - The size of each raw file is exactly  4,980,736 bytes<br>&gt;&gt;<br>&gt;&gt; Does any body have this data? Can somebody help me identifying the<br>&gt;&gt; specification of the data that I have, probably with a suitable .mhd<br>
&gt;&gt; file?<br>&gt;&gt;<br>&gt;&gt; Much thanks,<br>&gt;&gt;<br>&gt;&gt; Zein<br>&gt;&gt; &lt;ATT00001.txt&gt;<br>&gt;<br>&gt; ========================================================<br>&gt; Bradley Lowekamp<br>&gt; Lockheed Martin Contractor for<br>
&gt; Office of High Performance Computing and Communications<br>&gt; National Library of Medicine<br>&gt; <a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a><br>&gt;<br>&gt;<br>&gt; -------------- next part --------------<br>
&gt; An HTML attachment was scrubbed...<br>&gt; URL: &lt;<a href="http://www.itk.org/pipermail/insight-users/attachments/20090408/891c8f3c/attachment-0001.htm">http://www.itk.org/pipermail/insight-users/attachments/20090408/891c8f3c/attachment-0001.htm</a>&gt;<br>
&gt;<br>&gt; ------------------------------<br>&gt;<br>&gt; Message: 3<br>&gt; Date: Wed, 8 Apr 2009 23:29:09 -0400<br>&gt; From: Geoff Topping &lt;<a href="mailto:g_topping@hotmail.com">g_topping@hotmail.com</a>&gt;<br>&gt; Subject: [Insight-users] ResampleImageFilter Producing Garbled Output<br>
&gt;        When    Image Size Changed<br>&gt; To: &lt;<a href="mailto:insight-users@itk.org">insight-users@itk.org</a>&gt;<br>&gt; Message-ID: &lt;COL104-W51D457E7BFA5B25CF998B58C830@phx.gbl&gt;<br>&gt; Content-Type: text/plain; charset=&quot;iso-8859-1&quot;<br>
&gt;<br>&gt;<br>&gt; Hi.<br>&gt;<br>&gt; I&#39;m trying to use ResampleImageFilter to resize, crop or expand the volume of an image using ITK.  My input image is 128x128x95 voxels with spacings of 0.865759x0.865759x0.796, 16-bit signed integer Analyze75 format.<br>
&gt;<br>&gt; When I use the following code (see full listing below for context) to set the output image size and scaling, things work fine, and I get back an image very similar to my input image (although stored as floats instead of signed ints, and with the calibration factor ignored by the casting between formats):<br>
&gt;<br>&gt;    resampleFilter-&gt;SetSize(                inputImage-&gt;GetLargestPossibleRegion().GetSize());<br>&gt;    resampleFilter-&gt;SetOutputOrigin(        inputImage-&gt;GetOrigin());<br>&gt;    resampleFilter-&gt;SetOutputSpacing(       inputImage-&gt;GetSpacing());<br>
&gt;<br>&gt; When I switch to using hard coded image size and spacings (128x128x95 and 0.865759x0.865759x0.796), I also get an effectively identical output image:<br>&gt;<br>&gt;    double spacing[] = {0.865759, 0.865759, 0.796};<br>
&gt;    resampleFilter-&gt;SetOutputSpacing(spacing);<br>&gt;<br>&gt;    double origin[] = {0.0, 0.0, 0.0};<br>&gt;    resampleFilter-&gt;SetOutputOrigin(origin);<br>&gt;<br>&gt;    ImageType::SizeType size = {128, 128, 95};<br>
&gt;    resampleFilter-&gt;SetSize(size);<br>&gt;<br>&gt; However, if I change the hard-coded image size, I get garbled output.  Setting hard-coded size to 256x256x190, with or without dividing all the spacings by 2.0 results in most, but not all, of the slices of the resulting image being quite garbled, with apparent tilings of a few slices over and over, occasional mirroring of a series of slices, or what looks like the early frames of a high-speed camera observing an exploding object, instead of the original image contents.  Examining the resulting images, I see four copies of the (distorted) image in some of the transverse slices, tiled ul, ur, ll, lr.  In other slice orientations I see two or four tiled copies in a row.<br>
&gt;<br>&gt; Any ideas what might be going wrong or how I can fix or debug this?<br>&gt;<br>&gt; Thanks,<br>&gt; Geoff Topping<br>&gt;<br>&gt;<br>&gt; My current code:<br>&gt;<br>&gt;<br>&gt; The program takes two filenames from the command line: input image and output image file name.  It reads the input image, applies an identity transform while resampling, and outputs the resulting image.<br>
&gt;<br>&gt; ***********************************************************************<br>&gt;<br>&gt; #include &quot;itkVersorRigid3DTransform.h&quot;<br>&gt; #include &quot;itkIdentityTransform.h&quot;<br>&gt;<br>&gt; #include &quot;itkNearestNeighborInterpolateImageFunction.h&quot;<br>
&gt; #include &quot;itkLinearInterpolateImageFunction.h&quot;<br>&gt;<br>&gt; #include &quot;itkImage.h&quot;<br>&gt; #include &quot;itkImageFileReader.h&quot;<br>&gt; #include &quot;itkImageFileWriter.h&quot;<br>&gt;<br>
&gt; #include &quot;itkResampleImageFilter.h&quot;<br>&gt; #include &quot;itkShiftScaleImageFilter.h&quot;<br>&gt;<br>&gt;<br>&gt; #include &quot;vcl_cmath.h&quot;<br>&gt;<br>&gt; namespace {<br>&gt;    const unsigned int                                              Dimension = 3;<br>
&gt;    typedef float                                                   PixelType;<br>&gt;    typedef itk::Image&lt;PixelType, Dimension&gt;                        ImageType;<br>&gt;    typedef itk::ImageFileReader&lt;ImageType&gt;                         ImageReaderType;<br>
&gt;    typedef itk::ImageFileWriter&lt;ImageType&gt;                         ImageWriterType;<br>&gt;<br>&gt;    typedef itk::VersorRigid3DTransform&lt;double&gt;                     RigidTransformType;<br>&gt;    typedef itk::IdentityTransform&lt;double, Dimension&gt;               IdentityTransformType;<br>
&gt;    typedef IdentityTransformType                                   TransformType;<br>&gt;<br>&gt;    typedef itk::LinearInterpolateImageFunction&lt;ImageType, double&gt;  LinearInterpolatorType;<br>&gt;    typedef itk::NearestNeighborInterpolateImageFunction&lt;<br>
&gt;                ImageType, double&gt;                                  NearestInterpolatorType;<br>&gt;    typedef NearestInterpolatorType                                 InterpolatorType;<br>&gt;<br>&gt;    typedef itk::ResampleImageFilter&lt;ImageType, ImageType&gt;          ResampleFilterType;<br>
&gt; }<br>&gt;<br>&gt;<br>&gt; int main( int argc, char *argv[] ) {<br>&gt;    if( argc &lt; 2 ) {<br>&gt;        std::cerr &lt;&lt; &quot;Missing Parameters &quot; &lt;&lt; std::endl;<br>&gt;        std::cerr &lt;&lt; &quot;Usage: &quot; &lt;&lt; argv[0] &lt;&lt; &quot; fixedImageFile movingImageFile outputImagefile&quot; &lt;&lt; std::endl;<br>
&gt;        return EXIT_FAILURE;<br>&gt;    }<br>&gt;<br>&gt;<br>&gt;    ImageReaderType::Pointer imageReader =          ImageReaderType::New();<br>&gt;    imageReader-&gt;SetFileName(argv[1]);<br>&gt;    imageReader-&gt;Update();<br>
&gt;<br>&gt;<br>&gt;    TransformType::Pointer transform =              TransformType::New();<br>&gt;<br>&gt;    InterpolatorType::Pointer interpolator =        InterpolatorType::New();<br>&gt;<br>&gt;<br>&gt;    ImageType::Pointer inputImage = imageReader-&gt;GetOutput();<br>
&gt;<br>&gt;<br>&gt;    ResampleFilterType::Pointer resampleFilter =    ResampleFilterType::New();<br>&gt;    resampleFilter-&gt;SetInput(               inputImage);<br>&gt;    resampleFilter-&gt;SetTransform(           transform);<br>
&gt;    resampleFilter-&gt;SetInterpolator(        interpolator);<br>&gt;    resampleFilter-&gt;SetDefaultPixelValue(   0);<br>&gt;    resampleFilter-&gt;SetOutputDirection(     inputImage-&gt;GetDirection());<br>&gt;<br>
&gt;<br>&gt; #ifdef FROM_INPUT<br>&gt;    resampleFilter-&gt;SetSize(                inputImage-&gt;GetLargestPossibleRegion().GetSize());<br>&gt;    resampleFilter-&gt;SetOutputOrigin(        inputImage-&gt;GetOrigin());<br>
&gt;    resampleFilter-&gt;SetOutputSpacing(       inputImage-&gt;GetSpacing());<br>&gt; #endif<br>&gt;<br>&gt; #ifdef PRINT_INPUT_STUFF<br>&gt;    const ImageType::SpacingType&amp; inputImageSpacing = inputImage-&gt;GetSpacing();<br>
&gt;    std::cout &lt;&lt; &quot;input image spacings: &quot; &lt;&lt; inputImageSpacing[0] &lt;&lt; &quot;, &quot;<br>&gt;                                          &lt;&lt; inputImageSpacing[1] &lt;&lt; &quot;, &quot;<br>
&gt;                                          &lt;&lt; inputImageSpacing[2] &lt;&lt; std::endl;<br>&gt;<br>&gt;    const ImageType::PointType&amp; inputImageOrigin = inputImage-&gt;GetOrigin();<br>&gt;    std::cout &lt;&lt; &quot;input image origin: &quot; &lt;&lt; inputImageOrigin[0] &lt;&lt; &quot;, &quot;<br>
&gt;                                        &lt;&lt; inputImageOrigin[1] &lt;&lt; &quot;, &quot;<br>&gt;                                        &lt;&lt; inputImageOrigin[2] &lt;&lt; std::endl;<br>&gt;<br>&gt;    const ImageType::SizeType&amp; inputImageSize = inputImage-&gt;GetLargestPossibleRegion().GetSize();<br>
&gt;    std::cout &lt;&lt; &quot;input image size: &quot; &lt;&lt; inputImageSize[0] &lt;&lt; &quot;, &quot;<br>&gt;                                      &lt;&lt; inputImageSize[1] &lt;&lt; &quot;, &quot;<br>&gt;                                      &lt;&lt; inputImageSize[2] &lt;&lt; std::endl;<br>
&gt; #endif<br>&gt;<br>&gt; //#ifdef HARD_CODED<br>&gt;    double spacing[] = {0.865759, 0.865759, 0.796};<br>&gt;    resampleFilter-&gt;SetOutputSpacing(spacing);<br>&gt;<br>&gt;    double origin[] = {0.0, 0.0, 0.0};<br>
&gt;    resampleFilter-&gt;SetOutputOrigin(origin);<br>&gt;<br>&gt;    ImageType::SizeType size = {128, 128, 95};<br>&gt;    resampleFilter-&gt;SetSize(size);<br>&gt; //#endif<br>&gt;<br>&gt;<br>&gt;    ImageWriterType::Pointer writer =               ImageWriterType::New();<br>
&gt;    writer-&gt;SetFileName(argv[2]);<br>&gt;    writer-&gt;SetInput(resampleFilter-&gt;GetOutput());<br>&gt;<br>&gt;    try {<br>&gt;        writer-&gt;Update();<br>&gt;    } catch (itk::ExceptionObject&amp; err) {<br>
&gt;        std::cerr &lt;&lt; &quot;ExceptionObject caught !&quot; &lt;&lt; std::endl;<br>&gt;        std::cerr &lt;&lt; err &lt;&lt; std::endl;<br>&gt;        return EXIT_FAILURE;<br>&gt;    }<br>&gt;<br>&gt;    return EXIT_SUCCESS;<br>
&gt; }<br>&gt;<br>&gt;<br>&gt; _________________________________________________________________<br>&gt; Reinvent how you stay in touch with the new Windows Live Messenger.<br>&gt; <a href="http://go.microsoft.com/?linkid=9650731">http://go.microsoft.com/?linkid=9650731</a><br>
&gt; -------------- next part --------------<br>&gt; An HTML attachment was scrubbed...<br>&gt; URL: &lt;<a href="http://www.itk.org/pipermail/insight-users/attachments/20090408/b8f41c60/attachment.htm">http://www.itk.org/pipermail/insight-users/attachments/20090408/b8f41c60/attachment.htm</a>&gt;<br>
&gt;<br>&gt; ------------------------------<br>&gt;<br>&gt; _______________________________________________<br>&gt; Insight-users mailing list<br>&gt; <a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br>&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;<br>&gt;<br>&gt; End of Insight-users Digest, Vol 60, Issue 44<br>&gt; *********************************************<br>&gt;<br><br>