Fiji Grid/Collection stitching plugin - calculating tile overlap

Hi,

I use the Grid/Collection stitching plugin in Fiji in a macro to stitch tiles from IHC images together for subsequent analysis. The images often contain structured and empty areas. I use “Linear blending” as fusion method and “Compute overlap” with 5% tile overlap:

tileOverlap = 5;
run("Grid/Collection stitching", "type=[Grid: row-by-row] order=[Right & Up] grid_size_x="+gridX +" grid_size_y="+gridY +" tile_overlap="+tileOverlap +" first_file_index_i=1 directory="+dirInput_tif +" file_names="+image +" 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 display_fusion computation_parameters=[Save computation time (but use more RAM)] image_output=[Fuse and display]");

This works well, however I get black tiles in areas (mostly in the corners) where there is no visible structures to stitch together (which makes sense to me because it is difficult to compute the overlap of nothing). If I do not compute the overlap I get stitching of all tiles but the stitching result is not always accurate. The plugin does only accept integer for the overlap percentage. It does not cause issues to the subsequent analysis if I replace the black squares with white ones, nevertheless having a complete stitched image would be preferred.
Is there a way to force the stitching plugin to just use the defined overlap for tiles where no overlapping structure could be found?

Thanks,
Jenny

Welcome to the forum, @jostrop!

To my knowledge, there is no easy way to do that with the current plugin.

You can however edit the TileConfiguration.registered.txt after running the plugin with Compute overlap selected, to manually place the “misplaced” tiles in the corners by changing their coordinates, and then run again with this edited file as input ( Positions from file / Defined by TileConfiguration ) and Compute overlap deselected.

Note that there’s also a new project, BigStitcher, that is supposed to have better tile handling. The author @StephanPreibisch might want to share more insights.

The MIST stitching plugin allows the user to restrict the translation uncertainty (available from an update site).

MIST GitHub

MIST usually computes translations between all overlapping pairs of images before estimating the stage model parameters (image overlap, stage repeatability, camera angle). With these stage model parameters MIST limits the range of possible translations between image pairs. Therefore, if there is no information to perform registration in the upper left corner of the stitched image it will search for the best translation within the range defined by the image tile overlap (e.g. 10%) within the translation repeatability bounds (e.g. ± 20 pixels). This limits the possible translation errors, allowing MIST to assemble stitched images where the center of the composite image has enough content for registration but the edges are blank.

With MIST the user can specify the stage model parameters, including image overlap and stage repeatability. If those parameters are specified MIST will optimize the translations between overlapping tiles only within the range bounds specified (e.g. 10% overlap ± 25 pixels).

An extreme example would be specifying the tile overlap of 10% and a 0 pixel stage repeatability. This would result in MIST assembling a stitched image consisting of exactly 10% overlapping tiles.

~Michael

Thanks a lot for your prompt replies!
I think the workaround suggested by @imagejan will work to create pretty stitched images for publications if needed (I am afraid that just replacing the missing tiles with the average background gray value could be considered as fraud, although it does yield the same result visually). For the rest of the analysis pipeline the empty corners do not really matter.
I will also take a look into BigStitcher and MIST. However MIST appears to be an independent tool and therefore inconvenient to integrate in an ImageJ pipeline?

MIST supports ImageJ macros and scripting (Macro/Jython/Beanshell).

If you want to use a scripting language I would suggest using the Macro Recorder (Plugins > Macros > Record…) to obtain the formatted command equivalent to what you enter into the GUI. Both MIST and Grid Collection Stitching have a fair number of parameters. Letting the automated tool provide you with the parameter formatting and syntax can save you time.

I typically use the Recorder to get the basic outline of the script command, and then tweak the input parameters for the specific situation. For example, changing the source image directory from a string literal to a variable.

~Michael

P.S., MIST is about to be published (article goes live on ‘Scientific Reports’ on the 10th). So you will have the ability to cite the tool in any publication your work generates. Regardless of whether you end up using MIST, I would suggest reading the paper once it goes live. It contains a discussion of microscope stage modeling and how that can be used to bound the pairwise image translations, the type of issues you seem to be having with your stitching.