[Insight-users] itkMinimumMaximumImageCalculator

Luis Ibanez luis . ibanez at kitware . com
Thu, 15 May 2003 23:13:20 -0400


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
>>
>>
>>  
>>
> 
>