Hello Roman,<br><br><div class="gmail_quote">On Thu, Aug 19, 2010 at 2:45 PM, Roman Grothausmann <span dir="ltr">&lt;<a href="mailto:roman.grothausmann@helmholtz-berlin.de">roman.grothausmann@helmholtz-berlin.de</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Dear mailing list members,<br>
<br>
<br>
GetThreshold() from OtsuThresholdImageFilter in the code below does not return any value. Is that a bug?<br></blockquote><div><br></div><div>According to the documentation (<a href="http://www.itk.org/Doxygen320/html/classitk_1_1OtsuThresholdImageFilter.html#a7c5fd26660c92354986d61ff8770cf86">http://www.itk.org/Doxygen320/html/classitk_1_1OtsuThresholdImageFilter.html#a7c5fd26660c92354986d61ff8770cf86</a>),</div>

<div><br></div><div><span class="Apple-style-span" style="font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; "><div class="memtemplate" style="font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 12px; color: rgb(96, 96, 96); font-weight: normal; ">

template&lt;class TInputImage , class TOutputImage &gt;</div><table class="memname" style="white-space: nowrap; font-weight: bold; "><tbody><tr><td class="memname" style="font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 14px; white-space: nowrap; font-weight: bold; ">

virtual <a class="el" href="http://www.itk.org/Doxygen320/html/classitk_1_1OtsuThresholdImageFilter.html#a3495c875550c2ae4ed950ef5e54567a1" style="color: rgb(26, 65, 168); text-decoration: none; font-weight: bold; ">InputPixelType</a> <a class="el" href="http://www.itk.org/Doxygen320/html/classitk_1_1OtsuThresholdImageFilter.html" style="color: rgb(42, 55, 152); text-decoration: none; font-weight: bold; ">itk::OtsuThresholdImageFilter</a>&lt; TInputImage, TOutputImage &gt;::GetThreshold</td>

<td style="font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 14px; ">(</td><td class="paramname" style="font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 14px; color: rgb(96, 32, 32); font-style: italic; white-space: nowrap; ">

</td><td style="font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 14px; "> ) </td><td style="font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 14px; ">const<code> [virtual]</code></td></tr></tbody></table>

</span></div><div><br></div><div>you should get an <font class="Apple-style-span" face="&#39;courier new&#39;, monospace">InputPixelType</font>. Since you have instantiated <font class="Apple-style-span" face="&#39;courier new&#39;, monospace">unsigned char</font>s, perhaps you are getting a character that doesn&#39;t &quot;show up.&quot;</div>

<div><br></div><div>Try debugging, or do something like</div><div><br></div></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div class="gmail_quote"><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">std::cout &lt;&lt; &quot;Threshold: &quot; &lt;&lt; static_cast&lt;unsigned int&gt;(filter-&gt;GetThreshold()) &lt;&lt; std::endl;</font></div>

</div></blockquote><div class="gmail_quote"><div><br></div><div>Regards,</div><div><br></div><div>Frederic Perez</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">


<br>
Any help is very much appreciated<br>
Roman<br>
<br>
<br>
________________________________________<br>
<br>
#include &lt;itkImageFileReader.h&gt;<br>
#include &lt;itkImageFileWriter.h&gt;<br>
<br>
#include &lt;itkOtsuThresholdImageFilter.h&gt;<br>
#include &quot;itkFilterWatcher2.h&quot;<br>
<br>
int main( int argc, char * argv[] )<br>
    {<br>
    if( argc != 4 )<br>
        {<br>
        std::cerr &lt;&lt; &quot;Usage: &quot; &lt;&lt; argv[0];<br>
        std::cerr &lt;&lt; &quot; inputImage&quot;;<br>
        std::cerr &lt;&lt; &quot; outputImage&quot;;<br>
        std::cerr &lt;&lt; &quot; #_of_hist-bins&quot;;<br>
        std::cerr &lt;&lt; std::endl;<br>
        return EXIT_FAILURE;<br>
        }<br>
<br>
    typedef  unsigned char InputPixelType;<br>
    typedef  unsigned char OutputPixelType;<br>
<br>
    const unsigned int Dimension = 3;<br>
<br>
    typedef itk::Image&lt;InputPixelType,  Dimension&gt;   InputImageType;<br>
    typedef itk::Image&lt;OutputPixelType,  Dimension&gt;   OutputImageType;<br>
<br>
    typedef itk::ImageFileReader&lt;InputImageType&gt;  ReaderType;<br>
    typedef itk::ImageFileWriter&lt;OutputImageType&gt;  WriterType;<br>
    WriterType::Pointer writer = WriterType::New();<br>
<br>
    ReaderType::Pointer reader = ReaderType::New();<br>
    reader-&gt;SetFileName(argv[1]);<br>
<br>
    typedef itk::OtsuThresholdImageFilter&lt;InputImageType, OutputImageType&gt; FilterType;<br>
    FilterType::Pointer filter = FilterType::New();<br>
<br>
<br>
    filter-&gt;SetNumberOfHistogramBins(atoi(argv[3]));<br>
<br>
    filter-&gt;SetInput(reader-&gt;GetOutput());<br>
    FilterWatcher watcher(filter, &quot;filter&quot;);<br>
    filter-&gt;Update();<br>
<br>
    std::cout &lt;&lt; &quot;Threshold: &quot; &lt;&lt; filter-&gt;GetThreshold() &lt;&lt; std::endl;<br>
<br>
    writer-&gt;SetFileName(argv[2]);<br>
    writer-&gt;SetInput(filter-&gt;GetOutput());<br>
    writer-&gt;Update();<br>
<br>
    return EXIT_SUCCESS;<br>
    }<br>
<br>
<br>
<br>
<br>
-- <br>
Roman Grothausmann<br>
<br>
Helmholtz-Zentrum Berlin für Materialien und Energie GmbH<br>
Bereich Funktionale Materialien<br>
Institut für angewandte Materialforschung<br>
Hahn-Meitner-Platz 1<br>
D-14109 Berlin  <br>
<br>
Tel.: +49-(0)30-8062-2816<br>
Fax.: +49-(0)30-8062-3059<br>
<br>
Vorsitzender des Aufsichtsrats: Prof. Dr. Dr. h.c. mult. Joachim Treusch<br>
Stellvertretende Vorsitzende: Dr. Beatrix Vierkorn-Rudolph<br>
Geschäftsführer: Prof. Dr. Anke Rita Kaysser-Pyzalla, Prof. Dr. Dr. h.c. Wolfgang Eberhardt, Dr. Ulrich Breuer<br>
Sitz der Gesellschaft: Berlin<br>
Handelsregister: AG Charlottenburg, 89 HRB 5583<br>
<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</blockquote></div><br>