修改MRI_Wound_Healing_Tool.ijm细胞划痕插件,实现批处理,相关参数设定参考插件说明http://dev.mri.cnrs.fr/wiki/imagej-macros/Wound_Healing_Tool
将下面代码保存为txt或ijm,imageJ里面Macro–>Plugins–>Macros–>Run–>保存的脚本,然后选择图片所在目录,软件会自动分析。
可能有些图片会有多个结果,原因是细胞过于稀疏或者有空白,也或者划痕区域有杂点等,这种情况下可用插件确认问题,手动进行分析。
软件毕竟不是人脑,程序化操作不可尽信,有疑惑可以double check。
var helpURL = "http://dev.mri.cnrs.fr/wiki/imagej-macros/Wound_Healing_Tool"
var varianceFilterRadius = 20;
var threshold = 50;
var radiusOpen = 4;
var minSize = 10000;
var methods = newArray("variance", "find edges");
var method = "variance";
var measureInPixelUnits = false;
function thresholdVariance() {
run("Variance...", "radius=" + varianceFilterRadius + " stack");
run("8-bit");
setThreshold(0,threshold);
}
function thresholdFindEdges() {
run("Find Edges", "stack");
run("Invert", "stack");
setAutoThreshold("Percentile dark");
}
dir=getDirectory("Select the source directory");
list=getFileList(dir);
Array.sort(list);
###修改划痕图片对应格式,此处为jpg,其它对应修改
for(i=0;i<list.length;i++){
filename=dir+list[i];
if(endsWith(filename,"jpg")){
open(filename);
run("Select None");
getPixelSize(unit, pixelWidth, pixelHeight);
run("Duplicate...", "duplicate");
setForegroundColor(0, 0, 0);
setBackgroundColor(255, 255, 255);
roiManager("reset")
roiManager("Associate", "true");
if (method=="variance")
thresholdVariance();
else
thresholdFindEdges();
run("Convert to Mask", " black");
resetThreshold();
run("Invert", "stack");
for (j=0; j<radiusOpen; j++) {
run("Dilate", "stack");
}
for (j=0; j<radiusOpen; j++) {
run("Erode", "stack");
}
run("Select All");
run("Enlarge...", "enlarge=-" + radiusOpen + " pixel");
run("Invert", "stack");
run("Analyze Particles...", "size="+minSize+"-Infinity circularity=0.00-1.00 show=Nothing add stack");
close();
if (measureInPixelUnits)
run("Set Scale...", "distance=0 known=0 pixel=1 unit=pixel");
roiManager("Measure");
roiManager("Show None");
roiManager("Show All");
close();
}
}
请问输出的结果框为什么是空白呢?谢谢!
是不是微信解决了?一个是需要自己修改阈值,一个是图片尺寸(像素),没有解决的话进群讨论:https://www.jingege.wang/jingle_science/