pixFRET - 运行时间推移图像的插件//循环?

时间:2013-05-27 20:29:12

标签: image-processing macros imagej timelapse

我刚刚开始使用ImageJ(因此没有太多的宏编程经验)来分析我的显微镜图片。 为了生成FRET像素逐像素图像,我们正在使用插件:pixFRET来校正光谱流失。这个插件需要一堆3个图像才能工作:FRET,Do​​nor,Acceptor。到目前为止,我必须自己打开每张照片,这对于大时间堆栈(> 1000张图像)来说真的很不方便。我正在寻找一种循环插件或创建某种宏来实现此目的的方法。

我的数据结构的简短描述: workfolder \ filename_t001c1(频道1图像 - 时间点001的捐赠者), filename_t001c2(频道2图像 - 时间点001处的FRET), ... t001c3(可以忽略) ... t001c4(通道4图像 - 时间点001处的接受器)。

我必须在每个时间点创建一个C2 / C1 / C4堆栈,由pixFRET自动分析(带有设置参数),结果应保存在输出文件夹中。

我很感激每一个建议,因为我最大的问题是整个堆栈生成/ pixFRET分析的循环(现在只能做这本手册)。

由于 大卫

2 个答案:

答案 0 :(得分:1)

我没有找到直接包含pixFRET PlugIn的参数和命令的方法。但是,在这里我展示了一个与IJ_Robot一起工作的工作来添加这些命令。我还包括一些东西,根据时间序列的第一张图像执行相机通道的对齐。

   // Macro for creating time resolved pixFRET images with a alignment of both cameras used
// a separate setting file is required for pixFRET -> put this into the same folder as the pixFRET plugin
// the background region has to be set manually in this macro
// IJ_robot uses cursor movements - DO NOT move the cursor while excuting the macro + adjust IJ_robot coordinates when changing the resolution/system.




dir = getDirectory("Select Directory");
list = getFileList(dir);

//single alignment
 run("Image Sequence...", "open=[dir] number=2 starting=1 increment=1 scale=100 file=[] or=[] sort");
rename(File.getName(dir));
WindowTitle=getTitle()
rename(WindowTitle+toString(" Main"))
MainWindow=getTitle()
NSlices=getSliceNumber()
xValue=getWidth()/2
yValue=getHeight()/2

//setTool("rectangle");
makeRectangle(0, 0, xValue, yValue);
run("Align slices in stack...", "method=5 windowsizex="+toString(xValue*2-20)+" windowsizey="+toString(yValue*2-20)+" x0=10 y0=10 swindow=0 ref.slice=1 show=true");
selectWindow("Results");

XShift=getResult("dX", 0);
YShift=getResult("dY", 0);


File.makeDirectory(toString(File.getParent(dir))+toString("\\")+"test"+" FRET");

for(i=0;i<list.length;i+=4){
open(dir+list[i+1]);
run("Translate...", "x=XShift y=YShift interpolation=None stack");

open(dir+list[i]);


open(dir+list[i+3]);
run("Translate...", "x=XShift y=YShift interpolation=None stack");

wait(1000);
run("Images to Stack", "name=Stack title=[] use");
selectWindow("Stack");
makeRectangle(15, 147, 82, 75); //background region
run("PixFRET...");
run("IJ Robot", "order=Left_Click x_point=886 y_point=321 delay=500 keypress=[]");
run("IJ Robot", "order=Left_Click x_point=874 y_point=557 delay=500 keypress=[]");
selectWindow("NFRET (x100) of Stack");

save(toString(File.getParent(dir))+toString("\\")+"test"+" FRET"+toString(i) +".tif");

selectWindow("Stack");
close();
selectWindow("FRET of Stack");
close();

selectWindow("NFRET (x100) of Stack");
close();
run("IJ Robot", "order=Left_Click x_point=941 y_point=57 delay=300 keypress=[]");
}

感谢您的帮助Jan.如果您能想到一种直接调用这些pixFRET命令而不是使用Ij_robot的方法,请告诉我。

答案 1 :(得分:0)

this tutorialFiji (is just ImageJ)作为起点,并使用宏录制器(插件&gt;宏&gt;记录... )来获取必要的命令。

您的宏代码可能如下所示:

function pixfret(path, commonfilename) {
    open(path + commonfilename + "c2");
    open(path + commonfilename + "c1");
    open(path + commonfilename + "c4");
    run("Images to Stack", "name=Stack title=[] use");
    run("PixFRET"); // please adjust this to your needs
}

setBatchMode(true); 
n_timepoints = 999;
dir = "/path/to/your/images/";
for (i = 0; i < n_timepoints; i++)
    pixfret(dir, "filename_t" + IJ.pad(i, 4));
setBatchMode(false);

希望有所帮助。