<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV>Dear All:</DIV>
<DIV>&nbsp;</DIV>
<DIV>I am trying to wirte some template class which is templated over itkImage&nbsp;with&nbsp;&nbsp;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&nbsp; I did not do anything using them now.</DIV>
<DIV>&nbsp;</DIV>
<DIV>The error message shows me I should not call itkImage constructor or destructor since they are protected.&nbsp; Can somebody tell me the right way to do the work.</DIV>
<DIV>&nbsp;</DIV>
<DIV>I have listed the code and error message.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks and my best regards</DIV>
<DIV>&nbsp;</DIV>
<DIV>Baoyun</DIV>
<DIV>&nbsp;</DIV>
<DIV>1.&nbsp;&nbsp; The intilization of this class</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp; typedef ChanVese&lt;InputImageType,InputImageType,float&gt; ChanVeseType;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ChanVeseType leveset1;</DIV>
<DIV>&nbsp;</DIV>
<DIV>2: class definition</DIV>
<DIV>***************************************************</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>#ifndef _ChanVese_H<BR>#define _ChanVese_H</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>#include "itkImage.h"<BR>#include "itkImageFileReader.h"<BR>#include "itkImageFileWriter.h"<BR>#include "itkBinaryThresholdImageFilter.h"</DIV>
<DIV><BR>using namespace std;<BR>template &lt;class TInputImage,class TFeatureImage,class TOutputPixelType&gt;<BR>&nbsp;&nbsp; class ChanVese</DIV>
<DIV>{<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; public:<BR>&nbsp;&nbsp;&nbsp; itkStaticConstMacro( ImageDimension, unsigned int,TInputImage::ImageDimension );<BR>&nbsp;&nbsp;&nbsp; typedef TFeatureImage FeatureImageType;<BR>&nbsp;&nbsp;&nbsp; typedef typename FeatureImageType::PixelType FeaturePixelType;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; typedef TInputImage InputImageType;<BR>&nbsp;&nbsp;&nbsp; typedef typename InputImageType::PixelType InputPixelType;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp; ChanVese()</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout&lt;&lt;"chan vesee desconstructed"&lt;&lt;std::endl;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp; ~ChanVese()</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout&lt;&lt;"chan vesee desconstructed"&lt;&lt;std::endl;<BR>&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp; } ;</DIV>
<DIV><BR>#endif</DIV>
<DIV>&nbsp;</DIV>
<DIV>******************************************************</DIV>
<DIV>&nbsp;</DIV>
<DIV>
<DIV>--------------------------------------------------------------------------------------------------</DIV>
<DIV>/home/gtao/tools/ITK/source_3.16/Code/Common/itkImage.txx:34: error: 'itk::Image&lt;TPixel, VImageDimension&gt;::Image() [with TPixel = short int, unsigned int VImageDimension = 3u]' is protected<BR>/home/gtao/code/Gui_Segmenation/chan_vesse/v1.5_tumor_pdfmap/source/algorithm/ChanVese.h:35: error: within this context<BR>/home/gtao/code/Gui_Segmenation/chan_vesse/v1.5_tumor_pdfmap/source/test.cxx:490: instantiated from here<BR>/home/gtao/tools/ITK/source_3.16/Code/Common/itkImage.h:287: error: 'itk::Image&lt;TPixel, VImageDimension&gt;::~Image() [with TPixel = short int, unsigned int VImageDimension = 3u]' is protected<BR>/home/gtao/code/Gui_Segmenation/chan_vesse/v1.5_tumor_pdfmap/source/algorithm/ChanVese.h:35: error: within this context<BR>/home/gtao/tools/ITK/source_3.16/Code/Common/itkImage.h: In destructor 'ChanVese&lt;TInputImage, TFeatureImage, TOutputPixelType&gt;::~ChanVese() [with TInputImage = itk::Image&lt;short int, 3u&gt;,
 TFeatureImage = itk::Image&lt;short int, 3u&gt;, TOutputPixelType = float]':<BR>/home/gtao/code/Gui_Segmenation/chan_vesse/v1.5_tumor_pdfmap/source/test.cxx:490: instantiated from here<BR>/home/gtao/tools/ITK/source_3.16/Code/Common/itkImage.h:287: error: 'itk::Image&lt;TPixel, VImageDimension&gt;::~Image() [with TPixel = short int, unsigned int VImageDimension = 3u]' is protected<BR>/home/gtao/code/Gui_Segmenation/chan_vesse/v1.5_tumor_pdfmap/source/algorithm/ChanVese.h:42: error: within this context<BR></DIV>
<DIV>------------------------------------------------------------------------------------------------------</DIV>
<DIV>&nbsp;</DIV></DIV>
<DIV>&nbsp;</DIV></div><br>

      </body></html>