[Insight-developers] possible tcon topics

Lydia Ng lng at statsci.com
Thu Oct 26 14:49:12 EDT 2000


Hi Luis,

> Is this error ("zero  size structure") produced by VC++ ?
>
Yes, VC++ 6.0

> I use to access the image dimension in the same way as you do,
> in particular  for creating iterators,  and that worked ok.
>
Yes, I noticed that it does work when you are inside a function
but not as a declaration of a type inside a class.

> Could you please, post the error message, and the line
> in which it seems to be produced.
My main, relevant part of itkImage.h and the complier
errors are below.

Cheers,
Lydia
==================================================================
=====The main.cpp file========
#include "itkImage.h"

template< class TImage>
class MyProcess
{
public:

  typedef itk::Image<int,TImage::ImageDimension> TempImage;
  typename TempImage::Pointer temp;

};

void main()
{
  typedef itk::Image<float,2> ImageT;

  MyProcess<ImageT> aProcess;

}

=====Lines 370-378 of itkImage.h============
  unsigned long   m_ImageSize[VImageDimension];
  unsigned long   m_BufferSize[VImageDimension];
  unsigned long   m_RegionSize[VImageDimension];

  Index           m_ImageStartIndex;
  Index           m_BufferStartIndex;
  Index           m_RegionStartIndex;

  float           m_Spacing[VImageDimension];
  float           m_Origin[VImageDimension];


--------------------Configuration: test_lset - Win32
Debug--------------------
Compiling...
main.cpp
f:\lng\projects\insight\insight\code\common\itkimage.h(370) : warning C4200:
nonstandard extension used : zero-sized array in struct/union
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(9) : see reference to
class template instantiation 'itk::Image<int,0>' being compiled
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(11) : see reference
to class template instantiation 'MyProcess<TImage>' being compiled
f:\lng\projects\insight\insight\code\common\itkimage.h(371) : error C2229:
class 'itk::Image<int,0>' has an illegal zero-sized array
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(9) : see reference to
class template instantiation 'itk::Image<int,0>' being compiled
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(11) : see reference
to class template instantiation 'MyProcess<TImage>' being compiled
f:\lng\projects\insight\insight\code\common\itkimage.h(371) : warning C4200:
nonstandard extension used : zero-sized array in struct/union
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(9) : see reference to
class template instantiation 'itk::Image<int,0>' being compiled
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(11) : see reference
to class template instantiation 'MyProcess<TImage>' being compiled
f:\lng\projects\insight\insight\code\common\itkimage.h(372) : error C2229:
class 'itk::Image<int,0>' has an illegal zero-sized array
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(9) : see reference to
class template instantiation 'itk::Image<int,0>' being compiled
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(11) : see reference
to class template instantiation 'MyProcess<TImage>' being compiled
f:\lng\projects\insight\insight\code\common\itkimage.h(372) : warning C4200:
nonstandard extension used : zero-sized array in struct/union
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(9) : see reference to
class template instantiation 'itk::Image<int,0>' being compiled
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(11) : see reference
to class template instantiation 'MyProcess<TImage>' being compiled
f:\lng\projects\insight\insight\code\common\itkindex.h(231) : warning C4200:
nonstandard extension used : zero-sized array in struct/union
        f:\lng\projects\insight\insight\code\common\itkimage.h(374) : see
reference to class template instantiation 'itk::Index<0>' being compiled
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(9) : see reference to
class template instantiation 'itk::Image<int,0>' being compiled
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(11) : see reference
to class template instantiation 'MyProcess<TImage>' being compiled
f:\lng\projects\insight\insight\code\common\itkimage.h(374) : error C2229:
class 'itk::Image<int,0>' has an illegal zero-sized array
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(9) : see reference to
class template instantiation 'itk::Image<int,0>' being compiled
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(11) : see reference
to class template instantiation 'MyProcess<TImage>' being compiled
f:\lng\projects\insight\insight\code\common\itkimage.h(375) : error C2229:
class 'itk::Image<int,0>' has an illegal zero-sized array
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(9) : see reference to
class template instantiation 'itk::Image<int,0>' being compiled
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(11) : see reference
to class template instantiation 'MyProcess<TImage>' being compiled
f:\lng\projects\insight\insight\code\common\itkimage.h(376) : error C2229:
class 'itk::Image<int,0>' has an illegal zero-sized array
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(9) : see reference to
class template instantiation 'itk::Image<int,0>' being compiled
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(11) : see reference
to class template instantiation 'MyProcess<TImage>' being compiled
f:\lng\projects\insight\insight\code\common\itkimage.h(378) : error C2229:
class 'itk::Image<int,0>' has an illegal zero-sized array
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(9) : see reference to
class template instantiation 'itk::Image<int,0>' being compiled
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(11) : see reference
to class template instantiation 'MyProcess<TImage>' being compiled
f:\lng\projects\insight\insight\code\common\itkimage.h(378) : warning C4200:
nonstandard extension used : zero-sized array in struct/union
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(9) : see reference to
class template instantiation 'itk::Image<int,0>' being compiled
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(11) : see reference
to class template instantiation 'MyProcess<TImage>' being compiled
f:\lng\projects\insight\insight\code\common\itkimage.h(379) : error C2229:
class 'itk::Image<int,0>' has an illegal zero-sized array
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(9) : see reference to
class template instantiation 'itk::Image<int,0>' being compiled
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(11) : see reference
to class template instantiation 'MyProcess<TImage>' being compiled
f:\lng\projects\insight\insight\code\common\itkimage.h(379) : warning C4200:
nonstandard extension used : zero-sized array in struct/union
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(9) : see reference to
class template instantiation 'itk::Image<int,0>' being compiled
        F:\lng\projects\ITKMathSoft\test_lset\main.cpp(11) : see reference
to class template instantiation 'MyProcess<TImage>' being compiled
Error executing cl.exe.
Creating browse info file...

test_lset.exe - 7 error(s), 6 warning(s)



> -----Original Message-----
> From: insight-developers-admin at public.kitware.com
> [mailto:insight-developers-admin at public.kitware.com]On Behalf Of Luis
> Ibanez
> Sent: Thursday, October 26, 2000 11:39 AM
> To: insight-developers at public.kitware.com
> Subject: Re: [Insight-developers] possible tcon topics
>
>
> Hi,
>
> Your code in the first part of  (2)  looks fine.
>
> Is this error ("zero  size structure") produced by VC++ ?
>
> I use to access the image dimension in the same way as you do,
> in particular  for creating iterators,  and that worked ok.
>
> Could you please, post the error message, and the line
> in which it seems to be produced.
>
> Thanks
>
> Luis
>
>
> ----------------------------------
>
>
> Lydia Nag wrote:
>
> 2) Suppose in my process I want a temporary image
> of type int and the same size/dimension of an input image.
>
> I first tried something like this:
>
> template< class TImage>
> class MyProcess
> {
> public:
>   typedef itk::Image<int,TImage::ImageDimension> TempImage;
>   typename TempImage::Pointer temp;
> };
>
> void main()
> {
>   typedef itk::Image<float,2> ImageT;
>   MyProcess<ImageT> aProcess;
> }
>
>
> But I get an error complaining about zero size structure. Probably
> due to TImage::ImageDimension not being passed properly.
> My second attempt includes an extra template parameter for MyProcess:
>
>
> template< class TImage, unsigned int VDimension =
> TImage::ImageDimension>
> class MyProcess
> {
> public:
>   typedef itk::Image<int,VDimension> TempImage;
>   typename TempImage::Pointer temp;
> };
>
>
> This works fine but it is this bad style?
> Should I be doing this another way?
>
> -----------------------------------------------------
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers





More information about the Insight-developers mailing list