<div><br></div>Hi Michael,<div><br></div><div><br></div><div> This is clearly the work of Gremlins!</div><div><br></div><div><br></div><div>Here are some of the typical mechanisms used by Gremlins to exasperate C++ developers</div>
<div>with the evil hope of making adopt C# or Java:</div><div><br></div><div><ul><li>Distract the C++ developer to make her/him leave some uninitialized variables<br>(You can check for uninitialized variables by using Valgrind)<br>
<br></li><li>Gremlins may have removed from your m_DicomReader class the code that<br>triggers the read of the DICOM image, so that when you call GetITKImage() <br>you get an empty image.</li></ul><div><br></div>You can install Gremlin detectors by adding a couple of lines:</div>
<div><br></div><div><ul><li><span class="Apple-style-span" style="border-collapse: collapse; ">m_Dicomreader->GetITKOutput()->Print( std::cout );<br>before you set the image to the threshold filter<br><br></span></li>
<li><span class="Apple-style-span" style="border-collapse: collapse;">thresholder->GetOutput()->Print( std::cout )<br>after you call Update in the connected threshold filter.</span></li></ul></div><div><br></div><div>
<br></div><div> Regards,</div><div><br></div><div><br></div><div> Luis</div><div><br></div><div>---------------------------<br><div class="gmail_quote">On Mon, Aug 17, 2009 at 5:26 AM, Michael Xanadu <span dir="ltr"><<a href="mailto:xanadu.michael@googlemail.com">xanadu.michael@googlemail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hallo itk users,<br><br>now take a look at some real strange bug. I programmed a ConnectedThresholdImageFilter, which works (surprisingly).<br>
But if add add some lines of QT code into the method (which don't mess with the filter) - all I get is a black output!<br>
This kind of bug has happened to me a lot lately. Sometimes a filter doesn't seem to work, I tinker around with it for a day and after the SAME code works! <br>I even have a fast marching filter which only works, if I add some lines in which I create some itk::ImageFileWriter objects (BUT I DON'T USE THEM!).<br>
And once I get a code to work, it only works in the current method/class/project. If I copy and paste the code -> black ouput!<br>Do Someone know, what went wrong?<br><br>Thanx in advance, Michael<br><br><br><br>void MyMainWindow::connectedThresholdFilter()<br>
{<br> typedef itk::ConnectedThresholdImageFilter<ImageType, ImageType> ThresholderType;<br> ThresholderType::Pointer thresholder = ThresholderType::New();<br> thresholder->SetInput( m_Dicomreader->GetITKOutput() );<br>
<br> // if I uncomment following line, I get a black output !!!!<br> //QString s1 = this->qlineedit1->text();<br><br> thresholder->SetLower(0);<br> thresholder->SetUpper(800);<br> ImageType::IndexType index;<br>
index[0] = 250;<br> index[1] = 250;<br> thresholder->SetSeed(index);<br> thresholder->SetReplaceValue(255);<br><br> try<br> {<br> thresholder->Update();<br> }<br> catch( itk::ExceptionObject & excep )<br>
{<br> std::cerr << "Exception caught !" << std::endl;<br> std::cerr << excep << std::endl;<br> }<br><br> // Here I use a vtkImageViewer2 to show the output<br> Utility::popUpImage(thresholder->GetOutput());<br>
}<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>
Please keep messages on-topic and check the ITK FAQ at: <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>
<br></blockquote></div><br></div>