<div dir="ltr"><div><span style="font-family:arial,sans-serif;font-size:13px">Ruturaj,</span><br></div><div><br></div>All classes and data structures in ITK are in the itk namespace. Including a line with "using namespace itk" should solve your immediate problems, but is a discouraged practice (see, for example, <a href="http://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice">http://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice</a>).<div>
<br></div><div>Instead, it is usual practice to change all class and data structure names to include the itk namespace qualifier. For example, in your code, you should change<div><div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">ReaderType::Pointer reader = ReaderType::New();</span><br>
</div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">to </span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">itk::ReaderType::Pointer reader = itk::ReaderType::New();</span><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">MedianFilterType::Pointer medianfilter = MedianFilterType::New();</span><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">to</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">itk::MedianFilterType::Pointer medianfilter = itk::MedianFilterType::New();</span><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">and so on.</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Hope that helps,</span></div><div>Cory</div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 4, 2014 at 8:39 AM, Girish, Gavaskar Ruturaj <span dir="ltr"><<a href="mailto:gavaskar.ruturaj.girish@philips.com" target="_blank">gavaskar.ruturaj.girish@philips.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Bill,<br>
Here I have copied a small program which gives the same errors:<br>
<br>
#include "Filter_Type_Definitions.h"<br>
int main( int argc, char *argv[])<br>
{<br>
ReaderType::Pointer reader = ReaderType::New();<br>
reader->SetFileName( argv[1] );<br>
reader->Update();<br>
<br>
//Apply a median filter<br>
MedianFilterType::Pointer medianfilter = MedianFilterType::New();<br>
GrayscaleImageType::SizeType indexradius;<br>
indexradius[0] = 3; //X radius<br>
indexradius[1] = 3; //Y radius<br>
indexradius[2] = 3; //Z radius<br>
medianfilter->SetRadius( indexradius );<br>
medianfilter->SetInput( input_image );<br>
medianfilter->Update();<br>
<br>
}<br>
<br>
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.<br>
<br>
Thanks & Regards,<br>
Ruturaj<br>
<div><div class="h5"><br>
-----Original Message-----<br>
From: Bill Lorensen [mailto:<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>]<br>
Sent: Wednesday, June 04, 2014 5:41 PM<br>
To: Girish, Gavaskar Ruturaj<br>
Cc: <a href="mailto:community@itk.org">community@itk.org</a><br>
Subject: Re: [ITK] Compilation errors<br>
<br>
Please post a small, complete program that illustrates the problem.<br>
<br>
<br>
On Wed, Jun 4, 2014 at 7:58 AM, Girish, Gavaskar Ruturaj <<a href="mailto:gavaskar.ruturaj.girish@philips.com">gavaskar.ruturaj.girish@philips.com</a>> wrote:<br>
> Dear all,<br>
><br>
><br>
><br>
> I have written an ITK program which gives me errors when I try to<br>
> compile it. I have copied a small sample of the errors below. All the<br>
> other errors are similar.<br>
><br>
><br>
><br>
> c:\program files\itk\include\itk-4.6\itkImageSource.h(108): error C2039:<br>
> 'RegionType' : is not a member of '`global namespace''<br>
><br>
> 2>c:\program files\itk\include\itk-4.6\itkImageSource.h(108): error C2146:<br>
> syntax error : missing ';' before identifier 'OutputImageRegionType'<br>
><br>
> 2>c:\program files\itk\include\itk-4.6\itkImageSource.h(108): error C4430:<br>
> missing type specifier - int assumed. Note: C++ does not support<br>
> default-int<br>
><br>
> 2>c:\program files\itk\include\itk-4.6\itkImageSource.h(109): error C2825:<br>
> 'itk::ImageSource<TOutputImage>::OutputImageType': must be a class or<br>
> namespace when followed by '::'<br>
><br>
><br>
><br>
> c:\program files\itk\include\itk-4.6\itkImageSource.h(109): error C2039:<br>
> 'PixelType' : is not a member of '`global namespace''<br>
><br>
> 2>c:\program files\itk\include\itk-4.6\itkImageSource.h(109): error C2146:<br>
> syntax error : missing ';' before identifier 'OutputImagePixelType'<br>
><br>
> 2>c:\program files\itk\include\itk-4.6\itkImageSource.h(109): error C4430:<br>
> missing type specifier - int assumed. Note: C++ does not support<br>
> default-int<br>
><br>
> 2>c:\program files\itk\include\itk-4.6\itkImageSource.h(112): error C2825:<br>
> 'TOutputImage': must be a class or namespace when followed by '::'<br>
><br>
> 2>c:\program files\itk\include\itk-4.6\itkImageSource.h(112): error C2039:<br>
> 'ImageDimension' : is not a member of '`global namespace''<br>
><br>
> 2>c:\program files\itk\include\itk-4.6\itkImageSource.h(112): error C2275:<br>
> 'TOutputImage' : illegal use of this type as an expression<br>
><br>
> 2> c:\program<br>
> files\itk\include\itk-4.6\itkImageToImageFilter.h(103) : see<br>
> declaration of 'TOutputImage'<br>
><br>
> 2>c:\program files\itk\include\itk-4.6\itkImageSource.h(112): error C2146:<br>
> syntax error : missing '}' before identifier 'ImageDimension'<br>
><br>
> 2>c:\program files\itk\include\itk-4.6\itkImageSource.h(112): error C2143:<br>
> syntax error : missing ';' before '}'<br>
><br>
> 2>c:\program files\itk\include\itk-4.6\itkImageToImageFilter.h(115):<br>
</div></div>> 2>error<br>
<div class="HOEnZb"><div class="h5">> C2039: 'OutputImageRegionType' : is not a member of<br>
> 'itk::ImageSource<TOutputImage>'<br>
><br>
><br>
><br>
> When I searched on google, I found that this might happen if header<br>
> files are included in the ‘wrong’ order. If it helps, I have included<br>
> them in the following order:<br>
><br>
> #include <iostream><br>
><br>
> #include "itkImage.h"<br>
><br>
> #include "itkPoint.h"<br>
><br>
> #include "itkIndex.h"<br>
><br>
> #include "itkImageFileReader.h"<br>
><br>
> #include "itkImageFileWriter.h"<br>
><br>
> #include "itkMedianImageFilter.h"<br>
><br>
> #include "itkThresholdImageFilter.h"<br>
><br>
> #include "itkBinaryThresholdImageFilter.h"<br>
><br>
> #include "itkBinaryFillholeImageFilter.h"<br>
><br>
> #include "itkMaskImageFilter.h"<br>
><br>
> #include "itkOtsuThresholdImageFilter.h"<br>
><br>
> #include "itkAndImageFilter.h"<br>
><br>
> #include "itkBinaryShapeOpeningImageFilter.h"<br>
><br>
> #include "itkBinaryShapeKeepNObjectsImageFilter.h"<br>
><br>
> #include "itkXorImageFilter.h"<br>
><br>
> #include "itkConnectedComponentImageFilter.h"<br>
><br>
> #include "itkLabelGeometryImageFilter.h"<br>
><br>
><br>
><br>
> I have created a separate header file in which I have included all the<br>
> above header files and also all the typedef’s for the filters. Can<br>
> anybody give me an idea to why such errors may be occurring? I have<br>
> not used a ‘using namespace xxxx’ anywhere.<br>
><br>
><br>
><br>
> Thanks & Regards,<br>
><br>
> Ruturaj<br>
><br>
><br>
> ________________________________<br>
> The information contained in this message may be confidential and<br>
> legally protected under applicable law. The message is intended solely<br>
> for the addressee(s). If you are not the intended recipient, you are<br>
> hereby notified that any use, forwarding, dissemination, or<br>
> reproduction of this message is strictly prohibited and may be<br>
> unlawful. If you are not the intended recipient, please contact the<br>
> sender by return e-mail and destroy all copies of the original message.<br>
><br>
> _______________________________________________<br>
> Community mailing list<br>
> <a href="mailto:Community@itk.org">Community@itk.org</a><br>
> <a href="http://public.kitware.com/cgi-bin/mailman/listinfo/community" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/community</a><br>
><br>
<br>
<br>
<br>
--<br>
Unpaid intern in BillsBasement at noware dot com<br>
<br>
________________________________<br>
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.<br>
</div></div><br>_______________________________________________<br>
Community mailing list<br>
<a href="mailto:Community@itk.org">Community@itk.org</a><br>
<a href="http://public.kitware.com/cgi-bin/mailman/listinfo/community" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/community</a><br>
<br></blockquote></div><br></div>