1. 免疫组化AOD平均光密度批量分析
使用脚本之前请仔细学习视频教程,相关参数需要根据实际图片修改,主要是阈值范围和set measurement需要勾选的参数:
dir=getDirectory("Select the source directory");
list=getFileList(dir);
Array.sort(list);
for(i=0;i<list.length;i++){
filename=dir+list[i];
if(endsWith(filename,"jpg")){
open(filename);
run("8-bit");
run("Calibrate...", "function=[Uncalibrated OD] unit=[Gray Value] text1=[165.76 153.57 ] text2=");
setThreshold(0, 220, "raw");
//run("Threshold...");
run("Measure");
selectWindow(list[i]);
close();
}
}
2. 免疫荧光MFI平均荧光强度批量分析
需要根据自己的图片调整阈值范围和图片扩展名。
dir=getDirectory("Select the source directory");
list=getFileList(dir);
Array.sort(list);
for(i=0;i<list.length;i++){
filename=dir+list[i];
if(endsWith(filename,"tif")){
open(filename);
run("8-bit");
setAutoThreshold("Default dark");
//run("Threshold...");
setThreshold(20, 255); //设置Threshold选出所有包含细胞的区域
run("Measure");
selectWindow(list[i]);
run("Close"); //关闭图片窗口
}
}
3. 图片背景不干净怎么办?批量进行图片背景校正并保存
参考5,主要需要修改的就是文件扩展名和高斯模糊的sigma值
dir=getDirectory("Select the source directory");
list=getFileList(dir);
Array.sort(list);
///运行前在目录下新建一个文件夹process
for(i=0;i<list.length;i++){
filename=dir+list[i];
if(endsWith(filename,"tif")){
open(filename);
run("Duplicate...", "title=2222.tif");
run("Gaussian Blur...", "sigma=50");
imageCalculator("Subtract", list[i],"2222.tif");
selectWindow("2222.tif");
close();
selectWindow( list[i]);
saveAs("tif", dir+"/process/"+ list[i]);
close();
}
}
4.细胞计数批量宏命令脚本
参考5,主要需要修改的就是文件扩展名和阈值范围
dir=getDirectory("Select the source directory");
list=getFileList(dir);
Array.sort(list);
for(i=0;i<list.length;i++){
filename=dir+list[i];
if(endsWith(filename,"tif")){
open(filename);
run("8-bit");
setAutoThreshold("Default dark");
//run("Threshold...");
setThreshold(18, 255);
run("Convert to Mask");
run("Fill Holes");
run("Watershed");
run("Analyze Particles...", "size=200-Infinity show=Nothing summarize");
selectWindow( list[i]);
close();
}
}
5.细胞图片背景校正&细胞计数批量宏命令脚本恩
dir=getDirectory("Select the source directory");
list=getFileList(dir);
Array.sort(list);
for(i=0;i<list.length;i++){
filename=dir+list[i];
if(endsWith(filename,"tif")){
open(filename);
run("Duplicate...", "title=2222.tif");
run("Gaussian Blur...", "sigma=50");
imageCalculator("Subtract", list[i],"2222.tif");
selectWindow( list[i]);
run("8-bit");
setAutoThreshold("Default dark");
//run("Threshold...");
setThreshold(18, 255);
run("Convert to Mask");
run("Fill Holes");
run("Watershed");
run("Analyze Particles...", "size=200-Infinity show=Nothing summarize");
selectWindow("2222.tif");
close();
selectWindow( list[i]);
close();
}
}
6. 细胞划痕图片批量定量分析
需要根据自己的图片调整阈值和图片扩展名。
//Analyze wound healing
dir=getDirectory("Select the source directory");
list=getFileList(dir);
Array.sort(list);
for(i=0;i<list.length;i++){
filename=dir+list[i];
if(endsWith(filename,"tif")){
open(filename);
run("8-bit");
run("Enhance Contrast...", "saturated=0.5 normalize");
run("Find Edges");
setAutoThreshold("Default");
//run("Threshold...");
setThreshold(0, 26);
//setThreshold(0, 26);
setOption("BlackBackground", false);
run("Convert to Mask");
run("Fill Holes");
run("Analyze Particles...", "size=50000-Infinity summarize");
selectWindow(list[i]);
close(); //关闭图片窗口
}
}
7. 免疫荧光多通道图片批量Merge
需要根据自己的荧光通道进行定义(搜索red_label),参考格式把这边对应都要修改
////Merge channels
var red_label = "-1.tif"; //edu
var blue_label = "-2.tif"; //nuclear
path = getDirectory("Choose a Directory to proess");
list = getFileList(path);
for (i = 0; i < list.length; i++) {
if(endsWith(list[i],red_label)){
label = substring(list[i], 0,1); //Get the different title labels
print(label);
open(path + label+red_label);
open(path + label+blue_label );
image_r = label+red_label;
image_b = label+blue_label;
run("Merge Channels...", "c1="+image_r+ " c3="+image_b);
saveAs("tif", path+ label);
saveAs("tif", path+"merge/"+ label);
run("Close");
}
}