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