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

Luis Ibanez luis.ibanez at kitware.com
Mon Aug 17 10:39:18 EDT 2009


Hi Michael,

                            This is clearly the work of Gremlins!


Here are some of the typical mechanisms used by Gremlins to exasperate C++
developers
with the evil hope of making adopt C# or Java:


   - Distract the C++ developer to make her/him leave some uninitialized
   variables
   (You can check for uninitialized variables by using Valgrind)

   - Gremlins may have removed from your m_DicomReader class the code that
   triggers the read of the DICOM image, so that when you call
   GetITKImage()
   you get an empty image.


You can install Gremlin detectors by adding a couple of lines:


   - m_Dicomreader->GetITKOutput()->Print( std::cout );
   before you set the image to the threshold filter

   - thresholder->GetOutput()->Print( std::cout )
   after you call Update in the connected threshold filter.



   Regards,


         Luis

---------------------------
On Mon, Aug 17, 2009 at 5:26 AM, Michael Xanadu <
xanadu.michael at googlemail.com> wrote:

> 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());
> }
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090817/86b74cc9/attachment.htm>


More information about the Insight-users mailing list