[Insight-users] DenseFiniteDifferenceImageFilter and Pipelines
Tom Vercauteren
tom.vercauteren at m4x.org
Thu Aug 10 04:44:07 EDT 2006
[Text only version... I forgot insight-users mail were better in plain text]
Hi Luis,
Thanks for your reply. Rereading my mail, convinced myself I wasn't
really clear. I'll do my best to make myself clearer this time.
Let's look at the DemonsRegistrationFilter. Suppose I want to change the
DemonsRegistrationFilter::ApplyUpdate(TimeStepType dt) function using
some ITK filters. To make it simple, we can simply change (within this
function) the call to Superclass::ApplyUpdate(dt) by a combination of
a ShiftScaleImageFilter and an AddImageFilter:
In DemonsRegistrationFilter::ApplyUpdate(TimeStepType dt) instead of:
this->Superclass::ApplyUpdate(dt);
Use the following:
// Without the call to this->GetUpdateBuffer()->Modified() the shiftscale
// and add filters are only updated during the first iteration
// this->GetUpdateBuffer()->Modified();
//replace the Superclass::ApplyUpdate(dt) by a scale and an add filter
typedef ShiftScaleImageFilter<
DeformationFieldType, DeformationFieldType> ScalerType;
typedef AddImageFilter<
DeformationFieldType, DeformationFieldType,
DeformationFieldType> AdderType;
ScalerType::Pointer scaler = ScalerType::New();
AdderType::Pointer adder = AdderType::New();
scaler->SetScale(dt);
scaler->SetShift(0.0);
scaler->SetInput( this->GetUpdateBuffer() );
adder->SetInput( scaler->GetOutput() );
adder->GraftOutput( this->GetOutput() );
adder->Update();
// Region passing stuff
this->GraftOutput( m_Adder->GetOutput() );
If we don't explicitely call this->GetUpdateBuffer()->Modified()
before the adder->Update(), then this adder->Update() is only
effective ly computed during the first iteration.
Best regards,
Tom Vercauteren
More information about the Insight-users
mailing list