[Insight-users] Re: [Insight-developers] question about adding a
user-defined transformation (for registration)
Luis Ibanez
luis.ibanez at kitware.com
Thu Oct 11 16:34:11 EDT 2007
Hi Dan,
Please look at the header file:
Insight/Code/Common/itkTranslationTransform.txx
http://www.itk.org/cgi-bin/viewcvs.cgi/Code/Common/itkTranslationTransform.txx?annotate=1.30&root=Insight
You will find the following code
A) TransformPoint() method in lines 123-132:
// Transform a point
template<class TScalarType, unsigned int NDimensions>
typename TranslationTransform<TScalarType, NDimensions>::OutputPointType
TranslationTransform<TScalarType, NDimensions>::
TransformPoint(const InputPointType &point) const
{
return point + m_Offset;
}
B) GetJacobian() method in lines 179- 193
// Compute the Jacobian in one position
template<class TScalarType, unsigned int NDimensions>
const typename TranslationTransform<TScalarType,
NDimensions>::JacobianType &
TranslationTransform< TScalarType, NDimensions >::
GetJacobian( const InputPointType & ) const
{
this->m_Jacobian.Fill( 0.0 );
for(unsigned int i=0; i<NDimensions; i++)
{
this->m_Jacobian(i,i) = 1.0;
}
return this->m_Jacobian;
}
These are the lines in the current CVS version of ITK.
They may look slightly different if you are using an
older version.
Regards,
Luis
-----------------------
Dan Koppel wrote:
> Hi Luis,
> I am trying to follow your advice to rewrite the TransformPoint() and
> GetJacobian() functions contained in the class TranslationTransform. I
> am looking at the file itkTranslationTransform.txx which is the only one
> that I can see defining the TranslationTransform class. Perhaps this is
> the wrong file, I don't know. However, the 2 functions you mention are
> not defined here. Could you please tell me which file would be the
> correct one to modify?
>
> Thanks very much,
> Dan
>
> */Luis Ibanez <luis.ibanez at kitware.com>/* wrote:
>
>
> Hi Dan,
>
>
> Welcome to ITK !
>
>
> --
>
> If you are asking for the procedure for contributing new
> classes to ITK, please read the following Wiki page:
> http://www.itk.org/Wiki/ITK_Procedure_for_Contributing_New_Classes_and_Algorithms
>
>
> If you are asking about how to write your own customized
> Transform, then the easy way is indeed to start by following
> the model of the Translation transform and to only implement
> the TransformPoint() method.
>
> At that level you will be able to use the Transform with optimizers
> that do not require Derivatives of the CostFunction (Image Metric).
> (for example OnePlusOneEvolutionaryOptimizer and AmoebaOptimizer).
>
> Once you get that to work, you can add the GetJacobian() method.
> That method will make possible for your Transform to be used with
> optimizers that require cost function derivatives.
>
>
> Please let us know if you run into specific problems
> when writing your new Transform.
>
>
>
> Thanks
>
>
> Luis
>
>
>
> -------------------
> Dan Koppel wrote:
> > Hello All,
> > I am new to ITK and am interested in adding my own (user-defined)
> > transformation for use in registering images. I am looking at the
> file
> > "itkTranslationTransform.txx" for guidance. However, it seems fairly
> > involved. Can anybody tell me what the standard procedure (if
> any) is
> > for including new user-defined registration transformations (ie.
> image
> > warping)?
> >
> > Thanks in advance,
> > Dan
> >
> >
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Insight-developers mailing list
> > Insight-developers at itk.org
> > http://www.itk.org/mailman/listinfo/insight-developers
>
>
> ------------------------------------------------------------------------
> Be a better Globetrotter. Get better travel answers
> <http://us.rd.yahoo.com/evt=48254/*http://answers.yahoo.com/dir/_ylc=X3oDMTI5MGx2aThyBF9TAzIxMTU1MDAzNTIEX3MDMzk2NTQ1MTAzBHNlYwNCQUJwaWxsYXJfTklfMzYwBHNsawNQcm9kdWN0X3F1ZXN0aW9uX3BhZ2U-?link=list&sid=396545469>from
> someone who knows.
> Yahoo! Answers - Check it out.
More information about the Insight-users
mailing list