[Insight-users] Re: ITK compiling (use from external project)
Christian Dold
christian.dold at igd.fraunhofer.de
Thu Sep 2 07:52:32 EDT 2004
Hello
I checked the .tpp .txx and the .h files for the #ifdef/#endif flags but
everything looks ok.
attached the files which are making trouble
itkMapIntensityImageFilter.h
itkMapIntensityImageFilter.txx
Thanks a lot for figure out whats going on!
Christian
Luis Ibanez wrote:
>
>
> Hi Christian,
>
> Thanks for sending your CMake information.
>
>
> It seems that some of the classes in your application
> are generating a recursive template instantiation and
> bringing the VC++ compiler to its internal limit.
>
>
> The current suspect is your class:
>
> \src\visualization\itkMapIntensityImageFilter.txx
>
>
> That seems to be instantiating a ShiftScaleImageFilter
> internally.
>
>
> Are you setting the appropriate #ifdef/#endif flags in
> the .h and the .txx files ?
>
>
> Maybe it will be simpler if you just post to the users
> list your files
>
>
> itkMapIntensityImageFilter.h
> itkMapIntensityImageFilter.txx
>
>
> Thanks
>
>
>
> Luis
>
>
> -----------
> PS. In general it is simpler to send the CMakeCache.txt file,
> than sending screenshots of CMake's GUI.
>
>
> ----------------------------------------------------------
> Christian Dold wrote:
>
>> Hi Luis
>> yes I am using cmake.
>> attacehd the cmake settings as png files
>>
>> I will be great to hear there is a solution for this problem
>> Thanks
>> Christian
>>
>>
>> Luis Ibanez wrote:
>>
>>
>>> Hi Christian,
>>>
>>> Are you using CMake for configuring your project ?
>>>
>>> It looks like you are not...
>>>
>>>
>>>
>>> CMake usually takes care of setting all the compiler
>>> flags necesary for using ITK.
>>>
>>> Please post the CMakeLists.txt that you are using
>>> for configuring your project.
>>>
>>>
>>> Thanks
>>>
>>>
>>> Luis
>>>
>>>
>>> ------------------------
>>> Christian Dold wrote:
>>>
>>>
>>>> Hi Luis
>>>> I got lots of problems since last week during compiling my project.
>>>> For example:
>>>> :\ITK\InsightToolkit-1.6.0\Code\BasicFilters\itkRecursiveGaussianImageFilter.h(67)
>>>>
>>>>
>>>> : fatal error C1076: compiler limit : internal heap limit reached; use
>>>> /Zm to specify a higher limit
>>>>
>>>> D:\ITK\InsightToolkit-1.6.0\Code\BasicFilters\itkRecursiveGaussianImageFilter.h(67)
>>>>
>>>>
>>>> : while compiling class-template member function 'double __thiscall
>>>> itk::RecursiveGaussianImageFilter<class itk::Image<float,3>,class
>>>> itk::Image<float,3> >::
>>>> ....
>>>> C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\ostream(354) :
>>>> fatal error C1076: compiler limit : internal heap limit reached;
>>>> use /Zm
>>>> to specify a higher limit
>>>> mipregiongrowing.cpp
>>>> D:\ITK\InsightToolkit-1.6.0\Code\Common\itkWeakPointer.h(110) : fatal
>>>> error C1076: compiler limit : internal heap limit reached; use /Zm to
>>>> specify a higher limit
>>>> .\src\visualization\itkMapIntensityImageFilter.txx(36) : see
>>>> reference to class template instantiation 'itk::WeakPointer<class
>>>> itk::ShiftScaleImageFilter<class itk::Image<float,3>,class
>>>> itk::Image<unsigned short,3> > >' being compiled
>>>> C:\Program Files\Microsoft Visual
>>>> Studio\VC98\INCLUDE\xmemory(66) : while compiling class-template
>>>> member
>>>> function '__thiscall itk::MapIntensityImageFilter<class
>>>> itk::Image<float,3>,class itk::Image<unsigned short,3>
>>>>
>>>>> ::itk::MapIntensityImag
>>>>
>>>>
>>>>
>>>> .....
>>>> mipaccureader.cpp
>>>> D:\ITK\InsightToolkit-1.6.0\Code\BasicFilters\itkAnisotropicDiffusionImageFilter.h(110)
>>>>
>>>>
>>>> : fatal error C1076: compiler limit : internal heap limit reached; use
>>>> /Zm to specify a higher limit
>>>>
>>>> D:\ITK\InsightToolkit-1.6.0\Code\BasicFilters\itkAnisotropicDiffusionImageFilter.h(110)
>>>>
>>>>
>>>> : while compiling class-template member function 'void __thiscall
>>>> itk::AnisotropicDiffusionImageFilter<class itk::Image<float,3>,class
>>>> itk::Image<float,3
>>>>
>>>>
>>>>>> ::SetConductanceScalingUpdateInterval(const unsigned int)'
>>>>>
>>>>>
>>>> ....
>>>> I always got the same error, changing the zm parameter did not work.
>>>> Using no Zm works not. I searched on the internet but nothing helpes.
>>>> Compiling on other mashines produces the same error.
>>>>
>>>> I will be a pleasure to get some info what to do to remove this
>>>> failure
>>>> Thanks a lot
>>>> Christian
>>>>
>>>
>>>
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>> ------------------------------------------------------------------------
>>
>
>
>
>
--
Dipl.-Ing. Christian Dold
Fraunhofer Gesellschaft Phone: +49-6151-155 523
Institute for Computer Graphics Fax: +49-6151-155559
Fraunhoferstr.5 mailto: Christian.Dold at igd.fhg.de
D-64283 Darmstadt, Germany WWW: http://www.igd.fhg.de/igd-a7
-------------- next part --------------
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkMapIntensityImageFilter.h,v $
Language: C++
Date: $Date: 2004/05/04 10:58:00 $
Version: $Revision: 1.0 $
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __itkMapIntensityImageFilter_h
#define __itkMapIntensityImageFilter_h
#include "itkImageToImageFilter.h"
#include "itkStatisticsImageFilter.h"
#include "itkShiftScaleImageFilter.h"
#include "itkEventObject.h"
namespace itk {
/** \class MapIntensityImageFilter
* \brief Applies a linear transformation to the intensity levels of the
* input image according to the selected mapping mode.
*
* MapIntensityImageFilter applies pixel-wise a linear transformation
* to the intensity values of input image pixels. The linear transformation
* is defined by the user in terms of the minimum and maximum values that
* the output image should have, as well as the minimum and maximum values
* of the input image.
*
* The input minimum and maximum values can either be computed from the input
* image, or be specified explicitly by the user, according to the mapping
* mode set with SetMappingMode(). The default mapping mode is MinMax.
*/
template<class TInputImage,class TOutputImage>
class ITK_EXPORT MapIntensityImageFilter :
public ImageToImageFilter<TInputImage, TOutputImage>
{
public:
/** Standard Self typedef */
typedef MapIntensityImageFilter Self;
typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Runtime information support. */
itkTypeMacro(MapIntensityImageFilter, ImageToImageFilter);
/** Image related typedefs. */
typedef typename TInputImage::Pointer InputImagePointer;
typedef typename TOutputImage::Pointer OutputImagePointer;
typedef typename TOutputImage::PixelType OutputPixelType;
typedef typename TInputImage::PixelType InputPixelType;
typedef enum { Range, MinMax } MappingMode;
/** Set the mapping mode. */
itkSetMacro(MappingMode, MappingMode);
/** Get the mapping mode. */
itkGetConstMacro(MappingMode, MappingMode);
/**
* Set mapping mode to Range; use-specified values for input minimum and
* maximum will be used.
*/
void SetMappingModeToRange()
{
this->SetMappingMode(Range);
}
/**
* Set mapping mode to MinMax; the values for input minimum and maximum
* will be computed from the input image.
*/
void SetMappingModeToMinMax()
{
this->SetMappingMode(MinMax);
}
/** Set the minimum value of the output image */
itkSetMacro(OutputMinimum, OutputPixelType);
/** Get the minimum value of the output image */
itkGetConstMacro(OutputMinimum, OutputPixelType);
/** Set the maximum value of the output image */
itkSetMacro(OutputMaximum, OutputPixelType);
/** Get the maximum value of the output image */
itkGetConstMacro(OutputMaximum, OutputPixelType);
/** Set the minimum value of the input image */
itkSetMacro(InputMinimum, InputPixelType);
/** Get the minimum value of the input image */
itkGetConstMacro(InputMinimum, InputPixelType);
/** Set the maximum value of the input image */
itkSetMacro(InputMaximum, InputPixelType);
/** Get the maximum value of the input image */
itkGetConstMacro(InputMaximum, InputPixelType);
protected:
MapIntensityImageFilter();
/** GenerateData. */
void GenerateData ();
// Override since the filter needs all the data for the algorithm
void GenerateInputRequestedRegion();
private:
MapIntensityImageFilter(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
typename StatisticsImageFilter<TInputImage>::Pointer m_StatisticsFilter;
typename ShiftScaleImageFilter<TInputImage,TOutputImage>::Pointer m_ShiftScaleFilter;
MappingMode m_MappingMode;
InputPixelType m_InputMinimum;
InputPixelType m_InputMaximum;
InputPixelType m_ComputedInputMinimum;
InputPixelType m_ComputedInputMaximum;
OutputPixelType m_OutputMinimum;
OutputPixelType m_OutputMaximum;
} ; // end of class
} // end namespace itk
//#ifndef ITK_MANUAL_INSTANTIATION
#include "itkMapIntensityImageFilter.txx"
//#endif
#endif
-------------- next part --------------
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkMapIntensityImageFilter.txx,v $
Language: C++
Date: $Date: 2004/05/04 10:58:00 $
Version: $Revision: 1.0 $
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _itkMapIntensityImageFilter_txx
#define _itkMapIntensityImageFilter_txx
#include "itkMapIntensityImageFilter.h"
#include "itkImageRegionIterator.h"
#include "itkStatisticsImageFilter.h"
#include "itkShiftScaleImageFilter.h"
#include "itkProgressAccumulator.h"
#include "itkCommand.h"
namespace itk
{
template <class TInputImage, class TOutputImage>
MapIntensityImageFilter<TInputImage, TOutputImage>
::MapIntensityImageFilter()
{
m_StatisticsFilter = 0;
m_StatisticsFilter = StatisticsImageFilter<TInputImage>::New();
m_ShiftScaleFilter = ShiftScaleImageFilter<TInputImage,TOutputImage>::New();
m_InputMinimum = NumericTraits<InputPixelType>::max();
m_InputMaximum = NumericTraits<InputPixelType>::Zero;
m_ComputedInputMinimum = NumericTraits<InputPixelType>::max();
m_ComputedInputMaximum = NumericTraits<InputPixelType>::Zero;
m_OutputMinimum = NumericTraits<OutputPixelType>::max();
m_OutputMaximum = NumericTraits<OutputPixelType>::Zero;
m_MappingMode = MinMax;
}
template <class TInputImage, class TOutputImage>
void
MapIntensityImageFilter<TInputImage, TOutputImage>
::GenerateInputRequestedRegion()
{
Superclass::GenerateInputRequestedRegion();
if ( this->GetInput() )
{
InputImagePointer image =
const_cast< typename Superclass::InputImageType * >( this->GetInput() );
image->SetRequestedRegionToLargestPossibleRegion();
}
}
template <class TInputImage, class TOutputImage>
void
MapIntensityImageFilter<TInputImage, TOutputImage>
::GenerateData()
{
ProgressAccumulator::Pointer progress = ProgressAccumulator::New();
progress->SetMiniPipelineFilter(this);
progress->RegisterInternalFilter(m_StatisticsFilter,.5f);
progress->RegisterInternalFilter(m_ShiftScaleFilter,.5f);
if (m_MappingMode == MinMax)
{
// Gather statistics
m_StatisticsFilter->SetInput(this->GetInput());
m_StatisticsFilter->GetOutput()->SetRequestedRegion(this->GetOutput()->GetRequestedRegion());
m_StatisticsFilter->Update();
m_ComputedInputMinimum = m_StatisticsFilter->GetMinimum();
m_ComputedInputMaximum = m_StatisticsFilter->GetMaximum();
// Set the parameters for shift/scale
// avoid division by zero...
if (m_ComputedInputMinimum != m_ComputedInputMaximum)
{
m_ShiftScaleFilter->SetShift(
(m_OutputMinimum * m_ComputedInputMaximum
- m_OutputMaximum * m_ComputedInputMinimum)
/ (m_OutputMaximum - m_OutputMinimum));
m_ShiftScaleFilter->SetScale(
(m_OutputMaximum - m_OutputMinimum)
/ (m_ComputedInputMaximum - m_ComputedInputMinimum));
}
else
{
m_ShiftScaleFilter->SetShift(0.0);
m_ShiftScaleFilter->SetScale(1.0);
}
}
else //if (m_MappingMode == Range)
{
// Set the parameters for shift/scale
m_ShiftScaleFilter->SetShift(
(m_OutputMinimum * m_InputMaximum - m_OutputMaximum * m_InputMinimum)
/ (m_OutputMaximum - m_OutputMinimum));
m_ShiftScaleFilter->SetScale(
(m_OutputMaximum - m_OutputMinimum)
/ (m_InputMaximum - m_InputMinimum));
}
m_ShiftScaleFilter->SetInput(this->GetInput());
m_ShiftScaleFilter->GetOutput()->SetRequestedRegion(this->GetOutput()->GetRequestedRegion());
m_ShiftScaleFilter->Update();
// Graft the mini pipeline output to this filters output
this->GraftOutput(m_ShiftScaleFilter->GetOutput());
}
} // end namespace itk
#endif
More information about the Insight-users
mailing list