2016-07-07 6 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"); 
    } 
} 

행운을 빕니다)