[Insight-users] how can I make modification to a filter alrea
dy exists in ITK?
Miller, James V (Research)
millerjv at crd.ge.com
Thu Jul 1 16:18:58 EDT 2004
There are a couple of ways to this.
If the changes are very local, you might consider adding a mode to the
filter and function to control whether
your modifications are used or not. The code ends up looking like
if (m_ControlDeformationSmoothing)
{
do my new code;
}
else
{
do the old code;
}
This allows the same filter/function to be used and the selection of the
method (original, modified) controlled
by the user.
Another option is create a whole new function/filter combination. This is
the approach that used when implementing the
SymmmetricForcesDemonsRegistrationFilter/Function and the
LevelSetMotionRegistratonFilter/Function. The amount of code changed for
these "modifications" to the demons algorithm were substantial enough to
warrent new classes. The drawback to this approach is that if there is a
modification that all three filters can benefit from, then you may need to
make the change in multiple places.
>From what you have written, it sounds like you want to make changes to
PDEDeformableRegistrationFilter::SmoothDeformationField(). You can override
this implementation in a new subclass or patch the original version to
perform in either mode.
There are many variants of the demons algorithm, so I would hesitate to call
your class ModifiedDemonsRegistrationFilter.
Finally, to test your new algorithm, you can either change your local copy
of DeformableRegistration2.cxx to use your new method/filters or you can
create a new example based on the code in DeformableRegistraton2.cxx.
cp DeformableRegistration2.cxx DeformableRegistration2a.cxx
and then edit DeformableRegistration2a.cxx. Then, edit the CMakeLists.txt
file in that direction and add an ADD_EXECUTABLE() line similar to the one
for DeformableRegistration2.cxx. Finally, re-run CMake and build your new
program.
Will you be wanting to submit your modifications to the ITK source tree so
that other researchers can use
them?
-----Original Message-----
From: Guorong Wu [mailto:grwu at sjtu.edu.cn]
Sent: Thursday, July 01, 2004 4:24 AM
To: ITK Mailling List
Subject: [Insight-users] how can I make modification to a filter already
exists in ITK?
hello everyone:
I am planing to make some improvent to demons algorithms[Thirion
98](Registration/DeformableRegistration2.cxx). Demons algorithm may cause
non-uniform deformation field which will oversmooth at the rigion of lower
contrast. My modification includes: 1. control the force field smoothing
according to gradients by add a weight at each iteration; 2. prevent
oversmoothing the deformation field at lower contrast region with
statistical model at each iteration.
So I want write a new filter named ModifiedDemonsRegistrationFilter. I
refer to charpter 13 in ITKSoftwareGuide but not quite clear about how to
do. Since I only want to make some modification of force field and
deformation field which could be computered with original
DemonsRegistrationFilter at each iteration, Should I override
PDEDeformableRegistrationFilter and DemonsRegistrationFunction and make
modification there? And another question, Assuming I have writen the filter,
for example, ModifiedDemonsRegistrationFilter.cxx, Should I rebuild ITK to
make it work or simply put it at my personal directory? Thanks. Hoping for
your reply.
????????Guorong Wu
????????grwu at sjtu.edu.cn
??????????2004-07-01
=============================================================
Guorong Wu
The Department of Computer Science and Technology
Shanghai Jiao Tong University
1954 Huashan RD
Shanghai China
200030
Tel: +86 21 3226 1236 , 6293 2089
=============================================================
More information about the Insight-users
mailing list