[Insight-users] problem about template a class with itkimage
Baoyun Li
baoyun_li123 at yahoo.com
Fri Feb 26 11:30:22 EST 2010
Dear All:
I am trying to wirte some template class which is templated over itkImage with following class defintion. At this time, I just want my code to do somework with the help of itk tools. But something is wrong with my constructor an deconstructoer although I did not do anything using them now.
The error message shows me I should not call itkImage constructor or destructor since they are protected. Can somebody tell me the right way to do the work.
I have listed the code and error message.
Thanks and my best regards
Baoyun
1. The intilization of this class
typedef ChanVese<InputImageType,InputImageType,float> ChanVeseType;
ChanVeseType leveset1;
2: class definition
***************************************************
#ifndef _ChanVese_H
#define _ChanVese_H
#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkBinaryThresholdImageFilter.h"
using namespace std;
template <class TInputImage,class TFeatureImage,class TOutputPixelType>
class ChanVese
{
public:
itkStaticConstMacro( ImageDimension, unsigned int,TInputImage::ImageDimension );
typedef TFeatureImage FeatureImageType;
typedef typename FeatureImageType::PixelType FeaturePixelType;
typedef TInputImage InputImageType;
typedef typename InputImageType::PixelType InputPixelType;
ChanVese()
{
std::cout<<"chan vesee desconstructed"<<std::endl;
}
~ChanVese()
{
std::cout<<"chan vesee desconstructed"<<std::endl;
}
} ;
#endif
******************************************************
--------------------------------------------------------------------------------------------------
/home/gtao/tools/ITK/source_3.16/Code/Common/itkImage.txx:34: error: 'itk::Image<TPixel, VImageDimension>::Image() [with TPixel = short int, unsigned int VImageDimension = 3u]' is protected
/home/gtao/code/Gui_Segmenation/chan_vesse/v1.5_tumor_pdfmap/source/algorithm/ChanVese.h:35: error: within this context
/home/gtao/code/Gui_Segmenation/chan_vesse/v1.5_tumor_pdfmap/source/test.cxx:490: instantiated from here
/home/gtao/tools/ITK/source_3.16/Code/Common/itkImage.h:287: error: 'itk::Image<TPixel, VImageDimension>::~Image() [with TPixel = short int, unsigned int VImageDimension = 3u]' is protected
/home/gtao/code/Gui_Segmenation/chan_vesse/v1.5_tumor_pdfmap/source/algorithm/ChanVese.h:35: error: within this context
/home/gtao/tools/ITK/source_3.16/Code/Common/itkImage.h: In destructor 'ChanVese<TInputImage, TFeatureImage, TOutputPixelType>::~ChanVese() [with TInputImage = itk::Image<short int, 3u>, TFeatureImage = itk::Image<short int, 3u>, TOutputPixelType = float]':
/home/gtao/code/Gui_Segmenation/chan_vesse/v1.5_tumor_pdfmap/source/test.cxx:490: instantiated from here
/home/gtao/tools/ITK/source_3.16/Code/Common/itkImage.h:287: error: 'itk::Image<TPixel, VImageDimension>::~Image() [with TPixel = short int, unsigned int VImageDimension = 3u]' is protected
/home/gtao/code/Gui_Segmenation/chan_vesse/v1.5_tumor_pdfmap/source/algorithm/ChanVese.h:42: error: within this context
------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100226/028f8cff/attachment.htm>
More information about the Insight-users
mailing list