|
a |
|
b/README.md |
|
|
1 |
# QuPath Alignment of Serial Images (QuASI) |
|
|
2 |
List of QuPath scripts for alignment and stain deconvolution of whole-slide histology images (WSIs). Output of `Calculate-Transforms.groovy` is a list of affine transformations that can be used to transform WSIs or annotations. Output of `Apply-Transforms.groovy` is a multichannel ome.tiff containing the transformed image channels appended (and optionally deconvolved if brightfield) to the reference image. |
|
|
3 |
 |
|
|
4 |
Video tutorial found in https://youtu.be/EvvSsXExYOI?t=1 |
|
|
5 |
## Usage |
|
|
6 |
### Calculate-Transforms.groovy |
|
|
7 |
Use this script to generate transformation matrices for all images |
|
|
8 |
- Load in all sets of images to be aligned into project. Rename file names such that the only underscore (_) in the image name separates the SlideID from stain. Example: N19-1107 30Gy M5_PANEL2.vsi. Make sure the SlideID is not contained within any other SlideID of an image set that is not intended to be aligned. |
|
|
9 |
- Adjust the inputs specified under "Needed inputs", and run script (can run on any image, iterates over entire project) |
|
|
10 |
- If script errors due to alignment failing to converge, set 'align_specific' to the SlideID of the image it failed on |
|
|
11 |
- Set 'skip_image' to 1, rerun script to skip over the error-causing image |
|
|
12 |
- Set 'skip_image' to 0, and either adjust 'AutoAlignPixelSize' or draw tissue annotations on all stains of images in list |
|
|
13 |
- run script, verify all moving images contain a transform file located in the 'Affine' folder |
|
|
14 |
### Alignment - StoreMatrix automatic.groovy (optional) |
|
|
15 |
Use this script if you want to pull a transformation matrix from the `Interactive Image Alignment` GUI |
|
|
16 |
- Open reference image in viewer |
|
|
17 |
- Open the `Interactive Image Alignment` overlay, align an image |
|
|
18 |
- While the overlay is still open, set 'name' to the name of the current moving image, and run script |
|
|
19 |
### Apply-Transforms.groovy |
|
|
20 |
Use this script to apply the transform to WSIs, appending them together in one large multichannel ome.tiff, optionally including separated stains if brightfield (H&E or HDAB) |
|
|
21 |
- Run 'Calculate-Transforms.groovy' to generate the necessary transform (tform) matrices required. |
|
|
22 |
- Set 'refStain' to the same reference stain as used in 'Calculate-Transforms.groovy' |
|
|
23 |
- Adjust 'variables to set' depending on the degree of downsampling, whether to display in viewer, or write out as an ome.tiff |
|
|
24 |
- Run script only on images containing 'refStain' |
|
|
25 |
- Give yourself a pat on the back for actually reading the documentation :) |
|
|
26 |
## To do: |
|
|
27 |
- Bugs |
|
|
28 |
- when transforming an image set where one of the non-reference images has been rotated on import, ometiff gets somewhat corrupted during writing (tiles will fail during writing) |
|
|
29 |
- Verified as bug with QuPath by Pete: https://github.com/qupath/qupath/issues/641. Temp solution is to either make sure images are properly oriented prior to import, or perform manual alignment via `Alignment - StoreMatrix automatic.groovy` |
|
|
30 |
- Features |
|
|
31 |
- Offer ability to select what channel(s) to align based on (implemented, might want to add option to specify different channels for different images) |
|
|
32 |
- Improve string matching of 'filteredMap' in `Apply-Transforms.groovy` so that if a SlideID is contained within another SlideID of a different image that is not to be aligned to, this won't confuse the script and attempt to append the different image sets together |
|
|
33 |
|
|
|
34 |
|