[Insight-developers] DenseFiniteDifferenceImageFilter and Pipelines

Josh Cates cates at sci.utah.edu
Thu Jun 5 11:30:43 EDT 2008


Hello Tom,

This makes sense to me.  I can't speak for other developers who use
this base class, but I think your changes should be sound.

Josh.

On Tue, Jun 3, 2008 at 3:30 AM, Tom Vercauteren
<tom.vercauteren at gmail.com> wrote:
> Hi all,
>
> Some time ago, I filed a bug report
> (http://www.itk.org/Bug/view.php?id=3972) about a potential pipeline
> problem in itk::DenseFiniteDifferenceImageFilter. There has been a
> small discussion (see links below) but the issue has not been fixed. I
> need some feedback to know if my proposed fix does not embarrass other
> ITK developers.
>
> Here's a summary.
>
> itk::DenseFiniteDifferenceImageFilter basically loops over two function calls:
> for i=1:N
>    CalculateChange
>    ApplyUpdate
> end
>
> CalculateChange uses ITK iterators (not filters) to modify the
> filter's update buffer.
> ApplyUpdate uses ITK iterators (not filters) to modify the filter's
> output buffer for example by adding values from  the filter's update
> buffer.
>
> Up to now everything works fine. Now suppose I implement a filter
> called SubclassFilter that derives from
> itk::DenseFiniteDifferenceImageFilter and overrides ApplyUpdate.
>
> Let's assume that SubclassFilter::ApplyUpdate does not uses iterators
> to modify the filter's output but rather standard ITK filters.
>
> The problem is that the ITK filters in SubclassFilter::ApplyUpdate
> will only be executed during the first iteration of the
> itk::DenseFiniteDifferenceImageFilter loop.
>
> Indeed, since CalculateChange only uses ITK iterators, the modified
> time of the filter's update buffer is not incremented in the loop.
>
> The ITK filters in SubclassFilter::ApplyUpdate therefore see that
> there output (e.g. the filter's output buffer) is more recent that
> there input (e.g. the filter's update buffer). Updating the filters
> therefore has no effect.
>
>
> My proposed fix is simply to call:
> - m_UpdateBuffer->Modified() at the end of
> DenseFiniteDifferenceImageFilter::CalculateChange and
> - this->GetOutout()->Modified() at the end of
> DenseFiniteDifferenceImageFilter::ApplyUpdate
>
> So even though the buffers are modified through iterators, there
> ModifiedTime gets incremented in the
> itk::DenseFiniteDifferenceImageFilter loop.
>
>
> Please tell me if this makes sense or if my explanation is unclear.
>
> Best regards,
> Tom Vercauteren
>
>
> P.S.: previous posts are here
> http://www.itk.org/pipermail/insight-users/2006-August/018962.html
> http://www.itk.org/pipermail/insight-users/2006-August/018983.html
> http://www.itk.org/pipermail/insight-users/2006-August/018994.html
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
>


More information about the Insight-developers mailing list