Montage with (x, y) coordinates in ImageJ

Hi,
I have worked with montages before in image J, but as far as I know, it is only possible to put images with a given number of rows and columns.
Is there a way to create a montage with the coordinates of each image ?
I have tried sorting my coordinates in x and y, and calculating which direction should be sorted first depending on the final aspect ratio, and the order of processing, etc., but I have cases where it is too limited to just count on a grid montage rather than “floating” images.

Thanks.

Hi,
You could create a large image and iterate over your source images, copy them and paste them at known location using Image.paste(x,y);
In the following macro the images are placed randomly, you could use an array with your known positions.
J.

setBatchMode(1);
run("MRI Stack");
source=getImageID;
s=nSlices;
newImage("Untitled", "8-bit ramp", 1000, 1000, 1);
target=getImageID;
for (i=0;i<s;i++){
selectImage(source);
setSlice(i+1);
Image.copy;
selectImage(target);
Image.paste(getWidth*random(),getHeight*random());
}
setBatchMode(0);

Thanks, that’s actually what I ended up doing right after asking the question.
I am wondering if this gives the same result as a montage, or if the MontageMaker has the additional benefit of normalizing the images.

1 Like