Stitching in batch

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Stitching in batch

Mauricio Aguirre Morales
Dear Community,

I am trying to stitch 25 images in a 5x5 tile. I have written these
lines but the script is only processing the first 25 images in a folder
where 100 images are saved. Any hint on how to solve this problem is
highly appreciated!

macro "Stitching in imageJ" {
dir = getDirectory("Choose an input directory ");
dir2 = getDirectory("Choose a destination directory ");
list = getFileList(dir);
setBatchMode(true);
for (i=0; i<list.length; i++) {
   path = dir+list[i];
   showProgress(i, list.length);
   if (!File.isDirectory(path)) {
   open(path);
//
//....
run("Grid/Collection stitching", "type=[Grid: row-by-row] order=[Right &
Down                ] grid_size_x=5 grid_size_y=5 tile_overlap=5
first_file_index_i=1 directory=[C:\\Users\\Mauricio\\Desktop\\New
folder\\] file_names={i}.jpg output_textfile_name=TileConfiguration.txt
fusion_method=[Linear Blending] regression_threshold=0.30
max/avg_displacement_threshold=2.50 absolute_displacement_threshold=3.50
compute_overlap computation_parameters=[Save memory (but be slower)]
image_output=[Fuse and display]");
saveAs("TIFF", dir2+list[i]);
//....
//
//wait(3000);
//selectWindow("Summary");
//save(pathsaveres);
}

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Stitching in batch

Rainer M. Engel
Hey Mauricio,

you're opening the whole folder (every image), but you are using only
the first 25, reading your macro.

Even if it's very slow. Disable the batchMode to see what's happening.

I would integrate a counter, which could be the result of your 5x5 tile.
So everytime 25 images are open, do the stitch, write, close, go on..

Regards,
Rainer



Am 13.10.2016 um 14:55 schrieb Mauricio Aguirre Morales:

> Dear Community,
>
> I am trying to stitch 25 images in a 5x5 tile. I have written these
> lines but the script is only processing the first 25 images in a folder
> where 100 images are saved. Any hint on how to solve this problem is
> highly appreciated!
>
> macro "Stitching in imageJ" {
> dir = getDirectory("Choose an input directory ");
> dir2 = getDirectory("Choose a destination directory ");
> list = getFileList(dir);
> setBatchMode(true);
> for (i=0; i<list.length; i++) {
>   path = dir+list[i];
>   showProgress(i, list.length);
>   if (!File.isDirectory(path)) {
>   open(path);
> //
> //....
> run("Grid/Collection stitching", "type=[Grid: row-by-row] order=[Right &
> Down                ] grid_size_x=5 grid_size_y=5 tile_overlap=5
> first_file_index_i=1 directory=[C:\\Users\\Mauricio\\Desktop\\New
> folder\\] file_names={i}.jpg output_textfile_name=TileConfiguration.txt
> fusion_method=[Linear Blending] regression_threshold=0.30
> max/avg_displacement_threshold=2.50 absolute_displacement_threshold=3.50
> compute_overlap computation_parameters=[Save memory (but be slower)]
> image_output=[Fuse and display]");
> saveAs("TIFF", dir2+list[i]);
> //....
> //
> //wait(3000);
> //selectWindow("Summary");
> //save(pathsaveres);
> }
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
>


--
Rainer M. Engel
Pichelsdorferstr. 143
D-13595 Berlin

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Stitching in batch

jmatthews
I am trying to do the same thing as the OP. I have a folder of png files that I want to stitch together in batch. The files are 99 fields of view from each well of a 96-well plate.
My file name format is {xx}f{yy}.png where xx = well number (01 - 96) and yy = field of view.
I have recorded a macro for the stitching of a single well, and subsequent resizing and saving of a tiff output, but I am having a hard time figuring out how to modify it so it will stitch the entire set of 96 well x 99 FOV into 96 well images, as the OP was trying to do.
I'm sure this is relatively simple but this is my first foray into batch processing in ImageJ so any help would be greatly appreciated. Thanks.

Macro to date:

run("Grid/Collection stitching", "type=[Grid: row-by-row] order=[Right & Down]
grid_size_x=9 grid_size_y=11 tile_overlap=2
first_file_index_i=1
directory=[F:\\13-02-16-Acinar-Day0 BF__2017-02-13T16_16_18-Measurement2\\Stitching\\Objects]
file_names=r01c01f{ii}.png
output_textfile_name=TileConfiguration.txt
fusion_method=[Linear Blending] regression_threshold=0.30 max/avg_displacement_threshold=2.50 absolute_displacement_threshold=3.50
computation_parameters=[Save computation time (but use more RAM)] image_output=[Fuse and display]");
run("Size...", "width=2000 height=1840 constrain average interpolation=Bilinear");
saveAs("Tiff", "F:\\13-02-16-Acinar-Day0 BF__2017-02-13T16_16_18-Measurement2\\Stitching\\Objects\\Stitched Images\\r01c01.tif");
close();
Loading...