[Insight-users] Does "InPlace" filters really work "In Place"?

Jim Miller millerjv at gmail.com
Wed Aug 13 21:51:08 EDT 2008


Sounds like the TIFFImageIO is trying to cache the buffer that it used. I
don't think it should do this for reasons related to the problem you found.

Can you enter a bug in the bug tracker?



On Mon, Aug 4, 2008 at 5:32 AM, <Yulia.Arzhaeva at csiro.au> wrote:

> Hi,
>
> Indeed, there is no problem with running an "InPlace" filter with
> provided example images. However, there are no examples of tif images in
> the Examples\Data folder, and the runtime error I described in an
> earlier email happens when I run a ThresholdImageFilter test with some
> tif images.
>
> I found out that the crash has nothing to do with filtering but with
> writing an output image in a file. Although, it's not possible to catch
> it as an exception - the error happens because a null pointer is
> addressed within one of the functions called inside TIFFImageIO::Read().
>
>
> I've done a bit of debugging and that is what I've found. In a pipeline,
> that connects a reader with a filter with a writer, calling
> writer->Update() causes an update of a reader, because, with
> filter->InPlaceOn(), the filter input gets released. For tif images,
> TIFFImageIO::Read() is called, which uses m_InternalImage that is
> supposed to have a non-null pointer m_Image to an allocated piece of
> memory. m_InternalImage is filled in TIFFImageIO::CanReadFile(), which
> is not called the second time, as a part of writer->Update() procedure.
> As a result, m_InternalImage->m_Image points to NULL, and causes the
> runtime error when addressed in TIFFImageIO::Read().  If one includes
> filter->GetOutput()->DisconnectPipeline() before calling
> writer->Update(), no error occurs because no input image update occurs.
>
> I guess, there might be an error in handling tif images. Could anyone
> please comment?
> Thanks.
> Yulia
>
>
> ----------
> Bill Lorensen wrote:
>
> Yulia,
>
> The example works fine for me when I add filter->InPlaceOn(). Are you
> running the example data or your own?
>
> Replace the first filter-<Update(); with
>
>  try
>    {
>    filter->Update();
>    }
>  catch (itk::ExceptionObject &ex)
>    {
>    std::cout << ex;
>    return EXIT_FAILURE;
>    }
>
> and see if you get more information.
>
> Actually, place a try/catch around each ->Update() just in case the
> problem is with reading or writing.
>
> Bill
>
> On Fri, Jul 25, 2008 at 11:07 AM,  <Yulia.Arzhaeva at csiro.au> wrote:
> > Hello,
> >
> > I have just started using ITK, so I might have overlooked something..
> >
> > I have tried to use ThresholdImageFilter with "InPlace" feature ON,
> i.e. I called filter->InPlaceOn() before calling filter->Update(). As a
> result, I got a runtime error. I played with an example code, so it can
> be reproducible.
> >
> > If you take an example code ThresholdImageFilter.cxx from the
> ..\Examples\Filtering folder , leave just one filter update instead of
> three updates, for simplicity, and insert filter->InPlaceOn(), would you
> get a runtime error as well?
> >
> > Could you explain me what's wrong, either with my way to set InPlace
> feature, or with using such a filter "In Place" at all?
> >
> > Thanks,
> > Yulia
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org
> > http://www.itk.org/mailman/listinfo/insight-users
> >
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20080813/09539975/attachment.htm>


More information about the Insight-users mailing list