[ITK] Compilation errors

Cory Quammen cory.quammen at kitware.com
Wed Jun 4 09:07:19 EDT 2014


Oops, Bill's right. While my general advice about namespace qualifiers
stands, you were already doing that and my specific recommendations were
totally wrong. I should have actually looked at your header file to see
that you were indeed qualifying the class names with the itk namespace. The
dangers of responding prior to consuming any coffee...

Cory


On Wed, Jun 4, 2014 at 9:00 AM, Bill Lorensen <bill.lorensen at gmail.com>
wrote:

> In the header, the definition of the median filter should be
> typedef itk::MedianImageFilter< GrayscaleImageType, GrayscaleImageType >
>                                         MedianFilterType;
>
> not
> typedef itk::MedianImageFilter< GrayscalePixelType, GrayscalePixelType >
>                                         MedianFilterType;
>
>
> On Wed, Jun 4, 2014 at 8:39 AM, Girish, Gavaskar Ruturaj
> <gavaskar.ruturaj.girish at philips.com> wrote:
> > Dear Bill,
> > Here I have copied a small program which gives the same errors:
> >
> > #include        "Filter_Type_Definitions.h"
> > int main( int argc, char *argv[])
> > {
> >         ReaderType::Pointer reader = ReaderType::New();
> >         reader->SetFileName( argv[1] );
> >         reader->Update();
> >
> >         //Apply a median filter
> >         MedianFilterType::Pointer medianfilter = MedianFilterType::New();
> >         GrayscaleImageType::SizeType indexradius;
> >         indexradius[0] = 3;             //X radius
> >         indexradius[1] = 3;             //Y radius
> >         indexradius[2] = 3;             //Z radius
> >         medianfilter->SetRadius( indexradius );
> >         medianfilter->SetInput( input_image );
> >         medianfilter->Update();
> >
> > }
> >
> > Now, I have used only itkMedianImageFilter in this example, but in my
> actual code I am using many more filters. Hence I have kept the file
> Filter_Type_Definitions.h as it is without deleting the extra filters, in
> case they are of any help. I have attached the file with this post. I had
> written many programs before today in which I had included all the headers
> in the main source code file, and they all compiled without errors. It was
> only when I kept the headers and typedef's in a separate file that the
> errors began occurring.
> >
> > Thanks & Regards,
> > Ruturaj
> >
> > -----Original Message-----
> > From: Bill Lorensen [mailto:bill.lorensen at gmail.com]
> > Sent: Wednesday, June 04, 2014 5:41 PM
> > To: Girish, Gavaskar Ruturaj
> > Cc: community at itk.org
> > Subject: Re: [ITK] Compilation errors
> >
> > Please post a small, complete program that illustrates the problem.
> >
> >
> > On Wed, Jun 4, 2014 at 7:58 AM, Girish, Gavaskar Ruturaj <
> gavaskar.ruturaj.girish at philips.com> wrote:
> >> Dear all,
> >>
> >>
> >>
> >> I have written an ITK program which gives me errors when I try to
> >> compile it. I have copied a small sample of the errors below. All the
> >> other errors are similar.
> >>
> >>
> >>
> >> c:\program files\itk\include\itk-4.6\itkImageSource.h(108): error C2039:
> >> 'RegionType' : is not a member of '`global namespace''
> >>
> >> 2>c:\program files\itk\include\itk-4.6\itkImageSource.h(108): error
> C2146:
> >> syntax error : missing ';' before identifier 'OutputImageRegionType'
> >>
> >> 2>c:\program files\itk\include\itk-4.6\itkImageSource.h(108): error
> C4430:
> >> missing type specifier - int assumed. Note: C++ does not support
> >> default-int
> >>
> >> 2>c:\program files\itk\include\itk-4.6\itkImageSource.h(109): error
> C2825:
> >> 'itk::ImageSource<TOutputImage>::OutputImageType': must be a class or
> >> namespace when followed by '::'
> >>
> >>
> >>
> >> c:\program files\itk\include\itk-4.6\itkImageSource.h(109): error C2039:
> >> 'PixelType' : is not a member of '`global namespace''
> >>
> >> 2>c:\program files\itk\include\itk-4.6\itkImageSource.h(109): error
> C2146:
> >> syntax error : missing ';' before identifier 'OutputImagePixelType'
> >>
> >> 2>c:\program files\itk\include\itk-4.6\itkImageSource.h(109): error
> C4430:
> >> missing type specifier - int assumed. Note: C++ does not support
> >> default-int
> >>
> >> 2>c:\program files\itk\include\itk-4.6\itkImageSource.h(112): error
> C2825:
> >> 'TOutputImage': must be a class or namespace when followed by '::'
> >>
> >> 2>c:\program files\itk\include\itk-4.6\itkImageSource.h(112): error
> C2039:
> >> 'ImageDimension' : is not a member of '`global namespace''
> >>
> >> 2>c:\program files\itk\include\itk-4.6\itkImageSource.h(112): error
> C2275:
> >> 'TOutputImage' : illegal use of this type as an expression
> >>
> >> 2>          c:\program
> >> files\itk\include\itk-4.6\itkImageToImageFilter.h(103) : see
> >> declaration of 'TOutputImage'
> >>
> >> 2>c:\program files\itk\include\itk-4.6\itkImageSource.h(112): error
> C2146:
> >> syntax error : missing '}' before identifier 'ImageDimension'
> >>
> >> 2>c:\program files\itk\include\itk-4.6\itkImageSource.h(112): error
> C2143:
> >> syntax error : missing ';' before '}'
> >>
> >> 2>c:\program files\itk\include\itk-4.6\itkImageToImageFilter.h(115):
> >> 2>error
> >> C2039: 'OutputImageRegionType' : is not a member of
> >> 'itk::ImageSource<TOutputImage>'
> >>
> >>
> >>
> >> When I searched on google, I found that this might happen if header
> >> files are included in the ‘wrong’ order. If it helps, I have included
> >> them in the following order:
> >>
> >> #include               <iostream>
> >>
> >> #include               "itkImage.h"
> >>
> >> #include               "itkPoint.h"
> >>
> >> #include               "itkIndex.h"
> >>
> >> #include               "itkImageFileReader.h"
> >>
> >> #include               "itkImageFileWriter.h"
> >>
> >> #include               "itkMedianImageFilter.h"
> >>
> >> #include               "itkThresholdImageFilter.h"
> >>
> >> #include               "itkBinaryThresholdImageFilter.h"
> >>
> >> #include               "itkBinaryFillholeImageFilter.h"
> >>
> >> #include               "itkMaskImageFilter.h"
> >>
> >> #include               "itkOtsuThresholdImageFilter.h"
> >>
> >> #include               "itkAndImageFilter.h"
> >>
> >> #include               "itkBinaryShapeOpeningImageFilter.h"
> >>
> >> #include               "itkBinaryShapeKeepNObjectsImageFilter.h"
> >>
> >> #include               "itkXorImageFilter.h"
> >>
> >> #include               "itkConnectedComponentImageFilter.h"
> >>
> >> #include               "itkLabelGeometryImageFilter.h"
> >>
> >>
> >>
> >> I have created a separate header file in which I have included all the
> >> above header files and also all the typedef’s for the filters. Can
> >> anybody give me an idea to why such errors may be occurring? I have
> >> not used a ‘using namespace xxxx’ anywhere.
> >>
> >>
> >>
> >> Thanks & Regards,
> >>
> >> Ruturaj
> >>
> >>
> >> ________________________________
> >> The information contained in this message may be confidential and
> >> legally protected under applicable law. The message is intended solely
> >> for the addressee(s). If you are not the intended recipient, you are
> >> hereby notified that any use, forwarding, dissemination, or
> >> reproduction of this message is strictly prohibited and may be
> >> unlawful. If you are not the intended recipient, please contact the
> >> sender by return e-mail and destroy all copies of the original message.
> >>
> >> _______________________________________________
> >> Community mailing list
> >> Community at itk.org
> >> http://public.kitware.com/cgi-bin/mailman/listinfo/community
> >>
> >
> >
> >
> > --
> > Unpaid intern in BillsBasement at noware dot com
> >
> > ________________________________
> > The information contained in this message may be confidential and
> legally protected under applicable law. The message is intended solely for
> the addressee(s). If you are not the intended recipient, you are hereby
> notified that any use, forwarding, dissemination, or reproduction of this
> message is strictly prohibited and may be unlawful. If you are not the
> intended recipient, please contact the sender by return e-mail and destroy
> all copies of the original message.
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/cgi-bin/mailman/listinfo/community
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140604/c4c8aa93/attachment-0002.html>


More information about the Community mailing list