// @int(label = "Number of Rows:", value=3) numRow // @int(label = "Number of Columns:", value=3) numCol // @double(label = "Image scaling factor:", value=0.5) numScale // @double(label = "Image Width (inches):", value=8.5, description="This is the width in inches that you wish to use for you horizontal field of view.") hFOV // @String(label = "Close stack after?", choices={"Yes", "No"}, style="radioButtonHorizontal") closeStack // @String(label = "Edit stack order?", choices={"Yes", "No"}, style="radioButtonHorizontal") editStack // @String(Label = "Include filename/label?", choices={"filename", "label", "none"}, style="radioButtonHorizontal", description="Note: This will not remove names from a stack that already has names..") fileName // @String(Label = "Include Border?", choices={"Yes", "No"}, style="radioButtonHorizontal") useBorder // Check if a stack is already open, if not, convert the open windows into a stack. if (nSlices<2) { run("Images to Stack", "name=Stack title=[] use"); } // If you want to edit the stack order. if (editStack=="Yes") { run("Stack Sorter"); waitForUser; } // Need the identifyer of the stack stackID=getImageID; // Some image types didn't work so this converts those types to a type that does. stackType = ""+bitDepth; if (stackType=="24") stackType = "RGB"; else if (stackType=="16" || stackType=="32") run("8-bit"); stackType = ""+bitDepth; // Reset scale according to user's preferences. scaleStack(numScale); // Writes filenames on images as inset per user's preferences. if (fileName=="filename") { filenameOnStack(stackID); } if (fileName=="label") { labelOnStack(stackID); } // Make the monage using Mak's setup. maksMontage(numRow,numCol, stackID); montageID=getImageID; // Remove the montage border for peer review journal figures. if (useBorder=="No") { cropMontage(stackID, montageID, numCol); } // Set the HFOV of the montage so it will achieve a certain DPI. setMontageFOV(hFOV); // If the user doesn't need the stack anymore: closes it. if (closeStack=="Yes") { selectImage(stackID); close(); } /* ************************* * * * * FUNCTIONS * * * * ************************* */ // Creates a 2D montage of the images in the stack with spaces and a border. function maksMontage(rows, columns, stackID) { setBatchMode(true); stackWidth=getWidth; stackHeight=getHeight; stackType = ""+bitDepth; montageSpaces=floor(stackHeight*1/50); montageBorder=columns*floor(stackHeight*1/5); newImage("montage", stackType+" black", columns*(getWidth+montageSpaces)+2*montageBorder-montageSpaces, rows*(getHeight+montageSpaces)+2*montageBorder-montageSpaces, 1); setColor(255, 255, 255); fill; montageWidth=(getWidth-2*montageBorder)/columns; montageHeight=(getHeight-2*montageBorder)/rows; montageID=getImageID; selectImage(stackID); for (i=0; i