[Insight-users] Specifying landmarks in the ThinPlateSplineWarp.cxx example?
motes motes
mort.motes at gmail.com
Sun Aug 16 17:04:38 EDT 2009
On Sun, Aug 16, 2009 at 9:58 PM, Luis Ibanez <luis.ibanez at kitware.com>wrote:
>
> Hi Motes,
>
> Integrating this into the registration process is straightforward.
>
> The ThinPlateSpline is a Transform, so you just need to connect it
> to the RegistrationMethod in the same way that you would have
> used an AffineTransform or a BSplineDeformableTransform.
>
> The only caveat is that you should use Optimizers that do not
> require derivatives, for example:
>
>
> - AmoebaOptimizer or
> - OnePlusOneEvolutionaryOptimizer
>
>
> This is because the ThinPlateSpline transforms have not
> implemented yet the methods that compute Jacobians.
>
>
Thanks for the tip, I will see if I can get a test up and running!
>
> ---
>
> Your approach for implementing a BSplineDeformableTransform
> that also moves the Nodes, can easily be achieved by combining
> two BSplineDeformableTransforms, both of them with the same
> number of Nodes. The first transform could be used for representing
> the locations of the nodes of the second transform, while the second
> transform represents deformation vectors in the usual BSpline context.
>
> You could put these two transforms together inside a new Transform
> class, and then plug that larger transform class into the Registration
> framework.
>
Ok you pretty much lost me with that recipe, I think I need an example to
understand.
You mention that both transforms have the same number of nodes, but as I
wrote earlier I would like to add/remove nodes in the future. How well would
the above approach work with this extension?
I have tried walking through a registration example using the
BSplineDeformableTransform. In each iteration the most important calls as I
understand are:
ResumeOptimization(void)
|-----> GetValueAndDerivative()
|-----> AdvanceOneStep()
|-----> StepAlongGradient()
where:
1) ResumeOptimization
RegularStepGradientDescentBaseOptimizer::ResumeOptimization( void )
[+] Calls the above functions in each interation.
2) GetValueAndDerivative
MeanSquaresImageToImageMetric<TFixedImage,TMovingImage>::GetValueAndDerivative(const
TransformParametersType & parameters, MeasureType &
value, DerivativeType & derivative) const
[+] Here the metric is computed. The similarity measure value between the
fixed and transformed moving image.
3) AdvanceOneStep
RegularStepGradientDescentBaseOptimizer::AdvanceOneStep( void )
[+] The transformed gradient is computed.
4) StepAlongGradient
RegularStepGradientDescentOptimizer::StepAlongGradient( double factor, const
DerivativeType & transformedGradient )
[+] Given the transformed gradient the new deformation vectors
(direction/magnitude) are computed:
ParametersType newPosition( spaceDimension );
for(unsigned int j=0; j<spaceDimension; j++)
{
newPosition[j] = currentPosition[j] + transformedGradient[j] * factor;
}
----------------------------------------------------
But in which of the above steps are the location of the deformation vectors
read/used? I would say that they would be needed in step 3) but from the
code it does not appear so.
I am still having difficulty understand the relation between what happens in
each iteration and the location of the deformation vectors.
>
> Regards,
>
>
> Luis
>
>
>
> ---------------------------------------------------------------------------------------
>
> On Sun, Aug 16, 2009 at 3:04 PM, motes motes <mort.motes at gmail.com> wrote:
>
>>
>>
>> On Sun, Aug 16, 2009 at 5:22 PM, Luis Ibanez <luis.ibanez at kitware.com>wrote:
>>
>>> Hi Motes,
>>>
>>>
>>> "Glimpsing at the source leaves no doubt"
>>>
>>>
>>> If you look at lines 120-130 of the ThinPlateSplineWarp.cxx file:
>>>
>>> while (!infile.eof())
>>> {
>>> infile >> p1[0] >> p1[1] >> p1[2] >> p2[0] >> p2[1] >> p2[2];
>>>
>>> sourceLandMarkContainer->InsertElement( id, p1 );
>>> targetLandMarkContainer->InsertElement( id++, p2 );
>>> }
>>>
>>> You will see that the first three values of the file are assigned
>>> to the X,Y,Z coordinates of the first source landmark, while the
>>> second group of three values is assigned to the X,Y,Z coordinates
>>> of the first landmark in the group of target landmarks.
>>>
>>>
>>> Note that this is different from how we manage
>>> BSplineDeformableTransforms.
>>>
>>> In this ThinPlateSpline example there are no deformation vectors. We use
>>> a group of landmarks in the Fixed image, that map, one-to-one, to
>>> landmarks
>>> in the moving image.
>>>
>>> The triplet ( 180 217 0 ) that you pointed out to in your email,
>>> correspond
>>> indeed to the coordinates of a point in the space of the fixed image.
>>>
>>> It is the point with coordinates: X = 180.0, Y = 217.0, Z = 0.0
>>>
>>>
>>> Regards,
>>>
>>>
>>> Luis
>>>
>>>
>>
>>
>>
>>
>> Ok that makes sense, but how would that be used in a registration context
>> eg. connecting the ThinplateSpline to an optimizer?
>>
>> The source and target landmarks are choosen manually in the example but I
>> am working on a project where this is not possible and the registration
>> process should run automatically.
>>
>>
>>
>> I am therefore still pretty interested in using the
>> BSplineDeformationTransform, but I am still stuck with how to create a
>> non-uniform grid of deformation vectors - if this is even possible with the
>> current implementation?
>>
>>
>> Assume that I have defined a 5*5 grid of deformation vectors. Now I want
>> the deformation vector at location (2,3) to be located at another location,
>> how would that be possible?
>>
>>
>> As I understand the only way to create a non-uniform location of
>> deformation vectors is to change the spacing. But that will only result in
>> non-uniform spacing arcross dimesions and not within each of the dimesions.
>>
>> Am I walking down a dark and lonely path trying to make the current
>> BSplineDeformationTransform more flexible?
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>>
>>>
>>> --------------------------------------------------------------------------------------------
>>> On Sun, Aug 16, 2009 at 2:10 AM, motes motes <mort.motes at gmail.com>wrote:
>>>
>>>> In the ThinPlateSplineWarp.cxx a set of landmarks are read from the file
>>>> LandmarkWarping3Landmarks1.txt which contains this:
>>>>
>>>> 0 0 0 0 0 0
>>>> 180 0 0 180 0 0
>>>> 180 217 0 180 217 0
>>>> 0 217 0 0 217 0
>>>> 0 0 180 0 0 180
>>>> 180 0 180 180 0 180
>>>> 180 217 180 180 217 180
>>>> 0 217 180 0 217 180
>>>> 90 108 90 90 130 90
>>>>
>>>>
>>>>
>>>> As I understand these are 18 landmark points which is actually just
>>>> deformation vectors. So the 3 first values in the third row:
>>>>
>>>> 180 217 0
>>>>
>>>> corresponds to a vector at some location pointing 180 unit in the
>>>> x-direction and 217 units in the y-direction.
>>>>
>>>> But where in the image is this vector located?
>>>>
>>>> Or are the above landmarks just 'regular' points that are interpolated
>>>> by the ThinPlateSpline and not deformation vectors?
>>>>
>>>>
>>>>
>>>> _____________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Please keep messages on-topic and check the ITK FAQ at:
>>>> http://www.itk.org/Wiki/ITK_FAQ
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090816/40df9624/attachment.htm>
More information about the Insight-users
mailing list