Skip to content

Plugin_Template Matching Folder

Laurent Thomas edited this page Mar 25, 2020 · 3 revisions

  • Template file or Template folder : Path to the template file or to a folder containing the templates
  • Image file or Image folder : Path to the image file or to a folder containing the images

If a filepath is provided the search is performed with this unique template or for this unique image.
While if a folder is provided, each template in the template folder will be searched in each image of the image folder.
The best matches for each images are returned.

NOTE:

  • If Open Images is ticked, the images in the list must have the same dimensions and will be opened as a stack

Search region

An optional rectangular ROI can also be provided as a *.roi file to limit the search to a fraction of the images.

ROI can be saved from the ROI Manager :

  • Open one of the image of the image series
  • Draw the search region as a rectangular ROI and add it to the RoiManager (Press t)
  • Save it locally as a *.roi file. (RoiManager>More>Save...). See wiki section Save and Open regions of interest

Macro-Recording

This macro is also recordable.

run("Template Matching Folder", "template=[C:/Users/Laurent Thomas/Documents/Template] image=[C:/Users/Laurent Thomas/Documents/Images] rectangular_search_roi=[] flip_template_vertically rotate=[] matching_method=[Normalised 0-mean cross-correlation] number_of_objects=1 score_threshold=0.50 min_peak_height=0.10 maximal_overlap=0.25 open_images add_roi");