[Insight-users] Filter is not updating

Nils H. Busch nilsb at cbs.mpg.de
Tue Aug 30 08:43:52 EDT 2005


Hi,

I have written an iterative filter derived from ImageToImageFilter
containing two level set image filters connected to each other. I run both
filters for one iteration, then reset their inputs and run the iteration
cycle until both converge.
As told, I assign the output of the previous run of one filter to a
pointer, then call DisconnectPipeline on it and then feed it as inputs to
both filters.
My code (in GenerateData()) looks like this (excerpt)

while(!this->Halt()) {
  for(unsigned int i = 0; i < this->GetNumberOfInputs(); ++i) {
    m_Filter[i]->SetInput(iterationOutput[i]);
    m_Filter[i]->SetCoupledInput(coupledOutput[i]);
    m_Filter[i]->Update();
    iterationOutput[i] = m_Filter[i]->GetOutput();
    iterationOutput[i]->DisconnectPipeline();
    // This assignes the new output of this filter to the input pointer of
    // the coupled filter
    // Causes SIGFPE exception during next iteration
    coupledOutput[(i+1)%c_NUM_FILTER] = iterationOutput[i];
   }
   ++m_ElapsedIterations;
}

coupledOutput is an array that stores the outputs of the respective
coupled filter, i.e. coupledOutput[0] stores the pointer to the output
image of the coupled filter, i.e. filter[1];

I encounter two problems which might be related.
First of all, the filters don't execute when Update() is called on them,
although their inputs have changed (different pointers). Second, the
assignment for the coupled output causes a SIGFPE exception on the next
iteration cycle. In another part of my code, I had a similar assignment,
which was redundant and after removing it there, the same error went away
at that point.

My current suspicion is that since the filters don't execute, the
SetSecondInput (which calls SetNthInput(2,...) internally) method does not
propagate the newly assigned pointer to the component filter properly,
especially an internally used image interpolater might not receive the new
pointer and attempt to operate on a piece of obsolete memory. Since the
filters don't execute, the methods actually (mainly ComputeUpdate)
referencing the image are not called either, so this might be a wrong
guess.

I have two questions:
Any ideas why those filters don't execute although their input pointers
are definitely different. Do I need to check the modified and update times
more closely? What relations between the different modification and
pipeline update times must hold to have a filter execute ?

Is the assignment in question per se wrong (something one must not do
after DisconnectPipeline or do differently) ?

Thanks for any help,


-- 
  Nils H. Busch


More information about the Insight-users mailing list