Hello Roman,<br><br><div class="gmail_quote">On Thu, Aug 19, 2010 at 2:45 PM, Roman Grothausmann <span dir="ltr"><<a href="mailto:roman.grothausmann@helmholtz-berlin.de">roman.grothausmann@helmholtz-berlin.de</a>></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<class TInputImage , class TOutputImage ></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>< TInputImage, TOutputImage >::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="'courier new', monospace">InputPixelType</font>. Since you have instantiated <font class="Apple-style-span" face="'courier new', monospace">unsigned char</font>s, perhaps you are getting a character that doesn't "show up."</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="'courier new', monospace">std::cout << "Threshold: " << static_cast<unsigned int>(filter->GetThreshold()) << 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 <itkImageFileReader.h><br>
#include <itkImageFileWriter.h><br>
<br>
#include <itkOtsuThresholdImageFilter.h><br>
#include "itkFilterWatcher2.h"<br>
<br>
int main( int argc, char * argv[] )<br>
{<br>
if( argc != 4 )<br>
{<br>
std::cerr << "Usage: " << argv[0];<br>
std::cerr << " inputImage";<br>
std::cerr << " outputImage";<br>
std::cerr << " #_of_hist-bins";<br>
std::cerr << 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<InputPixelType, Dimension> InputImageType;<br>
typedef itk::Image<OutputPixelType, Dimension> OutputImageType;<br>
<br>
typedef itk::ImageFileReader<InputImageType> ReaderType;<br>
typedef itk::ImageFileWriter<OutputImageType> WriterType;<br>
WriterType::Pointer writer = WriterType::New();<br>
<br>
ReaderType::Pointer reader = ReaderType::New();<br>
reader->SetFileName(argv[1]);<br>
<br>
typedef itk::OtsuThresholdImageFilter<InputImageType, OutputImageType> FilterType;<br>
FilterType::Pointer filter = FilterType::New();<br>
<br>
<br>
filter->SetNumberOfHistogramBins(atoi(argv[3]));<br>
<br>
filter->SetInput(reader->GetOutput());<br>
FilterWatcher watcher(filter, "filter");<br>
filter->Update();<br>
<br>
std::cout << "Threshold: " << filter->GetThreshold() << std::endl;<br>
<br>
writer->SetFileName(argv[2]);<br>
writer->SetInput(filter->GetOutput());<br>
writer->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>