tueimage / gryds

A Python package for geometric transformations of images for data augmentation in deep learning
https://tue-image.nl
GNU General Public License v3.0
63 stars 14 forks source link

how to get corresponding landmarks using existing BSpline deformation grid #4

Closed RossoneriMaldini closed 3 years ago

RossoneriMaldini commented 4 years ago

Thanks for sharing! We want to apply existing BSpline deformation grid to some landmarks of source image, how can we get corresponding points after this deformation grid.

keppenhof commented 4 years ago

You can apply a transformation to points by calling the transform object like a function. Assuming your points are in x, and your image in im,

t = gryds.BSplineTransformation(your_grid)
y = t.transform(x, scale=im.shape)

will put the transformed points in y

The image shape is necessary here because the transformation object needs to know where to place the control points.