Dedication
To Everyone contribution to QuST
Image Alignment¶
Load H&E Images into FIJI¶
First, click “File -> Import -> Bio-Formats” and select the corresponding H&E image file.
In Bio-Formats Import Options, using options as showing below.
Next, select the Series Number. The higher series number, e.g., Series 1, the higher resolution. However, higher resolution may result OOM (out-of-memory) if the resource is limitied. On the other hand, lower resolution may limit the accuracy of the following preocess. To author’s experience, Series 3 is usually a good balance.
Click Ok button, the chosen H&E whoile slide image will be loas as a RGB stack in FIJI. Note that in this example, we used FFPE Human Breast with Custom Add-on Panel provided by 10x Genomics. Currently, 10x Genomics has performmed image registration for all of the H&E images in their database. Thus, if the user is using their image as the example, some unexpected noises (e.g., black strips at the edges of the H*E image) have to be removed beforehand.
The type of the loaded H&E image is RGB stack. It is necessary to convert the type to RGB Color by selecting Image->Type->RGB Color.
H&E Color Deconvolution¶
AT this step, we will perform color deconvolution for extracting nuiclei signals (which is highly related to hematoxylin staing of an H&E image). First, use Image->Colod->Color Deconvolution function in FIJI…
…and select the desired color space. the vector of the chosen color space should be selected accordingly. In this case, we used “H&E”.
The RGB Color image is deconvoluted. 3 additional 8 bit images are generated.
Since only the hematoxylin channel is needed, the rest images can be closed. Here the LUT is also replaced by Gray for better visually investigation.
The hematoxylin has to be inverted as showning below:
Below is an additional process which may not applicable for all cases. The user may have to remove the strips on the edges of the image if you are using H&E images provided by 10x Genomics, since 10x Genomics have performmed alignment for all of the H&E images in their dataset. This won’t be the case for most of the users.
The residual signal in the background needs to be remove. This step can be done by performming Process->Substrate background…
Then, we perform histogram equalization by using Image->Adjust->Brightness/Contrast
Hit the Auto button, the histogram equalization will be executed accordingly.
Hit “Apply” and then hit “Ok” to save the equalized signal. The nuclei signal obtained from H&E image thus is ready at this stage.
Load DAPI Images into FIJI¶
Click “File -> Import -> Bio-Formats” and select the corresponding DAPI image file. The corresponding focus is used in this case.
Using below options to load DAPI image.
Select the series number same as when loading the corresponding H&E image.
It is normal if you see a whole black image right after loading the chosen DAPI.
Perform histogram equalization by Image->Adjust->Brightness/Contrast, and click Auto, then hit Apply.
We also convert the LUT to gray in order to perform better visual investigation.
In most cases, DAPI image is stored in 16-bit format. The image has to be converted into 8-bit format by clicking Image->Type->8-bit.
At this stage, DAPI image is loaded.
Linear Image Stack Alignment using SIFT¶
First, generate a image stack using the above obtained hematoxylin and DAPI channels by clicking Image->Stacks->Image to Stack.
In most cases, the obtained H&E image (here, the hematoxylin channel) and the DAPI image havve different dimension. In this case, the stacking method needs to be “Copy (top-left)”. In addition, you may want to enable “keep source images” since you may need image dimension.
Make sure the hematoxylin channel is at the first position of the generated image stack.
Next, start SIFT process by clicking Plugins->Registration->Linear Stack Alignment SIFT. Select “Affine” in the “expect transformation” option, and enable “show transformation matrix”.
Click Ok, in a moment, the result will be generated. You can zoom-in into the detail of the image and observe the result of SIFT.
If the above hematoxylin and DAPI channels have different dimension, it is necessary to crop the image. This step can be done by making an rectangular annotation. The top-left of the rectangular annotation is aligned to the top-left of the image stack. The width and weight of the rectangular annotation are the same as the hematoxylin channel. The trick is, using the mouse creating the rectangular annotation, then, fine-tunning the width and height of the rectangular annotation by holding ALT key and pressing top-down/left-right keys.
Once the rectangular annotation is generated, click Image->Crop to crop the image stack so that the dimension of the image stack is restored.
You can zoom-in and inspect the result of linear image registration
Now, switch to the Log window, click on the obtained transformation matrix, hit right mouse button and hit “Copy”.
At this stage, the linear transformation matrix is obtained.
Now, let’s import the transformation matrix to QuST environment. Start QuPath, and open the corresponding H&E image.
In a QuPath environment with QuST, click Extension->QuST Analysis Toolbox->Pixel Size Calibration by Xenium Affine Matrix, fill the fields as following:
Xenium outout folder: the “outs” folder that was delivered by the vendor.
DAPI image pixel size: currently this value is 0.2125, which may or may not consist with your data. Please consult your vendor.
Image series: using the image series id used when processing H&E and DAPI images.
Affine Matrix: paste the affine matrix obtained in the previous step.
Then, hit “Run” button. The corresponding pixel size and affine matrix for linear registration will be saved.
Non-linear Image Stack Alignment using bUnwrap¶
Switch back to FIJI at the result of linear image registration, click Image->Stacks->Stack to Images, in order to split the stack. You may have to record the order of the images. Note that the first image is hematoxylin channel obtained from H&E, and the second image is DAPI aligned to hematoxylin channel.
Once the two images are splitted from the image stack, go to Plugins->Registration->bUnwrapJ.
In the bUnwrapJ options,
Source Image: select the hematoxylin channel Target Image: select the aligned DAPI channel Registration Mode: Mono Initial Deformation: Very Fine (this option might be veriate but personally I use Very Fine). Final Deformation: Super Fine (this option might be veriate but personally I use Super Fine). Verbose: checked (for observing the further details of the registration outcome) Save Transformation: checked
Click “OK”, and observe the Log window. After a while, a “Save_direct_transformation” File Dialog showed. Name the file as “direct_transf.txt” and save the file to the “outs” folder.
At this stage, the nonlinear registration is completedtack of 5 images will be shown on the screen. Note that the author has experienced a bug in FIJI when flipping between the frames in the image stack. You may want to switch the resulted ime stack into 8-bit for cancelling the bug.
In the result stack, frame 4 and 5 are particually useful. They give you the idea how the bUnwrap decided the transformation over the whole slide.
You can zoom-in into the same spot when inspecting the linear registration outcome.
Load Xenium data into QuST¶
Switch back to QuPath. First, we have to perform nuclei detection using the approach you prefer.
Go to Extension->QuST Analysis Toolbox->10x Xenium Annotation for loading the xenium data. Give the correct “outs” folder in the Xenium directory. Leave the rest parameters as default unless you know what do they mean.
Click “Run”…
Finally the xenoium single cell data, including their transcriptomics and the subtypes will be loaded.
The End