imagej - 在Imagej中将曲线分割成等长段
问题描述
我编写了一个宏,它给出了一条直线,将其分成等长的段,并生成一系列垂直线穿过每个段的起点/终点。宏是(对不起,如果它看起来很基本,但我只是在学习这些东西......):
getLine(x0,y0,x11,y11,width);
dx = x11 -x0;
dy = y11 -y0;
xstep = dx/11;
ystep = dy/11;
// Interpolate segment points
xs=x0 - 1xstep
x1 = x0 + 1xstep;
x2 = x0 + 2xstep;
x3 = x0 + 3xstep;
x4 = x0 + 4xstep;
x5 = x0 + 5xstep;
x6 = x0 + 6xstep;
x7 = x0 + 7xstep;
x8 = x0 + 8xstep;
x9 = x0 + 9xstep;
x10 = x0 + 10xstep;
x11 = x0 + 11xstep;
x12 = x0 + 12xstep;
x13 = x0 + 13xstep
ys=y0 - 1ystep
y1 = y0 + 1ystep;
y2 = y0 + 2ystep;
y3 = y0 + 3ystep;
y4 = y0 + 4ystep;
y5 = y0 + 5ystep;
y6 = y0 + 6ystep;
y7 = y0 + 7ystep;
y8 = y0 + 8ystep;
y9 = y0 + 9ystep;
y10 = y0 + 10ystep;
y11 = y0 + 11ystep;
y12 = y0 + 12ystep;
y13 = y0 + 13ystep;
// Create sections at regular intervals along the strait line
makeLine(xs, ys, x1, y1);
Roi.setStrokeColor(255,126,0);
run(“Rotate…”, “angle=90”);
roiManager(“Add”);
makeLine(xs, ys, x3, y3);
Roi.setStrokeColor(255,126,0);
run(“Rotate…”, “angle=90”);
roiManager(“Add”);
makeLine(x0, y0, x4, y4);
Roi.setStrokeColor(255,126,0);
run(“Rotate…”, “angle=90”);
roiManager(“Add”);
makeLine(x1, y1, x5, y5);
Roi.setStrokeColor(255,126,0);
run(“Rotate…”, “angle=90”);
roiManager(“Add”);
makeLine(x2, y2, x6, y6);
Roi.setStrokeColor(255,126,0);
run(“Rotate…”, “angle=90”);
roiManager(“Add”);
makeLine(x3, y3, x7, y7);
Roi.setStrokeColor(255,126,0);
run(“Rotate…”, “angle=90”);
roiManager(“Add”);
makeLine(x4, y4, x8, y8);
Roi.setStrokeColor(255,126,0);
run(“Rotate…”, “angle=90”);
roiManager(“Add”);
makeLine(x5, y5, x9, y9);
Roi.setStrokeColor(255,126,0);
run(“Rotate…”, “angle=90”);
roiManager(“Add”);
makeLine(x6, y6, x10, y10);
Roi.setStrokeColor(255,126,0);
run(“Rotate…”, “angle=90”);
roiManager(“Add”);
makeLine(x7, y7, x11, y11);
Roi.setStrokeColor(255,126,0);
run(“Rotate…”, “angle=90”);
roiManager(“Add”);
makeLine(x8, y8, x12, y12);
Roi.setStrokeColor(255,126,0);
run(“Rotate…”, “angle=90”);
roiManager(“Add”);
makeLine(x10, y10, x12, y12);
Roi.setStrokeColor(255,126,0);
run(“Rotate…”, “angle=90”);
roiManager(“Add”);
makeLine(x0, y0, x11, y11);
Roi.setStrokeColor(255,126,0);
roiManager(“Add”);
run(“Measure”);
在某些情况下,我需要使用分段线/折线获得相同的结果。为了更好地“模拟”我想要测量的对象的形状,我将样条曲线拟合到我的折线。这很容易做到。如何将样条线分成相等的段并在每个样条的开始/结束处运行一条垂直线?任何帮助是极大的赞赏。到目前为止,这就是我拼凑起来的:
makeLine(x100, y100, x101, y101, x103, y103);
run("Properties… ", “stroke=red”);
roiManager(‘add’);
run(“Fit Spline”);
run("Properties… ", “stroke=green”);
roiManager(‘add’);
run(“Measure”);
尼诺
解决方案
推荐阅读
- azure-active-directory - 使用 msal.js 异步向租户权限和 Microsoft 个人帐户权限进行身份验证时出现 nonce_mismatch_error
- swift - 如何获得特定的日期格式?
- terraform - 提供者变量是否可以在 terraform 中使用?
- r - 如何在整齐的数据行之间进行数学运算?
- javascript - 如何简洁地创建数组的 JavaScript 数组,每个数组具有不同的长度(每行具有不同的指定长度)?
- java - java的内存使用情况
- mysql - MySQL舍入怪异
- c# - 任何人都可以帮我解决这个 StackOverFlow.Exception 吗?
- python - 当我尝试交叉编译 Qt 项目时出现 Python 错误
- css - Bootstrap col 内的传单没有占据全高