[Insight-users] [ITK Community] newbie C++ question

Massinissa Bandou Massinissa.Bandou at USherbrooke.ca
Fri Jan 10 01:34:56 EST 2014


Hi Dženan Zukić,

I just want to know what's wrong with the code below because I have 5
errors:


Error	2	error C2146: syntax error : missing ';' before identifier
'ComponentType'	c:\program
files\itk\include\itk-4.4\itkDefaultConvertPixelTraits.h	45	1
TomoRegistration
Error	4	error C2602:
'itk::DefaultConvertPixelTraits<PixelType>::ComponentType' is not a member
of a base class of 'itk::DefaultConvertPixelTraits<PixelType>'	c:\program
files\itk\include\itk-4.4\itkDefaultConvertPixelTraits.h	45	1
TomoRegistration
Error	1	error C2838: 'ComponentType' : illegal qualified name in member
declaration	c:\program
files\itk\include\itk-4.4\itkDefaultConvertPixelTraits.h	45	1
TomoRegistration
Error	5	error C2868:
'itk::DefaultConvertPixelTraits<PixelType>::ComponentType' : illegal syntax
for using-declaration; expected qualified-name	c:\program
files\itk\include\itk-4.4\itkDefaultConvertPixelTraits.h	45	1
TomoRegistration
Error	3	error C4430: missing type specifier - int assumed. Note: C++ does
not support default-int	c:\program
files\itk\include\itk-4.4\itkDefaultConvertPixelTraits.h	45	1
TomoRegistration




        typedef itk::ImageIOBase::IOComponentType ScalarPixelType;
	itk::ImageIOBase::Pointer imageIOsource =
itk::ImageIOFactory::CreateImageIO("writesource.mhd",itk::ImageIOFactory::ReadMode);
	imageIOsource->SetFileName("writesource.mhd");
	imageIOsource->ReadImageInformation();
	const ScalarPixelType pixelTypeSource = imageIOsource->GetComponentType();

	itk::ImageIOBase::Pointer imageIOtarget =
itk::ImageIOFactory::CreateImageIO("writetarget.mhd",itk::ImageIOFactory::ReadMode);
	imageIOtarget->SetFileName("writetarget.mhd");
	imageIOtarget->ReadImageInformation();
	const ScalarPixelType pixelTypeTarget = imageIOtarget->GetComponentType();
     
       myClass* a= new myClass;
       a->VolumeRegistration(pixelTypeSource,pixelTypeTarget);

class myClass
{
        ....
        template<typename pixelType1, typename pixelType2>
	void VolumeRegistration(pixelType1,pixelType2)
	{
		typedef itk::Image< pixelType1, 3 >  FixedImageType;
		typedef itk::Image< pixelType2, 3 >  MovingImageType;
        }
};




--
View this message in context: http://itk-users.7.n7.nabble.com/newbie-C-question-tp33081p33162.html
Sent from the ITK - Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list