Dawood Masslawi | 2 Jan 2011 16:48
Picon
Favicon

Re: US1d3ITKImgType not found

Dear Ali,

As I see, you haven't constructed the used image types in the templated class
"DoTheRealThing()" which should have been done with the proper pixel types and
dimensions. Something like,

typedef short    PixelType; 
const   unsigned int  Dimension = 2;
typedef itk::Image<PixelType, Dimension>   S1d3ITKImgType;

Hope this helps,
Dawood

--- On Sun, 1/2/11, Ali Habib <ali.mahmoud.habib-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

From: Ali Habib <ali.mahmoud.habib-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: US1d3ITKImgType not found
To: insight-users-RyaoCGfWeh4@public.gmane.org, "Dan Mueller" <dan.muel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>, "Dawood Masslawi" <davoud_zzz-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>
Date: Sunday, January 2, 2011, 9:30 AM

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;

_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.html

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users

Gmane