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

Dženan Zukić dzenanz at gmail.com
Fri Jan 10 03:44:19 EST 2014


The attached project compiles and links without a problem.


On Fri, Jan 10, 2014 at 7:34 AM, Massinissa Bandou <
Massinissa.Bandou at usherbrooke.ca> wrote:

> 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.
> _____________________________________
> 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.php
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20140110/a4525fb5/attachment.htm>
-------------- next part --------------
cmake_minimum_required(VERSION 2.6)

PROJECT(bugTester CXX)

FIND_PACKAGE(ITK REQUIRED)
INCLUDE(${ITK_USE_FILE})

ADD_EXECUTABLE(bugTester bugTester.cpp)

TARGET_LINK_LIBRARIES(bugTester ${ITK_LIBRARIES})
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bugTester.cpp
Type: text/x-c++src
Size: 1136 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20140110/a4525fb5/attachment.cpp>


More information about the Insight-users mailing list