Posted by
Jacqueline Ross on
Jul 29, 2016; 6:49am
URL: http://imagej.273.s1.nabble.com/Creating-individual-tiles-from-large-montage-file-tp5016947.html
Dear All,
We have a system that creates very large stitched images from individual raw data files. I'm helping one of our graduate students to do some image analysis and unfortunately her files are far too large to be able to process the stitched image and she has somehow forgotten to copy and store safely the raw data, which we often use for the analysis.
So, I would like to create a macro that will cut these large images into tiles of a size that can be managed, i.e. reverse the process.
I've made some progress but have two issues. One is that her file names have spaces in them. When I use the ImgName=getTitle() command, it seems to cut off the title at the space. Is there another command that can be used that will get the full name including spaces? If not, is there an easy way to rename these images with underscore or hyphens in place of spaces as a first step?
The second problem is that instead of saving the image stack automatically as a sequence, it's asking me to confirm the file name. It might just be that it's late on a Friday afternoon (for me) but I can't work out what I've done wrong.
I've copied the macro below and I would very much appreciate some help ! I've also attached it as a text file in case something goes wrong with the lines..
//This macro splits a stitched image into 5 x 5 individual tiles and saves as a sequence into a Destination folder
dir1 = getDirectory("Choose Source Directory ");
dir2 = getDirectory("Choose Destination Directory ");
list = getFileList(dir1);
setBatchMode(true);
for (i=0; i<list.length; i++) {
showProgress(i+1, list.length);
open(dir1+list[i]);
imgName=getTitle();
run("Montage to Stack...", "images_per_row=5 images_per_column=5 border=0");
run("Image Sequence... ", "format=TIFF name="+imgName+"start=0 digits=3");
close();
}
Kind regards,
Jacqui
Jacqueline Ross
Biomedical Imaging Microscopist
Biomedical Imaging Research Unit
School of Medical Sciences
Faculty of Medical & Health Sciences
The University of Auckland
Private Bag 92019
Auckland 1142, NEW ZEALAND
Tel: 64 9 923 7438
Fax: 64 9 373 7484
http://www.fmhs.auckland.ac.nz/sms/biru/--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html