[Insight-users] need help with my Code
Nadia Alvi
nadiaalvi at yahoo.com
Wed Aug 27 10:20:35 EDT 2008
Hi All,
Please see the code attached.
It should read the 3 slices and write them as a tiff file but it only reads the 2nd slice and write it 3 times in a tiff file. Apparently it is incrementing the start index by 1 and reading that slice 3 times.
Can some body please help me in finding what i m doing wrong?
Many many thanks
Nadia
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef unsigned char PixelType;
const unsigned int Dimension = 3;
typedef itk::Image< PixelType, Dimension > ImageType;
typedef itk::ImageSeriesReader< ImageType > ReaderType;
typedef itk::ImageFileWriter<ImageType> WriterType;
WriterType::Pointer writer = WriterType::New();
ReaderType::Pointer reader1 = ReaderType::New();
typedef itk::NumericSeriesFileNames NameGeneratorType;
NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();
nameGenerator->SetSeriesFormat( "clint_binary_080320_noDescription%04d.tiff" );
nameGenerator->SetStartIndex(1);
nameGenerator->SetEndIndex(3);
nameGenerator->SetIncrementIndex(1);
reader1->SetImageIO( itk::TIFFImageIO::New() );
reader1->SetFileNames( nameGenerator->GetFileNames() );
writer->SetFileName("labeledImage.tif");
writer->SetInput(reader1->GetOutput());
try
{
writer->Update();
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20080827/23c9df8c/attachment.htm>
More information about the Insight-users
mailing list