TrakEM2, photomontage


can somebody tell me a good workflow to stitch very large datasets (montage, 2D) in Fiji?
I used:
Plugin-> Stitching-> Grid/collection stitching, fused image and exported.
But with several GB, the image is too big. And saving the image didn’t work too.

I want to use TrakEM2, import the tiles, adjust by writing the x and y images (columns, rows).

And, can I import the finished stitched image after using Plugin-> Stitching… in TrakEM2? Or do
I have to use the “right click on canvas-> import…” approach in TrakEM2?

1 Like

If you have memory problems with the complete stitched image, then you should use TrakEM2. Have a look at its manual.

You can but TrakEM2 is optimized for large datasets with multiple tiles. Having a single large tile won’t save you any memory in TrakEM2.

1 Like

Now it works fine, with 324 images, thanks a lot for help! In only 35 min.

I still have some problems with the exact alignment of 5-8 pictures but most of the images are almost perfect aligned. And it takes very long to use elastic alignment (3-5 h). Therefore, I think I have to buy a nice workstation.

1 Like

If you are finding the stitching portion of your workflow taking too long I have a shameless plug for our accelerated stitching plugin called MIST.

It accelerates image stitching (2D+t only) by optionally using FFTW and CUDA. The global image position optimization algorithm is different than Grid/Collection, but the pairwise translations are generated the same way (Phase-Correlation-Image-Alignment-Method). The MIST stitching results are generally comparable to the Grid/Collection plugin despite the difference in translation optimization algorithms.

Note: MIST can only handle image grids which have roughly constant overlaps between images, within a few percent. Also, I do not know what you consider a ‘very large’ dataset, but MIST has been tested with image grids up to 220x220 (at 1040x1392 pixel images).

MIST can stitch with or without the acceleration libraries. The update site download comes bundled with FFTW libraries for Windows (Mac/Linux require the user to compile/install FFTW). To use CUDA you need to have a NVIDIA GPU and the CUDA 6.5 toolkit installed.

MIST details:
source code:
availability: update site within Fiji

Send me a message if you have any questions about the tool.

To convert the image position list MIST generates into a form TrakEM2 can import (for viewing large stitched images) I have the following Python script which builds a text file matching this TrakEM2 documentation.

folder = 'C:/MIST_Convert_Test/'
input_filename = 'img-global-positions-1.txt' # needs to be a MIST *-global-positions* txt file
output_filename = 'trakem2_position_list.txt' # needs to be a *.txt file to import into TrakEM2

# open file handles
input_fh = open(folder + input_filename,'r')
output_fh = open(folder + output_filename,'w')

for line in input_fh:
    # strip out the additional information MIST saves leaving only "<img_name>, <x>, <y>, 0"
    toks = str.split(line, ';')
    img_name = toks[0][str.find(toks[0],':')+2:]
    img_pos = toks[2][str.find(toks[2], '(')+1:len(toks[2])-1]
    output_fh.write(img_name + ', ' + img_pos + ', 0\n')
# close file handles
1 Like