[Insight-users] 3D RGB images in Analyze format
Julian Tam
julian.t at gmail.com
Mon Jul 4 16:57:38 EDT 2005
Hello,
I am trying to write a 3D RGB image in Analyze format, but the
following exception is caught:
itk::ExceptionObject (00FCE950)
Location: "Unknown"
File: \library\itk_1.8.0\src\Code\Io\itkAnalyzeImageIO.cxx
Line: 965
Description: More than one component per pixel not supported
The following includes pertinent excerpts of my program.
-------------------------------
#include "itkRGBPixel.h"
const unsigned int Dimension = 3;
typedef itk::RGBPixel< unsigned char> outPixelType;
typedef itk::Image< outPixelType, Dimension > outImageType;
typedef itk::ImageFileWriter< outImageType > WriterType;
outImageType::Pointer outputImage = outImageType::New();
// outputImage allocated and processed here
WriterType::Pointer writer = WriterType::New();
writer->SetFileName("out.img");
writer->SetInput( outputImage );
try
{
writer->Update();
}
catch ( itk::ExceptionObject &err)
{
std::cerr << err << std::endl;
return -1;
}
---------------------------
When I alter my program to create 2D RGB images and output them as
.png, I do not encounter any problems.
Are there any special steps that I need to take to accomplish this task?
Thanks,
Julian
More information about the Insight-users
mailing list