[Insight-users] warping a clound of points when the target landmarks form a straight line
Nick Tustison
ntustison at wustl.edu
Wed Jul 6 18:51:44 EDT 2011
RIght, so I wrote the BSplineControlPointImageFunction to do that. I
imagine
that you should be able to copy those B-spline classes from the
developmental
version to your local repository and things should work seemlessly.
So you would want to do as you did before with the
BSplineScatteredDataPointSetToImageFilter,
i.e.
typedef itk::BSplineScatteredDataPointSetToImageFilter<InputPointSetType,
OutputImageType> BSplineFilterType;
typename BSplineFilterType::Pointer bsplineFilter =
BSplineFilterType::New();
bsplineFilter->SetInput(
// set the rest of the parameters.
bsplineFilter->SetGenerateOutputImage( false ); // We don't want to
evaluate the output sampled b-spline object but we still want to generate
the fitting control points (PhiLattice).
bsplineFilter->Update();
typedef itk::BSplineControlPointImageFunction<OutputImageType>
BSplineFunctionType;
typename BSplineFunctionType::Pointer bsplineFunction =
BSplineFunctionType::New();
bsplineFunction->SetInput( bsplineFilter->GetPhiLattice() );
Then you should be able to call Evaluate() at any continuous point in your
domain.
Note that generating the sampled output in the bsplineFilter is going to be
magnitudes faster due to certain assumptions that can be made for regularly
sampling
the domain for evaluation versus the random sampling case which is accounted
for in the bsplineFunction. However, sometimes that's necessary which is
why
I wrote that function class.
Let me know if you have any further questions,
Nick
2011/7/6 Ramón Casero Cañas <rcasero at gmail.com>
> On 20/06/11 14:51, Ramón Casero Cañas wrote:
>
>>
>> Yes, the correspondence is one-to-one. I had actually bumped into your
>> itk::**BSplineScatteredDataPointSetTo**ImageFilter class, but I hadn't
>> realised it can be used for warping. Thanks for the pointer, I'll
>> definitely give it a try!
>>
>
>
> Hi Nick,
>
> Sorry for the delay, I have been out of my office.
>
> I have been trying to make this work, and I have bumped into a problem.
>
> As you suggested, I define the warp as an R^3 -> R^3 mapping.
>
> x -> (y-x)
>
> where x, y are the source, target landmarks, respectively.
>
> Now I have an image where each voxel is the interpolated value of the warp
> field.
>
> How can I sample the image at specific points? What I want, in the end, is
> a function
>
>
> yi = bspline_warp(x, y, xi)
>
> where xi are some points to be warped to yi.
>
>
> In the documentation of ITK v4.0, there's a class
> BSplineControlPointImageFuncti**on
>
> http://www.itk.org/Doxygen/**html/classitk_1_**
> 1BSplineControlPointImageFunct**ion.html#details<http://www.itk.org/Doxygen/html/classitk_1_1BSplineControlPointImageFunction.html#details>
>
> that seems to be ready for this. However, in the current stable release
> v3.20, that class is not present
>
> http://www.itk.org/Doxygen320/**html/files.html<http://www.itk.org/Doxygen320/html/files.html>
>
> Is there a nice way of doing the sampling without having to move to the
> development release of ITK?
>
> Best regards,
>
>
> Ramon.
>
> --
> Dr. Ramón Casero Cañas
>
> Computational Biology
> Department of Computer Science
> University of Oxford
> Wolfson Building, Parks Rd
> Oxford OX1 3QD
>
> tlf +44 (0) 1865 610737
> web http://web.comlab.ox.ac.uk/**people/Ramon.CaseroCanas<http://web.comlab.ox.ac.uk/people/Ramon.CaseroCanas>
> photos http://www.flickr.com/photos/**rcasero/<http://www.flickr.com/photos/rcasero/>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110706/4a5b27bb/attachment.htm>
More information about the Insight-users
mailing list