A matlab package for ND bezier curves operations
A bezier curve is parametrized by controlPts - which is [N x dim] for N control points of dimension dim. Note that we use matlab matrix ordering, so the first dimension will be treated as 'y' in the 2D case.
Current function support:
bezier.eval
evaluate the curve at many pointsbezier.draw
draw the curve in a image or volumebezier.view
visualize 2D or 3D bezier curves (even multiple curves in the same figure)bezier.explore
explore 2D bezier curves interactively
If you find this code useful, please cite the following paper, for which the code was developed:
Adrian V. Dalca, Giovanna Danagoulian, Ron Kikinis, Ehud Schmidt, Polina Golland
Segmentation of nerve bundles and ganglia in spine MRI using particle filters
MICCAI 2011
@inproceedings{dalca2011segmentation,
title={Segmentation of nerve bundles and ganglia in spine MRI using particle filters},
author={Dalca, Adrian and Danagoulian, Giovanna and Kikinis, Ron and Schmidt, Ehud and Golland, Polina},
booktitle={International Conference on Medical Image Computing and Computer-Assisted Intervention},
pages={537--545},
year={2011},
organization={Springer}
}
Each method has several helpful options, run help +bezier
for more help.
Run beziertest
for thorough examples and to see the extent of possibilities.
For quick use try the following:
- plot of a 2D bezier curve:
t = bezier.eval([1, 2; 5, 5; 7, 4]);
plot(t(:, 1), t(:, 2));
- draw a 2D bezier curve in an image:
vol = bezier.draw([1, 2; 50, 50; 70, 40]);
imagesc(vol); colormap gray;
- visualize a 2D curve directly:
bezier.view([1, 2; 70, 70; 70, 130]);
- visualize a 3D curve directly:
bezier.view([1, 2, 7; 5, 5, 9; 9, 9, 9]);
- explore the curves:
bezier.explore;