<br><font size=2 face="sans-serif">Hi all,</font>
<br>
<br><font size=2 face="sans-serif">Is there a problem using ImageFileWriter with an itk::NthElementImageAdaptor adaptor ?</font>
<br><font size=2 face="sans-serif">after a few tries, it appeared to me that the file generated is incorect.</font>
<br>
<br><font size=2 face="sans-serif">The following programs reads a itk::Image<Vector<float,3>,3> image and writes the first component into a separate image as itk::Image<float,3></font>
<br><font size=2 face="sans-serif">But when I view the output, the image looks interlaced (terrible!)... </font>
<br><font size=2 face="sans-serif">Am I doing sthg wrong.</font>
<br><font size=2 color=#008000><tt> </tt></font>
<br><font size=2 color=blue><tt>#include</tt></font><font size=2><tt> "itkImage.h"</tt></font>
<br><font size=2 color=blue><tt>#include</tt></font><font size=2><tt> "itkImageFileReader.h"</tt></font>
<br><font size=2 color=blue><tt>#include</tt></font><font size=2><tt> "itkImageFileWriter.h"</tt></font>
<br><font size=2 color=blue><tt>#include</tt></font><font size=2><tt> "itkNthElementImageAdaptor.h"</tt></font>
<br>
<br><font size=2 color=blue><tt>int</tt></font><font size=2><tt> main( </tt></font><font size=2 color=blue><tt>int</tt></font><font size=2><tt> argc, </tt></font><font size=2 color=blue><tt>char</tt></font><font size=2><tt> *argv[])</tt></font>
<br><font size=2><tt>{</tt></font>
<br><font size=2><tt> </tt></font>
<br><font size=2><tt> </tt></font><font size=2 color=blue><tt>typedef</tt></font><font size=2><tt> itk::Vector<</tt></font><font size=2 color=blue><tt>float</tt></font><font size=2><tt>,3> VectPixelType;</tt></font>
<br><font size=2><tt> </tt></font><font size=2 color=blue><tt>typedef</tt></font><font size=2><tt> itk::Image< VectPixelType, 3 > VectImageType; </tt></font>
<br><font size=2><tt> </tt></font><font size=2 color=blue><tt>typedef</tt></font><font size=2><tt> itk::NthElementImageAdaptor<VectImageType,</tt></font><font size=2 color=blue><tt>float</tt></font><font size=2><tt>> NthAdaptorType;</tt></font>
<br><font size=2><tt> </tt></font><font size=2 color=blue><tt>typedef</tt></font><font size=2><tt> itk::ImageFileWriter< NthAdaptorType > FloatWriterType;</tt></font>
<br>
<br><font size=2><tt> </tt></font><font size=2 color=#008000><tt>// read a vect image</tt></font>
<br><font size=2><tt> </tt></font><font size=2 color=blue><tt>typedef</tt></font><font size=2><tt> itk::ImageFileReader< VectImageType > ReaderType;</tt></font>
<br><font size=2><tt> ReaderType::Pointer reader = ReaderType::New();</tt></font>
<br><font size=2><tt> reader->SetFileName( argv[1] );</tt></font>
<br>
<br><font size=2><tt> VectImageType::Pointer myVectImage = reader->GetOutput();</tt></font>
<br><font size=2><tt> reader->Update();</tt></font>
<br><font size=2><tt> </tt></font>
<br><font size=2><tt> FloatWriterType::Pointer fwriter = FloatWriterType::New();</tt></font>
<br><font size=2><tt> NthAdaptorType::Pointer adapt = NthAdaptorType::New();</tt></font>
<br>
<br><font size=2><tt> adapt->SetImage(myVectImage);</tt></font>
<br><font size=2><tt> adapt->SelectNthElement(0);</tt></font>
<br>
<br><font size=2><tt> fwriter->SetInput(adapt);</tt></font>
<br><font size=2><tt> fwriter->SetFileName(argv[2]);</tt></font>
<br><font size=2><tt> fwriter->Update();</tt></font>
<br>
<br><font size=2><tt> </tt></font><font size=2 color=blue><tt>return</tt></font><font size=2><tt> 0;</tt></font>
<br><font size=2><tt>}</tt></font>
<br>