Hello,
I have recently started to use grid/collection stitching to stitch the
light microscopic images.
I know my code problem is something to do with file name and loop and it
seems simple but i cannot figure out how to fix them.
Nine images are taken for one section of histological sample (image name:
001_1, 001_2....001_9 and 002_1,....002_9...and so on).
All the images are saved in the same folder (VK_test).
I have following macro code for stitching:
//////
Odir = getDirectory("Select an Open Directory ");
Sdir = getDirectory("Select or make a Save Directory ");
list = getFileList(Odir);
for (k=0; k<list.length; k++) {
if (endsWith(list[k], ".tif")){
image = Odir + list[k];
print(image);
run("Grid/Collection stitching", "type=[Grid: column-by-column]
order=[Right & Down ] grid_size_x=3 grid_size_y=3
tile_overlap=20 first_file_index_i=1 directory=[D:\\Histology_2013\
\VK_test\\] file_names=[image]_{i}.tif
output_textfile_name=TileConfiguration.txt fusion_method=[Linear Blending]
regression_threshold=0.80 max/avg_displacement_threshold=1
absolute_displacement_threshold=3.50 compute_overlap ignore_z_stage
subpixel_accuracy downsample_tiles computation_parameters=[Save computation
time (but use more RAM)] image_output=[Fuse and display]");
run("Stack to RGB");
OutName = "fused_" + File.getName(list[k]);
saveAs("tiff", Sdir + "/" + OutName);
close();
close();
}
}
/////////
But there are two problems:
1) file names are not recognized in the stitching process and i get the
messages that "Cannot find file:"D:\Histology_2013\VK\test\"image"-abrot
stitching.
How do i fix the code for let imageJ recognize the file name?
Print function recognize the file name though.
2) Although this code works if i replace the file name to exact name of the
file (ex. 001),
because of loop the stitching happens 9 times.
How can i have this stitching one time instead of number of files that i
want to stitch?
If it easy to code if the images are saved in individual folder, i can do
that too.
I have tried that too but i also had encountered problem of identifying the
folder and file names.
I really appreciate if somebody can help me out this.
Thanks!!
rui
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html