[Insight-users] Re: itkMinimumMaximumImageCalculator

Chad Washington chad . w . washington at vanderbilt . edu
Fri, 16 May 2003 09:44:43 -0500


Thanks for the suggestions, but unfortunately I received the same errors.  So, 
I removed all code associated with the Min/Max calculator except for the 
inclusion of the header file, i.e. the only reference to the calculator in my 
code is the line

#include other things
#include "itkMinimumMaximumImageCalculator.h"
#include other things

This gives me the following compilation error:
In file included from
	Insight/Code/BasicFilters/itkMinimumMaximumImageCalculator.h:110,
	mie.h:29,
	mie.cxx:57:
Insight/Code/BasicFilters/itkMinimumMaximumImageCalculator.txx:47:45: macro 
"min" requires 2 arguments, but only 1 given
Insight/Code/BasicFilters/itkMinimumMaximumImageCalculator.txx:48:45: macro 
"max" requires 2 arguments, but only 1 given
Insight/Code/BasicFilters/itkMinimumMaximumImageCalculator.txx:78:45: macro 
"max" requires 2 arguments, but only 1 given
Insight/Code/BasicFilters/itkMinimumMaximumImageCalculator.txx:102:45: macro 
"min" requires 2 arguments, but only 1 given

However, when I changed this to where "itkMinimumMaximumImageCalculator.h" was 
the first included itk file, then these errors were resolved.  I then added 
the Min/Max calculations back into my code, compiled, and received no errors.

I'm not sure why there is this dependence on #include ordering, but I thought 
you might like to know.

Thanks,
Chad Washington
Biomedical Modeling Laboratory
Department of Biomedical Engineering
Vanderbilt University

> Date: Thu, 15 May 2003 23:13:20 -0400
> From: Luis Ibanez <luis.ibanez@kitware.com>
> To: chad.w.washington@vanderbilt.edu
> Cc: Paul Yushkevich <pauly@cognitica.com>,
> 	insight <insight-users@public.kitware.com>
> Subject: Re: [Insight-users] itkMinimumMaximumImageCalculator
>
> HI Chad,
>
> Please follow Paul's advice. He is right.
> min and max are defined in windows standard
> headers (for example).  ITK undefine them
> in itkNumbericTraits.h in Insight/Code/Common.
>
> Strange that this undef is not working for you,
> it should make this platform independent.
>
> We probably don't have a dashboard with gcc 3.2.3....
>
>
> Regards,
>
>
>    Luis
>
>
> ----------------------
>
> Paul Yushkevich wrote:
> > Chad,
> >
> > I'm not sure that my answer is right, but try doing this: change the
> > names of the variables min and max to myMin and myMax.  In some
> > compilers min and max are #defined macros and that may be causing the
> > problem.  I know that I've had no problem using the MinMaxCalculator
> > with the gcc compiler.
> >
> > On the other note, I would recommend using myCalculator->Compute()
> > instead of ComputeMin and ComputeMax.  It should be a little more
> > efficient when you need both the min and the max.
> >
> > Paul
> >
> > Chad Washington wrote:
> >> I am trying to use the Min/Max calculator and keep getting errors when
> >> I compile the code.  I am using gcc 3.2.3 and have the following
> >> definitions:
> >>
> >> typedef int     PixelType;
> >> typedef itk::Image< PixelType, 2 >     ImageType;
> >> typedef itk::MinimumMaximumCalculator< ImageType >     CalculatorType;
> >>
> >> and the code:
> >> ImageType::PixelType min;
> >> ImageType::PixelType max;
> >> myCalculator->SetImage( myImage );
> >> myCalculator->ComputeMinimum();
> >> min = myCalculator->GetMinium();
> >> myCalculator->ComputMaximum();
> >> max = myCalculator->GetMaximum();
> >>
> >> The resulting errors:
> >> In file included from                 from
> >> itkMinimumMaximumImageCalculator.h:110,
> >>                 from mie.h:28,
> >>                 from mie.cxx:57:
> >> Insight/Code/BasicFilters/itkMinimumMaximumImageCalculator.txx:47:45:
> >> macro "min" requires 2 arguments, but only 1 given
> >> Insight/Code/BasicFilters/itkMinimumMaximumImageCalculator.txx:48:45:
> >> macro "max" requires 2 arguments, but only 1 given
> >> Insight/Code/BasicFilters/itkMinimumMaximumImageCalculator.txx:78:45:
> >> macro "max" requires 2 arguments, but only 1 given
> >> Insight/Code/BasicFilters/itkMinimumMaximumImageCalculator.txx:102:45:
> >> macro "min" requires 2 arguments, but only 1 given
> >> Insight/Code/BasicFilters/itkMinimumMaximumImageCalculator.txx: In
> >>   member function `void
> >>   itk::MinimumMaximumImageCalculator<TInputImage>::ComputeMaximum()
> >> [with TInputImage = ImageType]':
> >> mie.cxx:1653:   instantiated from here
> >> Insight/Code/BasicFilters/itkMinimumMaximumImageCalculator.txx:102:
> >> invalid
> >>   conversion from `int (*)()' to `int'
> >> Insight/Code/BasicFilters/itkMinimumMaximumImageCalculator.txx: In
> >>   member function `void
> >>   itk::MinimumMaximumImageCalculator<TInputImage>::ComputeMinimum()
> >> [with TInputImage = ImageType]':
> >> mie.cxx:1674:   instantiated from here
> >> Insight/Code/BasicFilters/itkMinimumMaximumImageCalculator.txx:78:
> >> invalid
> >>   conversion from `int (*)()' to `int'
> >>
> >> Thanks,
> >> Chad Washington
> >> Biomedical Modeling Laboratory
> >> Department of Biomedical Engineering
> >> Vanderbilt University
> >> _______________________________________________
> >> Insight-users mailing list
> >> Insight-users@public.kitware.com
> >> http://public.kitware.com/mailman/listinfo/insight-users