Skip to content
This project provides a PyQtGraph-based GUI to assist users on the alignment of Ptychography scans.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Ptychography Alignment Tools


This project provides a PyQtGraph-based GUI to assist users on the alignment of Ptychography scans. The tool has the following features:

  • Load set of images (tiff files supported)
  • Select pairs of images for alignment
  • Import/Export probe positions (npy array)
  • Image controls: levels, contrast, look up tables, zooming, translation
  • Preview the global picture by combining all positions



Be sure to have installed all the requirements. Open a terminal and clone the repository to a local directory:

mkdir workdir
cd workdir
git clone url

To start the GUI change to src directory and run with Python:

cd PtychoAlignTools/src/


Once opened, the GUI will initialize like shown below:

alt text

Load Probes

  • By clicking on "Load Probes" a dialog will prompt asking for user input of number of columns and rows the scan map has, then a file dialog will prompt allowing for opening images of probe scans and load them as map of single reconstructed probes.

alt text

  • The two rectangles, red and green, allow for selecting a pair of images to be aligned. The selection is made by clicking on the probes. Right click to select a "movable" image and left click to select an "anchored" (not movable) image.
  • The "Pairwise Alignment View" window display the selected images by doing an operation (Multiplication, Division, Addition, Subtraction, Mask) between them.

Load and Save Alignment

  • By clicking on "Load Alignment" button a file dialog will prompt. It allows to load a ".npy" file (numpy binary file) containing positions of previous alignment. We provide two sample files at probe-positions.
  • The "Save Alignment" button allows to save the current alignment (displayed in the table at the "Positions" window) as a ".npy" file.
  • See numpy documentation for details about ".npy" extension.

Refresh View

  • Restore original size and histogram levels of the image displayed in "Pairwise Alignment View" window.

Preview Global Image

  • Based on the current positions, combine all the probes and show a preview of the total alignment.

alt text

Load Mask

  • This feature allows a user to pick a mask and apply it to the selected probes in order to improve the refinement of the positions.

  • Loading the "filter_gaussian_sigma20.png" mask provided in masks and setting the operation dropdown menu to Mask give us the following:

    • Mask - "filter_gaussian_sigma20.png"

    alt text

    • Result

    alt text

  • If a mask is loaded it will also be used on the display of the Global Image.

Image processing and measure calculation

In the auto subfolder there are some scripts related to:

  • Probe alignment based on edge-type features

alt text

  • Probe alignment based on local-type features

alt text

  • Plotting of many measure in the neighborhood of a given position

alt text


[1] Francesco Guzzi, George Kourousias, Fulvio Billè, Roberto Pugliese, Carlos Reis, Alessandra Gianoncelli, and Sergio Carrato, "Refining scan positions in Ptychography through error-minimisation and potential application of Machine Learning", JINST, Vol. 13, C06002, (2018), Proceedings of the 24th International congress on x-ray optics and microanalysis, 24-29 September 2017, Trieste, Italy (ICXOM24). DOI:

Data and reconstructions as presented in:

[2] George Kourousias, Benedetto Bozzini, Alessandra Gianoncelli, Michael W. M. Jones, Mark Junker, Grant van Riessen, and Maya Kiskinova, "Shedding light on electrodeposition dynamics tracked in situ via soft X-ray coherent diffraction imaging", Nano Research, Vol. 9, Issue 7, (2016), pp. 2046-2056. DOI:

[3] George Kourousias, Benedetto Bozzini, Michael W. M. Jones, Grant A. Van Riessen, Simone Dal Zilio, Fulvio Billé, Maya Kiskinova, and Alessandra Gianoncelli, "Monitoring dynamic electrochemical processes with in-situ ptychography", Applied Nanoscience, (2018). DOI:


The software has been developed by the authors, members of the Elettra Scientific Computing Team and the Image Processing Laboratory from the University of Trieste.


The project in under the GPL-v3 license.


This project is supported by the research and development activities of the Advanced Integrated Imaging Initiative (AI3) project of Elettra - Sincrotrone Trieste.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.