微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何使用 ImageJ 宏量化线条形状

如何解决如何使用 ImageJ 宏量化线条形状

我想量化蝴蝶翅膀上一条线的形状,它可以从非常直到类似于景观中的地平线,或类似于图表(每个 x 值只有 1 y 值) ),尽管总体方向各不相同。我的想法是使用徒手工具来追踪感兴趣的线,然后让 ImageJ 宏对其进行量化(自动化这可能很棘手,因为有许多线状结构)。两个特质对我来说似乎很有用;

  1. 绘制的线的长度与端点之间的直线的比例。
  2. 线条的“分散”,例如在 Directionality 插件中计算的。

其他特征,例如在连接极端的直线下方或下方的线的比例也可能有用。 这怎么编码?我正在构建一个交互式宏,提示测量开放图像的各种特征。 希望以下(非功能性)代码能够传达我正在尝试做的事情。

//line shape analysis
run("Select None");
setTool("free hand");
waitForUser("Trace the line between point A and B");
length= measure();
String command = "Directionality";
new PlugInFilterRunner(da,command,"nbins=60,start=-90,method=gradient");
get data...

//to get distance between points A and B
run("Select None");
    setTool("multipoint");
    waitForUser("distances","Click on points A and B  \nAfter they appear,you can click and drag them if you need to readjust.");
    getSelectionCoordinates(xCoordinates,yCoordinates);
 
    xcoordsp = xCoordinates;
    ycoordsp = yCoordinates;
makeLine(xcoordsp[0],ycoordsp[0],xcoordsp[1],ycoordsp[1]);
    List.setMeasurements;
    StrLength = List.getValue("Length");

我曾在网上寻找解决方案,但对这个相对简单的问题却发现很少。

亲切的问候, 弗里克

解决方法

这里有一个简单的解决方案,用于确定直线与品脱 A 和 B 之间的直线偏离的程度。“直线度”是两个度量之间的比例。

    // To meausure line length to compare to length of straight line aka Euclidean distance
    run("Select None");
    setTool("polyline");
    waitForUser("Trace the line between point V5 and V3 by clickinmg at each corner finish by double click"); // Points V5 and V3 refer to point A and B  It can be adjusted 
    run("Measure");
    getStatistics(Perim);
    FLR=Perim; // FLR For forewing lenght real

    // to get Euclidian distance between points A and B
    run("Select None");
    setTool("multipoint");
    waitForUser("Distances","Click on points A and B  \nAfter they appear,you can click and drag them if you need to readjust.");
    getSelectionCoordinates(xCoordinates,yCoordinates); 
    xcoordsp = xCoordinates;
    ycoordsp = yCoordinates;
    makeLine(xcoordsp[0],ycoordsp[0],xcoordsp[1],ycoordsp[1]);
    List.setMeasurements;
    FLS = List.getValue("Length"); // FLS For forewing length straight
    }

如果有更复杂的线路参数,我将不胜感激

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。