[Insight-users] HELP! A "magic" bug bites me.

Michael Xanadu xanadu.michael at googlemail.com
Mon Aug 17 05:26:15 EDT 2009


Hallo itk users,

now take a look at some real strange bug. I programmed a
ConnectedThresholdImageFilter, which works (surprisingly).
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!
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!
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!).
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!
Do Someone know, what went wrong?

Thanx in advance, Michael



void MyMainWindow::connectedThresholdFilter()
{
    typedef itk::ConnectedThresholdImageFilter<ImageType, ImageType>
ThresholderType;
    ThresholderType::Pointer thresholder = ThresholderType::New();
    thresholder->SetInput( m_Dicomreader->GetITKOutput() );

    // if I uncomment following line, I get a black output !!!!
    //QString s1 = this->qlineedit1->text();

    thresholder->SetLower(0);
    thresholder->SetUpper(800);
    ImageType::IndexType  index;
    index[0] = 250;
    index[1] = 250;
    thresholder->SetSeed(index);
    thresholder->SetReplaceValue(255);

    try
    {
        thresholder->Update();
    }
    catch( itk::ExceptionObject & excep )
    {
        std::cerr << "Exception caught !" << std::endl;
        std::cerr << excep << std::endl;
    }

    // Here I use a vtkImageViewer2 to show the output
    Utility::popUpImage(thresholder->GetOutput());
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090817/0a0e605a/attachment.htm>


More information about the Insight-users mailing list