[Insight-users] Filter is not updating

Miller, James V (Research) millerjv at crd.ge.com
Tue Aug 30 11:43:45 EDT 2005


Nils, 

Have you initialized iterationOutput and coupledOutput so the filters are 
provided with valid input on the first iteration? Your code snippet does 
not show this.  Just want to make sure.

Your suspicion about the Update() sounds like its heading down the right
path.  Setting the inputs should have caused the modified times of the 
filters to change.  You might want to print out the ModifiedTimes of 
m_Filter[i] before calling SetInput() and before the call to Update() to 
verify.

If those modified times are different, the filters should update properly.
Now it becomes a question of whether the initialization of the filters 
propagates the inputs to any underlying image functions properly.

Do your filters subclass off of itkSegmentationLevelSetImageFilter?  If looks like
there is code that only calculates/allocates the speed and advection image if the state
of the filter is UNITIALIZED. You might want to add a line to your loop 

m_Filter[i]->SetStateToUnitialized();

to force the filter to rebuild these images.  If this fixes, your problem, then 
we should force the level set filters to be unitialized if the inputs are 
changed.

Jim





-----Original Message-----
From: insight-users-bounces+millerjv=crd.ge.com at itk.org
[mailto:insight-users-bounces+millerjv=crd.ge.com at itk.org]On Behalf Of
Nils H. Busch
Sent: Tuesday, August 30, 2005 8:44 AM
To: insight-users at itk.org
Subject: [Insight-users] Filter is not updating


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
_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list