[Insight-users] read rgb values
shirani kannangara
mangalika673 at gmail.com
Mon Sep 17 06:33:56 EDT 2012
I am constructing a program to read rgb values in a raw image data set
of a human abdomen obtained from a CT scan(VHP abdomen).Slice dimensions
are 675,401,450 and spacing0.333 etc.) I used
RGBImageSeriesReadeWrite.cxx.I am using itk version 4.2 and CMake2.8.9. I
have constructed and spent many hours on my last error.
Error:error C2447: '{' : missing function header (old-style formal list?)
Pl help me get it corrected.
Thanks
Shirani
codes
#include "itkRGBPixel.h"
#include "itkImage.h"
#include "itkImageSeriesReader.h"
#include "itkImageSeriesWriter.h"
#include "itkNumericSeriesFileNames.h"
#include "itkPNGImageIO.h"
#include <string>
using namespace std;
// Software Guide : EndCodeSnippet
int main( int argc, char * argv[] );
char test;
{
// Verify the number of parameters in the command line
if( argc < 4 )
{
std::cout << "Usage: " << std::endl;
std::cout << argv[0] << "first last outputRGBImageFile " << std::endl;
return EXIT_FAILURE;
}
typedef itk::RGBPixel< unsigned char > PixelType;
const unsigned int Dimension = 3;
typedef itk::Image< PixelType, Dimension > ImageType;
// Software Guide : BeginCodeSnippet
typedef itk::ImageSeriesReader< ImageType > SeriesReaderType;
typedef itk::ImageFileWriter< ImageType > WriterType;
SeriesReaderType::Pointer seriesReader = SeriesReaderType::New();
WriterType::Pointer writer = WriterType::New();
reader->SetFileName("D:\\To_SMK\\VHPAbdomen.mhd");
reader->Update();
const unsigned int first = 1;
const unsigned int last = 450;
const char*outputFilename= argv[3];
typedef itk::NumericSeriesFileNames NameGeneratorType;
NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();
const char * outputFilename = argv[3];
typedef itk::NumericSeriesFileNames NameGeneratorType;
NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();
nameGenerator->SetStartIndex( first );
nameGenerator->SetEndIndex( last );
nameGenerator->SetIncrementIndex( 0.333 );
nameGenerator->SetSeriesFormat( "vwe%03d.png" );
seriesReader->SetImageIO( itk::PNGImageIO::New() );
seriesReader->SetFileNames( nameGenerator->GetFileNames() );
writer->SetFileName( "test.png" );
writer->SetInput( seriesReader->GetOutput() );
try
{
writer->Update();
}
catch( itk::ExceptionObject & excp )
{
std::cerr << "Error reading the series " << std::endl;
std::cerr << excp << std::endl;
}
typedef itk::Image< PixelType, 2 > Image2DType;
typedef itk::ImageSeriesWriter< ImageType, Image2DType > SeriesWriterType;
SeriesWriterType::Pointer seriesWriter = SeriesWriterType::New();
seriesWriter->SetInput( seriesReader->GetOutput() );
try
{
seriesWriter->Update();
}
catch( itk::ExceptionObject & excp )
{
std::cerr << "Error reading the series " << std::endl;
std::cerr << excp << std::endl;
}
return EXIT_SUCCESS;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120917/b606b437/attachment.htm>
More information about the Insight-users
mailing list