// Plugin for ImageJ to create ClockDrop Montage // Input images must be cropped square beforehand // Images should be loaded as a stack // ***EDIT THESE VALUES *** w = 740; // width and height of image stack slices = 180; // number of images to combine (can be less than number in stack) angle=1.5*PI; // start angle, in radians dtheta = 2*PI/slices; // angle increment between consecutive sectors di = 1; // increment between images in stack // ***STOP EDITING*** x0=w/2; // centre of image diag = w/1.4142 // distance to corner from centre orig=getImageID(); // identifier for the image stack newImage("new", "8-bit black", w, w, 1); // create new blank image the same size as the stack new=getImageID(); // identifier for the new blank image selectImage(orig); // select the stack // loop to rotate through 360 degrees // copy adjacent sectors from stack paste into new image for(i=1; i <= slices*di ; i=i+di) { x1 = x0 + diag*sin(angle); if(x1<0) x1=0; if(x1>w) x1=w; y1 = x0 - diag*cos(angle); if(y1<0) y1=0; if(y1>w) y1=w; x2 = x0 + diag*sin(angle+dtheta); if(x2<0) x2=0; if(x2>w) x2=w; y2 = x0 - diag*cos(angle+dtheta); if(y2<0) y2=0; if(y2>w) y2=w; selectImage(orig); setSlice(i); makePolygon(x0,x0,x1,y1,x2,y2); run("Copy"); selectImage(new); makePolygon(x0,x0,x1,y1,x2,y2); run("Paste"); angle = angle + dtheta; }