[Fwd: [Insight-developers] TImage::ImageDimension]
Bill Hoffman
bill.hoffman@kitware.com
Wed, 24 Jan 2001 13:21:45 -0500
His output seems to have an error:
'itk::SegmentFuzzyBasic<TInputImage,TOutputImage>' being compiled
c:\insight\insight\code\common\itkimage.h(419) : error C2229: class
'itk::Image<double,0,class itk::ValarrayImageContainer<unsigned long,double>
>' has an illegal zero-sized array
At 12:16 PM 1/24/2001 -0500, Luis Ibanez wrote:
>Hi Yinpeng,
>
>It looks like a similar problem that we have
>encounter previously.
>
>This is a warning tha only happens in VC++,
>and in spite of the warning, the code runs
>correctly.
>
>
>
>
>-------- Original Message --------
>Subject: [Insight-developers] TImage::ImageDimension
>Date: Fri, 27 Oct 2000 11:06:09 -0400
>From: Luis Ibanez <ibanez@cs.unc.edu>
>Reply-To: luis.ibanez@ieee.org
>Organization: Medical Image Display and Analysis Group MIDAG-UNC
>To: "insight-developers@public.kitware.com"
><insight-developers@public.kitware.com>
>References:
><7F537688E0D6D0119A0B00805FFEBE9404660F3F@exc03crdge.crd.ge.com>
>
>
>Hi,
>
>Looking closer into the problem of using ImageDimension,
>there are some funny facts:
>
>1) In VC++ 6.0 this produce a warning, not an error
>
>2) The warning doesn't appears with gcc, maybe
> because gcc doesn't complain about zero
> size arrays being declared like: int m[0];
>
>3) In spite of the warning,...
> the code runs ok with gcc and VC++.
>
>------
>
>This is a minimal example of the similar situation.
>Here, a short "Image" class is used, just to isolate
>the code from the rest of Insight, so the attached
>file is self-contained.
>
>The output of the program shows that the dimension
>of the image created inside the process object is
>really 3 as expected.
>
>I will speculate that this is due to the different aspects
>of the code that are checked during the several compiler
>passes. Perhaps enums are initialized after array sizes
>are checked....
>
>
>
>Luis
>
>
>==================================
>
>#include <iostream>
>
>//--------------------------------
>// Image Class
>//--------------------------------
>template <class T, unsigned int N>
>class Image {
>public:
> enum { ImageDimension = N };
> typedef Image * Pointer;
>private:
> unsigned int Index[N];
>};
>
>
>//--------------------------------
>// Process Class
>//--------------------------------
>template <class TImage>
>class myProcess {
> typedef Image<int, TImage::ImageDimension> TempImage;
> typename TempImage::Pointer temp;
>public:
> myProcess() {
> std::cout << "image dimension = ";
> std::cout << TempImage::ImageDimension << std::endl;
> }
>};
>
>//--------------------------------
>// Main
>//--------------------------------
>int main()
>{
> typedef Image<float,3> myImageType;
> myProcess<myImageType> process;
> return 0;
>}
>
>
>
>
>--
>______________________________________________________________________
>
>Luis Ibanez
>Research Assistant Professor - Division of Neurosurgery
>University of North Carolina at Chapel Hill
>CB# 7060, Chapel Hill, NC 27599
>email : ibanez@cs.unc.edu home : http://www.cs.unc.edu/~ibanez
>phone : (919)-843-9961 fax : (919)-966-6627
>______________________________________________________________________