<div dir="ltr"><div><div><div>well,<br><br></div>thanks first for the feedback. I now wrote this code:<br><br> typedef itk::Statistics::ScalarImageToHistogramGenerator< InputImageType >   ScalarImageToHistogramGeneratorType;<br> typedef ScalarImageToHistogramGeneratorType::HistogramType    HistogramType;<br><br> ScalarImageToHistogramGeneratorType::Pointer scalarImageToHistogramGenerator = ScalarImageToHistogramGeneratorType::New();<br> scalarImageToHistogramGenerator->SetNumberOfBins(128);<br> scalarImageToHistogramGenerator->SetInput( m_ShiftedImage );<br> scalarImageToHistogramGenerator->Compute();<br><br>HistogramType::Pointer hist = scalarImageToHistogramGenerator->GetOutput();  // This statement causes the error<br><br>SaveHistogram(hist, "c:/Hist.txt");<br><br></div>Now: the compiler gives an error<br><br> error C2440: 'Initialisierung': 'const itk::Statistics::Histogram<TMeasurement,VMeasurementVectorSize,TFrequencyContainer> *' kann nicht in 'itk::SmartPointer<TObjectType>' konvertiert werden<br>1>        with<br>1>        [<br>1>            TMeasurement=double,<br>1>            VMeasurementVectorSize=1,<br>1>            TFrequencyContainer=itk::Statistics::DenseFrequencyContainer<br>1>        ]<br>1>        and<br>1>        [<br>1>            TObjectType=itk::Statistics::Histogram<double,1,itk::Statistics::DenseFrequencyContainer><br>1>        ]<br><br><br></div>Translation: <br><div><div></div><br><div> 'const itk::Statistics::Histogram<TMeasurement,VMeasurementVectorSize,TFrequencyContainer> *'<br><br></div><div>cannot be converted to <br><br> 'itk::SmartPointer<TObjectType>'<br><br><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 27, 2014 at 2:11 PM, Bradley Lowekamp <span dir="ltr"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
The Histogram class is derived from the itk::Object class. Just about all ITK Object must manage by smart pointers, and must be dynamically created. The typical usage of an object type is:<br>
<br>
HistogramType::Pointer histogramPointer = HistogramType::New();<br>
<br>
This dynamically creates an Histogram, and uses the correct smart pointer type.<br>
<br>
<br>
This particular error message:<br>
<br>
On Oct 27, 2014, at 8:17 AM, Zein Salah <<a href="mailto:zeinsalah@gmail.com">zeinsalah@gmail.com</a>> wrote:<br>
><br>
> error C2248::itk::Statistics::Histogram<TMeasurement,VMeasurementVectorSize,TFrequencyContainer>::~Histogram":<br>
<br>
<br>
is an indication that you are passing the type by value an not by a pointer. You should pass the histogram as PointerType of the class or as a raw pointer if there is not an issue of ownership that the smart pointe need to preserve.<br>
<br>
Brad<br>
<br>
p.s. You didn't include any of you code that was causing the problem. This is quite a luck case where I new the cause of the error message with out even seeing the code. It's best practice to include some code so that other can see what's causing the problem.<br>
<br>
<br>
<br>
</blockquote></div><br></div>