[Insight-users] typedef name cannot follow class/struct/union
Bill Lorensen
bill.lorensen at gmail.com
Tue Feb 2 19:34:57 EST 2010
It is hard to tell without seeing the rest of the code.
For example, what is itk::Connectivity? Have you included all the proper files?
Can you reproduce the error with a small compilable program that you can post?
Bill
On Tue, Feb 2, 2010 at 7:24 PM, Andreas Schuh
<andreas.schuh.84 at googlemail.com> wrote:
> Well, how does the declaration of itk::UltimateSkeletonImageFilter look
> like? Just the class declaration not all methods ...
>
> Andreas
>
> On Tue, Feb 2, 2010 at 7:07 PM, <Neil.Burdett at csiro.au> wrote:
>>
>> Hi Andreas;
>>
>>
>> const int Dimension = 3;
>>
>> typedef unsigned short DistancePixelType;
>>
>> typedef itk::Image< DistancePixelType, Dimension > DistanceImageType;
>>
>>
>>
>> Note that in the same file we have a number of other typedef that
>> compile fine i.e.
>>
>> // Prepare the priority function
>>
>> typedef typename itk::DanielssonDistanceMapImageFilter<TOutputImage,
>> DistanceImageType> DanielssonDistanceMapImageFilterType;
>>
>> typename DanielssonDistanceMapImageFilterType::Pointer
>> danielssonDistanceMapFilter = DanielssonDistanceMapImageFilterType::New();
>>
>> ....
>>
>> // Compute a surfacic skeleton
>>
>> typedef typename itk::ParallelSkeletonImageFilter<TOutputImage,
>> TOutputImage, itk::Connectivity<Dimension, 0> >
>> ParallelSkeletonImageFilterType;
>>
>> typename ParallelSkeletonImageFilterType::Pointer parallelSkeletonFilter =
>> ParallelSkeletonImageFilterType::New();
>>
>> ...
>>
>> // Delete all small components (extract the largest connected component in
>> the image)
>>
>> typedef typename itk::LargestConnectedComponentImageFilter<TOutputImage,
>> TOutputImage> LargestConnectedComponentImageFilterType;
>>
>> typename LargestConnectedComponentImageFilterType::Pointer
>> largestConnectedComponentFilter =
>> LargestConnectedComponentImageFilterType::New();
>>
>> etc...
>>
>>
>>
>> Maybe its an issue with itk::UltimateSkeletonImageFilter ??
>>
>> Neil
>>
>>
>>
>> ________________________________
>> From: Andreas Schuh [mailto:andreas.schuh.84 at googlemail.com]
>> Sent: Wednesday, 3 February 2010 9:41 AM
>> To: Burdett, Neil (ICT Centre, Herston - RBWH)
>> Subject: Re: [Insight-users] typedef name cannot follow class/struct/union
>>
>> Hi,
>>
>> How are TOutputImage, DistanceImageType and Dimension declared/defined?
>> How is the template method/class itself declared?
>>
>> Andreas
>>
>> On Tue, Feb 2, 2010 at 5:44 PM, <Neil.Burdett at csiro.au> wrote:
>>>
>>> Hi Andreas and Bill,
>>> Thanks for the replies. As mentioned in my previous
>>> post if I remove the "typename" I continue to get the same error:
>>>
>>> "error C2242: typedef name cannot follow class/struct/union"
>>>
>>> You are correct that the second line after this is a cut and paste error
>>> so the actual code is:
>>>
>>> // Compute the seed image, by closing cavities and holes with an
>>> ultimate skeleton of the cuboid image
>>> typedef itk::UltimateSkeletonImageFilter<TOutputImage, TOutputImage,
>>> itk::Connectivity<Dimension, 0>, DistanceImageType > SeedSkeletonFilterType;
>>>
>>> typename SeedSkeletonFilterType::Pointer seedSkeletonFilter =
>>> SeedSkeletonFilterType::New();
>>> seedSkeletonFilter->SetInput(cuboidImage->GetOutput());
>>>
>>> seedSkeletonFilter->SetPriorityImage(distanceInvertIntensityFilter->GetOutput());
>>>
>>> seedSkeletonFilter->SetInhibitImage(parallelSkeletonFilter->GetOutput());
>>> try{
>>> seedSkeletonFilter->Update();
>>> } catch(itk::ExceptionObject &ex) {
>>> throw itk::ExceptionObject("milxTopologicalHolesFilling", 0,
>>> std::string("Topological holes filling.. seed ultimate skeleton failed: ") +
>>> ex.GetDescription());
>>> }
>>>
>>> Anymore ideas? This error occurs on both VS 2005 and VS 2008
>>>
>>> Cheers
>>> Neil
>>>
>>> -----Original Message-----
>>> From: Andreas Schuh [mailto:andreas.schuh.84 at googlemail.com]
>>> Sent: Tuesday, 2 February 2010 2:49 PM
>>> To: Burdett, Neil (ICT Centre, Herston - RBWH)
>>> Cc: itk
>>> Subject: Re: [Insight-users] typedef name cannot follow
>>> class/struct/union
>>>
>>> Hi Neil,
>>>
>>> Try
>>>
>>> typedef itk::UltimateSkeletonImageFilter<TOutputImage, TOutputImage,
>>> itk::Connectivity<Dimension, 0>, DistanceImageType > SeedSkeletonFilterType;
>>>
>>> There is no typename specified necessary here. Actually, I think it's
>>> wrong to use it.
>>>
>>> The second line after this one in your mail might just be a
>>> copy-and-paste relict while you were composing the mail. Because it doesn't
>>> make sense at all ...
>>>
>>> The use of the second typename for the pointer type declaration is fine
>>> and for compilers like the VC6 also necessary.
>>>
>>> Andreas
>>>
>>>
>>> On Feb 1, 2010, at 11:20 PM, <Neil.Burdett at csiro.au> wrote:
>>>
>>> > Hi Bill and Dan,
>>> > thanks for the reply, but removing typename, or replacing it
>>> > with ITK_TYPENAME gives exactly the same error in visual studio 2008;
>>> >
>>> > "error C2242: typedef name cannot follow class/struct/union"
>>> >
>>> > The full extract of code I'm using is;
>>> >
>>> > // Compute the seed image, by closing cavities and holes with an
>>> > ultimate skeleton of the cuboid image
>>> > typedef typename itk::UltimateSkeletonImageFilter<TOutputImage,
>>> > TOutputImage, itk::Connectivity<Dimension, 0>, DistanceImageType >
>>> > SeedSkeletonFilterType;
>>> > itk::UltimateSkeletonImageFilter<TOutputImage, TOutputImage,
>>> > itk::Connectivity<Dimension, 0>, DistanceImageType > SeedSkeletonFilterType;
>>> >
>>> > typename SeedSkeletonFilterType::Pointer seedSkeletonFilter =
>>> > SeedSkeletonFilterType::New();
>>> > seedSkeletonFilter->SetInput(cuboidImage->GetOutput());
>>> >
>>> > seedSkeletonFilter->SetPriorityImage(distanceInvertIntensityFilter->GetOutput());
>>> >
>>> > seedSkeletonFilter->SetInhibitImage(parallelSkeletonFilter->GetOutput());
>>> > try{
>>> > seedSkeletonFilter->Update();
>>> > } catch(itk::ExceptionObject &ex) {
>>> > throw itk::ExceptionObject("milxTopologicalHolesFilling", 0,
>>> > std::string("Topological holes filling.. seed ultimate skeleton failed: ") +
>>> > ex.GetDescription());
>>> > }
>>> >
>>> > Neil
>>> >
>>> > -----Original Message-----
>>> > From: Bill Lorensen [mailto:bill.lorensen at gmail.com]
>>> > Sent: Monday, 1 February 2010 11:46 PM
>>> > To: Burdett, Neil (ICT Centre, Herston - RBWH)
>>> > Cc: insight-users at itk.org
>>> > Subject: Re: [Insight-users] typedef name cannot follow
>>> > class/struct/union
>>> >
>>> > I think the typename can be removed on both Windows and linux. My
>>> > general rule for typename is that it is required if there are no
>>> > template variables.
>>> >
>>> > For example
>>> >
>>> > typedef Foo<bar> FooBarType;
>>> >
>>> > typedef typename Foo::Pointer FooPointer;
>>> >
>>> > On Sun, Jan 31, 2010 at 11:39 PM, <Neil.Burdett at csiro.au> wrote:
>>> >> Hi,
>>> >>
>>> >> I am currently porting an application from Ubuntu to windows. The
>>> >> line
>>> >> of code below compiles on Ubuntu but not on visual studio...
>>> >>
>>> >>
>>> >>
>>> >> typedef typename itk::UltimateSkeletonImageFilter<TOutputImage,
>>> >> TOutputImage, itk::Connectivity<Dimension, 0>, DistanceImageType >
>>> >> SeedSkeletonFilterType;
>>> >>
>>> >>
>>> >>
>>> >> I receive the error in visual studio 2008 "error C2242: typedef name
>>> >> cannot
>>> >> follow class/struct/union"
>>> >>
>>> >>
>>> >>
>>> >> Any help would be appreciated.
>>> >>
>>> >>
>>> >>
>>> >> Neil
>>> >>
>>> >> _____________________________________
>>> >> 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
>>> >>
>>> >>
>>> > _____________________________________
>>> > 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
>>>
>>
>
>
> _____________________________________
> 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
>
>
More information about the Insight-users
mailing list