Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Co-registration in QuPath (Tutorial)

By Fredrik Nysjö (SciLifeLab Bio-Image Informatics Facility)

Pre-requisites

  • QuPath v0.4.x
  • The Image Combiner Warpy extension v0.2.6

To install the Warpy extension in QuPath, download it from here and drag and drop the extracted JAR-files from the archive onto the QuPath window. The QuPath documentation also recommends restarting QuPath after installing new extensions. If you have an older version of the extension installed already, you need to go to Extensions->Installed extensions in the menu in QuPath, select Open extensions directory, and remove the qupath-extension-warpy-*.jar file for the older version.

Using the Image Combiner Warpy extension

Start by creating a new project in QuPath, and then add to the project the images (OME-TIFF files) that should be co-registered. In this example, we are going to use the DAPI channels from images of three different biomarkers (DNA, RNA, and protein) for the registration, to find the two transform matrices that align the RNA and protein biomarker images against the DNA biomarker images. Here is the single-channel dna_dapi.ome.tif that will be used as the reference DAPI image for the registration:

Screenshot

The Image Combiner Warpy extension uses the multiview feature of QuPath to provide control over contrast and color (and also channel selection, for multi-channel images) of the overlays shown during the registration. Additional views can be added via Add row and Add column under Multi-view in the menu shown when right-clicking on the image viewport:

Screenshot

Here we have added rows and columns to create a grid of 2x2 views:

Screenshot

To open another image in one of the views, click on the view to select it, and then double-click on the image in the Image list panel. Here we have opened the single-channel rna_dapi.ome.tif and the multi-channel protein_cropped.ome.tif in two of the additional views:

Screenshot

To adjust contrast, color, and channel selection, use the Brightness & contrast setting on each view. Here all images have been changed to grayscale, and the DAPI channel from the multi-channel protein_cropped.ome.tif image has been selected.

Screenshot

The Image Combiner Warpy tool should be available in QuPath under Analyze->Interactive image combiner warpy. Before opening the tool, we need to select which image that should be the reference for the registration, by clicking on its corresponding view so that it becomes active (indicated by a red outline around the view, and also by bold text in the Image list panel); the final co-registered image will have the same pixel size and resolution as this reference image. Here is what the tool looks like when opening it with dna_dapi.ome.tif selected:

Screenshot

After opening the tool, other images from the project can be added by clicking on Choose images from project. An image selected under the Image & overlays panel will display as an overlay on top of the reference image in the viewport. Here one of the other DAPI images, rna_dapi.ome.tif, has been selected and will be shown as an overlay:

Screenshot

The first step is to provide a coarse alignment that will be used as input to the automatic registration in Warpy. In the viewport, hold the Shift key and click + drag to interactively move the overlay displayed on top of the reference image. The opacity of the overlay can be controlled via the `Opacity' slider. (Note: here the overlay is also shown in a different color, for better visibilty)

Screenshot

Next, after coarse alignment, we use Estimate transform to try to calculate the final transform. The Pixel size field controls at which level of detail the registration will be performed at, which can affect the quality of the estimate.

Screenshot

Here is what the registration between the two DAPI images looks like, after decreasing Pixel size to 10 and then calculating the transform via Estimate transform:

Screenshot

After having found a good registration between the two DAPI images, we can transfer the transform matrix to other RNA biomarker images (rna_a647.ome.tif in this example), by simply copying the values in the text field Current affine transform being displayed from one image to another:

Screenshot

Next, we want to repeat the registration procedure for the third biomarker type (protein). In this case, the image protein_cropped.ome.tif was captured at a different pixel spacing (0.5082 micron instead of the 0.1619 micron) compared to the reference image, and also has a different orientation. The Warpy extension does not take the pixel spacing into account during registration, meaning there will be mismatch in scale, as seen here in the screenshot:

Screenshot

Correction for scale and rotation can be provided via the Scale increment and Rotation increment fields; note that changing these fields also affect the translation of the image, which might cause the image to disappear outside the visible view.

Screenshot

After correcting for scale and rotation, we can proceed in the same way as for the rna_dapi.ome.tif image, i.e. by first doing coarse manual alignment followed by automatic registration via Estimate transform.

Screenshot

Important: before the next step, we also need to enable all channels in Brightness & contrast that were previously unchecked for protein_cropped.ome.tif. Otherwise, the Image Combiner Warpy extension will not include them in the combined image.

Screenshot

After done with registration of all the images, the final step is to click on the Create button in the tool to generate a co-registered combined overlay:

Screenshot

Exporting the result to OME-TIFF

To export the co-registered result for processing or visualization in other software, select the view with the combined overlay generated by Image Combiner Warpy. Then go to File->Export images->OME TIFF and press OK. A message will be displayed after the export has finished (note that this can take a very long time, especially for large images with many channels!)

Screenshot

After the result has been exported, we can try to open the created OME-TIFF file in a new window of QuPath for inspection:

Screenshot