Seg3D icon indicating copy to clipboard operation
Seg3D copied to clipboard

different interpolation method with the polyline tool

Open jessdtate opened this issue 7 years ago • 1 comments

We get intermittent requests for cubic and other interpolation schemes with the polyline too. This is something that a third party implemented in Seg3D 1, and I think it is in corview. This is the text of the latest request.

I would like to recommend adding an option/function/button with the polyline that allows you to create a bicubic interpolation between the points of the polyline. For example, a user would place something like 15-20 points along a curved border (which would normally create a relatively linear-looking ROI) and then the user would click on a bicubic interpolation button. The polygon would then become a nice, smooth bicubic interpolation creating a better approximation of a given curved border and saving considerable time in the process. The user would then fill-in the curved line to create their new, more accurate mask layer. I would also recommend a 'revert' feature that will revert back to the original linear polyline to allow for adjustments, such as re-positioning points or adding points to better deal with very tight curves.

jessdtate avatar Sep 21 '17 22:09 jessdtate

From Marcus Bobar, a Seg3D user.

Recently, I've developed a couple different algorithms in MATLAB using a piece-wise periodic spline curve interpolation (link and some info below) with great results and I think that it could be applicable to a potential algorithm in Seg3D. You just need to have the points in order and the first and last points be the same. I assume the language in which Seg3D is coded is different than MATLAB, but it seems like the algorithm should be adaptable without too much trouble. What I've done once I have the curve and the break points, is express the piece-wise function evenly around the curve for a number of points and then I used an 'in-polygon' function (link below) to create a mask for the pixel points that lie inside the curve. I'm an ok programmer at best and even with my average skills the algorithm was relatively quick to run for a given ROI.

I'm passing along this info because: A. Our lab could really, really use interpolation to create curved borders for cardiac MR images more quickly; B. I'm sure you are always busy just like I am, so I figure some preliminary work being done is helpful; C. We would love you forever if you can incorporate interpolation and I promise to mention you in the next couple papers we right this year for your efforts. Thank you in advance for your consideration.

Spline Curve:

https://www.mathworks.com/help/curvefit/cscvn.html

"curve = cscvn(points) returns a parametric variational, or natural, cubic spline curve (in ppform) passing through the given sequence points(:j), j = 1:end. The parameter value t(j) for the jth point is chosen by Eugene Lee's [1] centripetal scheme, i.e., as accumulated square root of chord length.

If the first and last point coincide (and there are no other repeated points), then a periodic cubic spline curve is constructed. However, double points result in corners."

In-polygon:

https://www.mathworks.com/matlabcentral/fileexchange/10391-fast-points-in-polygon-test

jessdtate avatar May 17 '18 06:05 jessdtate