[Insight-developers] ParallelSparseFieldLevelSetImageFilter

Brady McCary brady.mccary+ITK at gmail.com
Tue Mar 10 00:40:10 EDT 2009


insight-developers,

ParallelSparseFieldLevelSetImageFilter derives from
FiniteDifferenceImageFilter. The parent filter has the following
definition:

  virtual void InitializeIteration()
    { m_DifferenceFunction->InitializeIteration(); }

This means that the difference function will execute this method at
the beginning of every iteration. The child filter (Parallel ...),
however, does not provide for an analogous guarantee for the
difference function to execute it's InitializeIteration() method. Is
this intended, or is it an omission? Currently, I have a difference
function which must be initialized. To allow for the single-threaded
and parallel implementation to be interchangeable, I changed
ThreadedInitializeIteration to the following:

template<class TInputImage, class TOutputImage>
void
ParallelSparseFieldLevelSetImageFilter<TInputImage, TOutputImage>
::ThreadedInitializeIteration (unsigned int itkNotUsed(ThreadId))
{
  // If child classes need an entry point to the start of every iteration step
  // they can override this method.

  //
  // This is called exactly once.
  //
  if(ThreadId == 0)
  {
    Superclass::InitializeIteration();
  }
  this->WaitForAll();

  return;
}

Is this a reasonable thing to do, or have I missed something?

Brady


More information about the Insight-developers mailing list