[Insight-users] US1d3ITKImgType not found
Ali Habib
ali.mahmoud.habib at gmail.com
Sun Jan 2 09:30:46 EST 2011
Dear All,
I tried the following code but it always give error that
US1d3ITKImgType , S1d3ITKImgType ,.. not defined am I missing something
sorry for this naive question
Best regards
typedef itk::ImageIOBase::IOComponentType *ScalarPixelType*;
itk::ImageIOBase::Pointer imageIO =
itk::ImageIOFactory::CreateImageIO(
params::filenameIn, itk::ImageIOFactory::ReadMode);
if (!imageIO) {
std::cerr << "Unable to create a valid ImageIO for image " <<
params::filenameIn << ". Exiting." << std::endl;
return -1;
}
// Now that we found the appropriate ImageIO class, ask it to
// read the meta data from the image file.
//
imageIO->SetFileName(params::filenameIn);
imageIO->ReadImageInformation();
const *ScalarPixelType* pixelType = imageIO->GetComponentType();
if (params::verbose)
std::cout << "Pixel Type is " <<
imageIO->GetComponentTypeAsString(pixelType)
<< std::endl;
const size_t numDimensions = imageIO->GetNumberOfDimensions();
if (numDimensions != 3) {
std::cerr << "This soft only soports 3D volumes. Exiting"
<< std::endl;
return -1;
}
switch (pixelType) {
case itk::ImageIOBase::UCHAR: DoTheRealThing<UC1d3ITKImgType>();
break; //UC1d3ITKImgType
= unsigned char image of 1 channel, 3 dimensions
case itk::ImageIOBase::SHORT: DoTheRealThing<S1d3ITKImgType>(); break;
//S1d3 = Short, one chanel, 3dimensions
case itk::ImageIOBase::USHORT: DoTheRealThing<US1d3ITKImgType>(); break;
case itk::ImageIOBase::FLOAT: DoTheRealThing<F1d3ITKImgType>(); break;
default:
std::cerr << "Pixel Type ("
<< imageIO->GetComponentTypeAsString(pixelType)
<< ") not supported. Exiting." << std::endl;
return -1;
}
return 0;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110102/9aed2b3e/attachment.htm>
More information about the Insight-users
mailing list