<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>Hi Luis,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks for your reply. </DIV>
<DIV>&nbsp;</DIV>
<DIV>I am trying to read a sequence of three 2d tif images&nbsp;and write them as one tiff file (with&nbsp;three slices). So that the output image would be one tiff image with 3 slices.</DIV>
<DIV>&nbsp;</DIV>
<DIV>This is the exactly the same thing that is explained in section 7.11.1 of ITKSoftwareGuide(i.e. Reading Image Series). </DIV>
<DIV>I want to mention one interesting thing. While experimenting with the code, when I removed the code line, reader1-&gt;SetImageIO( itk::TIFFImageIO::New() ); ,&nbsp;the code&nbsp;worked perfectly fine. Is this because it is now using some other ImageIO?</DIV>
<DIV>&nbsp;</DIV>
<DIV>I am really very thankful for any help.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Kind regards</DIV>
<DIV>Nadia<BR></DIV>
<DIV><BR><BR>--- On <B>Sun, 8/31/08, Luis Ibanez <I>&lt;luis.ibanez@kitware.com&gt;</I></B> wrote:<BR></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid">From: Luis Ibanez &lt;luis.ibanez@kitware.com&gt;<BR>Subject: Re: [Insight-users] need help with my Code<BR>To: nadiaalvi@yahoo.com<BR>Cc: insight-users@itk.org<BR>Date: Sunday, August 31, 2008, 10:04 AM<BR><BR><PRE>Hi Nadia,


    The TIFF format doesn't support 3D images.


Are you trying to write a 3D TIFF image ?

or

Are you trying to write 3 TIFF files each one with a 2D image ?


Please let us know,


    Thanks


       Luis


-----------------
Nadia Alvi wrote:
&gt; 
&gt;     Hi All,
&gt;      
&gt;     Please see the code attached.
&gt;     It should read the 3 slices and write them as a tiff file but it
&gt;     only reads the 2nd slice and write it 3 times in a tiff file.
&gt;     Apparently it is incrementing the start index by 1 and reading that
&gt;     slice 3 times.
&gt;     Can some body please help me in finding what i m doing wrong?
&gt;     Many many thanks
&gt;     Nadia
&gt;      
&gt;    
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
&gt; 
&gt;     typedef unsigned char                       PixelType;
&gt;       const unsigned int Dimension = 3;
&gt;      
&gt;       typedef itk::Image&lt; PixelType, Dimension &gt;  ImageType;
&gt;      
&gt;       typedef itk::ImageSeriesReader&lt; ImageType &gt;  ReaderType;
&gt;       typedef itk::ImageFileWriter&lt;ImageType&gt; WriterType;
&gt; 
&gt;       WriterType::Pointer writer = WriterType::New();
&gt;       ReaderType::Pointer reader1 = ReaderType::New();
&gt;       typedef itk::NumericSeriesFileNames    NameGeneratorType;
&gt;       NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();
&gt;       nameGenerator-&gt;SetSeriesFormat(
&gt;     "clint_binary_080320_noDescription%04d.tiff" );
&gt;       nameGenerator-&gt;SetStartIndex(1);
&gt;       nameGenerator-&gt;SetEndIndex(3);
&gt;       nameGenerator-&gt;SetIncrementIndex(1);
&gt; 
&gt;       reader1-&gt;SetImageIO( itk::TIFFImageIO::New() );
&gt;       reader1-&gt;SetFileNames( nameGenerator-&gt;GetFileNames()  );
&gt; 
&gt;       writer-&gt;SetFileName("labeledImage.tif");
&gt;       writer-&gt;SetInput(reader1-&gt;GetOutput());
&gt;       try
&gt;         {
&gt;       
&gt;       writer-&gt;Update();
&gt;         }
&gt; 
&gt; 
&gt; 
&gt; 
&gt; ------------------------------------------------------------------------
&gt; 
&gt; _______________________________________________
&gt; Insight-users mailing list
&gt; Insight-users@itk.org
&gt; http://www.itk.org/mailman/listinfo/insight-users
</PRE></BLOCKQUOTE></td></tr></table><br>