2016-07-07 17 views
1

12個の画像があります。私はImageJ/FIJIで処理しています。次に、すべての画像に対して、2923779のサイズ(ポイントあたりの面積__ピクセル^ 2)のグリッド(Analyze - > Tools - > Gridを使用)を均一に作成しました。 それは次のようになります。ImageJ/FIJIを使用してグリッド内のすべての要素の画像をトリミングする方法

enter image description here

は、私は何をしたい、グリッドのすべての要素に応じて、上記画像のそれぞれをトリミングして、ファイルなど、すべての作物を保存することです。 どうすればいいですか?

上記のいずれかのファイルをhere(160MB)からダウンロードできます。

答えて

2

grid.java hereのコードを理解する必要があります。 ;)

dir = getDirectory("the directory with all your files"); 
files = getFileList(dir); 
out = getDirectory ("Select output directory"); 
number = lengthOf(files); // normally 12 in your case 
i=0; 
while (i < number) { 
    // write a function to extract the x and y coordinates, the width and the height of each rectangle of your grid. For that, you have to understand the code of grid.java to understand how you can have the coordinates of each rectangle. 
    listcoordinates = yourfunction(files[i], 2923779);// return a vector of (x0, y0, width0, height0, x1, y1, etc...) => x= x coordinate on the top left of the square, y= y coordinate on the top left of the square 
    for(j=0; j<lengthOf(listcoordinates); j+4) //foreach coordinate that you extract 
    { 
     makeRectangle(listcoordinates[j], listcoordinates[j+1], listcoordinates[j+2], listcoordinates[j+3]); 
     run("Duplicate...", "title=blabla"+ i + j +".tif"); 
     saveAs("Tiff", out+ "blabla" + i + j + ".tif"); 
    } 
} 

幸運:マクロで

関連する問題