.. _`chap:workshop1`:
Image Analysis Workshop
=======================
This workshop was given to the Specialist Group in Geochemistry,
Mineralogy & Petrology
(`SGGMP `__),
Port Macquarie, NSW, Australia (20th November 2025). Attendants were
asked to download all the datasets and install the free software QuPath
for Part 1. Meanwhile, Part 2 required downloading and unziping Cube
Converter and Chemistry Simplifier that are only supported in Windows 11
OS.
The workshop introduced offline standalone software to process very
large images: (1) Cube converter, (2) Chemistry simplifier, and (3)
phase interpreter. They can be combined into image analysis pipelines
for semi-automated mineralogy. The pipelines can be customised by the
user and work on their PC to allow advanced navigation, pixel
classification (QuPath software), object identification and
dimensionality reduction applied to a variety of rock types (igneous,
metamorphic, and sedimentary).
Using an example of a pyroxenite (websterite) thin section, the workshop
demonstrated how image analysis tools can help to transition from
subjective user-driven classification to more objective interpretation
of object classes and their mutual relationships.
.. _part-1:
Part 1: QuPath interface
------------------------
This part works for Windows or Mac OS users.
Exercise 1: Demonstration by instructor - opening a 250 GB image.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A huge pyramidal OME TIFF image can be opened in less than 5 seconds.
The image data was saved in an external drive and the instructor will
open it in his screen simply for demonstration.
This shows that image formats are fundamental for the workflow. An
example image pyramid is shown below.
|image|
Exercise 2: QuPath multi-view canvas
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please follow these steps on your PC:
1. Go to "../Seminar_material/exercises_data"
2. Create an empty folder
"../Seminar_material/exercises_data/exercise_2"
3. OPen QuPath and create a new project selecting that folder.
4. In QuPath:
a. Right-click in the black canvas > Multi-view > Synchronize viewers
(deactivate)
b. Right-click in the black canvas > Multi-view > Set grid size >
Grid 2x2
c. On the Project tab > Add images > Choose files >
i. "..\\Seminar_material\\exercises
data\\registered_pyramids\\montages_original" > select all >
Import
ii. "..\\Seminar_material\\exercises
data\\registered_pyramids\\ama_phasemap_pyramid.tif"
iii. " ..\\Seminar_material\\exercises
data\\registered_pyramids\\BSE_pyramid.tif"
d. All images should now be displayed in Data tree.
e. Open the following four images:
i. Click the first split (top left) > "ama_phasemap_pyramid.tif"
(double click)
ii. Click the second split (top right) > "BSE_pyramid.tif"
iii. Click the third split (top right) > "10x_RL BF_01_z0.tif"
iv. Click the fourth split (bottom right) > "10x_xpl-0_01_z0.tif"
f. Right-click in the canvas > Multi-view > Synchronize viewers
(activate).
g. | If the images are not perfectly aligned, click on “Set the
current viewer’s zoom to fit the images” (for each image) and
re-synchronize
| |image1|
The successful canvas now looks like this. You can now seamlessly
navigate between a phase map (top left), BSE (top right), reflected
light (bottom left) and an XPL optical image (bottom right).
|A screenshot of a computer screen AI-generated content may be incorrect.|
Exercise 3: ‘Boxing in’ images within the multi-view canvas
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You’ll notice that there are many more images available in the data
tree. While QuPath offers the option of using a 3x3 or larger canvas,
simultaneously viewing such large numbers of images becomes
counter-intuitive. To overcome this issue, we instead group related
images into a single z-stack. For example, we can burn all optical
images into a stack, or we can stack 6-12 chemical maps into a single
stack. Each stack then only occupies one filed in the canvas and we
instead flick between stack layers to display the various images within
the stack. In the example below, you will generate a 2x2 canvas with all
xpl images in a stack in the top left panel, all ppl images in a stack
in the top right and one reflected light and one BSE image in the bottom
two panels, respectively.
On your PC follow these steps:
1. Go to "../Seminar_material/exercises_data"
2. Create an empty folder
"../Seminar_material/exercises_data/exercise_3"
3. Go to QuPath and create a new project selecting that folder.
4. In QuPath:
a. Right-click in the black canvas > Multi-view > Synchronize viewers
(deactivate)
b. Right-click in the black canvas > Multi-view > Set grid size >
Grid 2x2
c. On the Project tab > Add images > Choose files >
i. "..\\Seminar_material\\exercises
data\\registered_pyramids\\montages_z-stack" > select all >
Import
ii. "..\\Seminar_material\\exercises
data\\registered_pyramids\\montages_z-stack\\10x_RL
BF_01_z0.tif"
iii. "..\\Seminar_material\\exercises
data\\registered_pyramids\\BSE_pyramid.tif"
d. All images should be displayed in Data tree.
e. Open the following images:
i. Click the first split (top left) > "xpl_z-stack.tif" (double
click)
ii. Click the second split (top right) > "ppl_z-stack.tif"
iii. Click the third split (bottom left) > "10x_RL BF_01_z0.tif"
iv. Click the fourth split (bottom right) > "BSE_pyramid.tif"
f. Right-click in the canvas > Multi-view > Synchronize viewers
(activate).
g. | If the images are not perfectly aligned, click on “Set the
current viewer’s zoom to fit the images” (for each image) and
re-synchronize
| |image2|
The successful canvas now looks like this:
|image3|
Note that the two z-stacks have a slider at the top left (in blue) that
can be click-dragged to flick between images.
Exercise 4: Multi-view with ray tracing and dimensionality reduction
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In multimodal microscopy, with up to 20 imagery of the same specimen,
our capacity to digest the incredible amount of information reaches its
limits. Furthermore, for classifying pixels, the complexities of light
interaction with anisotropic minerals confuse learning algorithms. To
reduce these complexities, we have developed two methods which summarise
the images:
- `Ray tracing `__: performs
descriptive statistics of the optical image stack as single images for
each microscopy modality (PPL, XPL). The most useful image is the
maximum RGB intensity, both in PPL and XPL. The latter is equivalent
to a ‘circular polarisation’ image.
- `Chemical dimensionality
reduction `__: performs
three different types of simplification of chemical image stacks via
PCA, UMAP or DSA (see Part 2). In practice, PCA images, where RGB
represent loadings on PC1, PC2 and PC3, do well at showing mineralogy
(phase maps), while the neural network DSA can reveal faint zonations.
In the next exercise, you will generate a 2x2 canvas combining an
optical stack, a BSE image, an SEM-EDX phase map and then a chemistry
simplification stack.
On your PC follow these steps:
1. Go to "../Seminar_material/exercises_data"
2. Create an empty folder
"../Seminar_material/exercises_data/exercise_4"
3. Go to QuPath and create a new project selecting that folder.
4. In QuPath:
a. Right-click in the black canvas > Multi-view > Synchronize viewers
(deactivate)
b. Right-click in the black canvas > Multi-view > Set grid size >
Grid 2x2
c. On the Project tab > Add images > Choose files >
i. "..\\Seminar_material\\exercises
data\\registered_pyramids\\montages_z-stack\\optical-z-stack.tif"
> Import
ii. "..\\Seminar_material\\exercises
data\\registered_pyramids\\BSE_pyramid.tif"
iii. "..\\Seminar_material\\exercises
data\\registered_pyramids\\ama_phasemap_pyramid.tif"
iv. "..\\Seminar_material\\exercises
data\\registered_pyramids\\montages_z-stack\\reduced_z-stack.tif"
d. All images should be displayed in the Data tree.
e. Open the following images:
i. Click the first split (top left) > "optical_z-stack.tif"
(double click)
ii. Click the third split (top right) > "BSE_pyramid.tif"
iii. Click the first split (bottom left) >
"ama_phasemap_pyramid.tif"
iv. Click the fourth split (bottom right) > "reduced_z-stack.tif
"
f. Right-click in the canvas > Multi-view > Synchronize viewers
(activate).
g. | If the images are not perfectly aligned, click on “Set the
current viewer’s zoom to fit the images” (for each image) and
re-synchronize
| |image4|
The successful output looks like this:
|image5|
Not only are these images quicker to see but they can be studied with
Machine/Deep learning algorithms. For example, QuPath allows drawing
manual annotations (on each) and merging images and annotations into a
multi-channel image (not a z-stack) for phase mapping using the “Pixel
Classifier” (content of Part 2B).
.. _part-2a:
Part 2A: Cube Converter and Chemistry Simplifier work
-----------------------------------------------------
This part is dedicated to Windows users.
Exercise 1: Ray tracing
~~~~~~~~~~~~~~~~~~~~~~~
When acquiring optical scans with slide scanners, a larger number of
images are produced and saved in a “data tree” file. The QUT and UQ
Evident VS200 slide scanners has been implemented to use polarisers and
therefore serve as a petrographic microscope. In this exercise, you will
use new software to crunch your stage rotation images (XPL-0, 15, 30,
45, ..) into summary representations. We call them XPL-(max, min, etc.)
ray traced images.
The outputs can be read in QuPath or in Evident “software suite” with
ease and without paying for expensive software.
On your PC follow these steps:
1. Open "../Seminar_material/files/Cube Converter v1/Cube Converter
v1.exe" (unzipped)
2. (1) Polarised microscopy processor
a. Image pyramid > Browse > "D:\\Seminar_material\\exercises
data\\optical\\Image_03.vsi"
b. Pyramid > level = 3
c. Tiles and montages > All original scans
d. Ray tracing options
i. > PPL pleochroism and XPL birefringence (ticked on)
ii. > Maximum, Maximum index
e. Run
You were successful if the output looks like this:
|A screenshot of a computer AI-generated content may be incorrect.|
The “pyramid_sizes.csv” contains the experiment metadata for future
reference:
|image6|
Exercise 2: Making a z-stack
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Z-stacks for biological samples are produced to vertically observe these
tissue samples at different depths (the z-axis) for adjacent microtomed
slices of the tissue. For us, mineral appearance (colour) changes in
birefringent materials. In addition, the grains have random
orientation/shape and relatively flat interiors that are not easily
learnable.
We developed the ‘hack’ of using “virtual” z-stacks to see petrographic
images in colour and different experiment orientations (not depths)
while focusing at the sample surface (using reflected light). Balz calls
them *data cubes*. Cube converter (right hand side of interface) allows
stacking optical and chemical images if they were pre-aligned
(registered) with each other. I made a video detailing how to do align
images with an ImageJ plugin, see “booklet_11-Nov-24_extra
materials.docx” QUT routines (video #2).
On your PC follow these steps:
1. Open "../Seminar_material/files/Cube Converter v1/Cube Converter
v1.exe" (unzipped)
2. (2) Multi-modal z-stack generator
a. Input list:
i. Add >
1. "..\\Seminar_material\\exercises
data\\registered_pyramids\\montages_original\\10x_xpl-0_01_z0.tif"
2. "..\\Seminar_material\\exercises
data\\registered_pyramids\\montages_original\\10x_xpl-30_01_z0.tif"
3. "..\\Seminar_material\\exercises
data\\registered_pyramids\\montages_original\\10x_xpl-45_01_z0.tif"
4. "..\\Seminar_material\\exercises
data\\registered_pyramids\\montages_original\\10x_xpl-75_01_z0.tif"
b. Pyramid calibration = 1.095 µm/pixel.
i. If you do not know it. This can be calculated with:
.. math:: pixel\ size\ \left( \frac{µm}{px} \right) = \left( microscope\ objective\ calibration\left( \frac{µm}{px} \right) \right) \times \ 2^{pyramid\ level\ chosen}
c. Output file > my_first_z-stack
d. Select Folder > create and choose a folder
"..\\Seminar_material\\exercises
data\\registered_pyramids\\montages_z-stack" > Select Folder
e. Run
You were successful if the output looks like this:
|image7|
Exercise 3: Dimensionality reduction
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chemistry simplifier software can be used to dimensionally reduce the
number of chemical images into new red, green, and blue (RGB) images of
high interpretability. In the guts of the software, randomly sampled
pixels are used to factorise (Principal component “PCA”), fit (Deep
sparse autoencoder “DSA”), and topologically approximate (Uniform
manifold approximation and projection “UMAP) a model that reduces the
input chemical stack (SEM-EDX, XFM, XRF, spectra, etc.) into 3 channels.
The model is then used to transform (parallel computation) the pixels of
all the image while saving the process metadata required to reuse the
models later (e.g., for scaling up to more thin sections).
These “representation” images allow tracking element-mineral association
without having to flick between too many images. In most commercial
software, this is done using ‘composite’ images for elemental
combinations (e.g., Fe-K-Mg in a colourmap) that require a subjective
choice of elements.
On your PC follow these steps:
1. Open "../Seminar_material/files/Chemistry Simplifier v1/Chemistry
Simplifier v1.exe" (unzipped)
2. (1) Pyramid generation and image processing
a. Destination > "trial_1"
b. Experiments > "..\\Seminar_material\\exercises
data\\sem\\sem-edx\\after_selected"
c. Filtered search > (.+)
d. Image format > png
3. (2) Input and analysis definition
a. Output_tag > “tag_1”
b. Click Refresh. Note that the list should auto-fill with the 16
images within the folder.
c. Dimensionality reduction > Principal component analysis (ticked
on)
4. (3) Model parametrisation > Performance constraints > Downsampling >
Scale = 1; Resolution = Full (1).
a. *If your computer is slow, please, use Scale = 2 and Resolution =
2*
5. Run
You were successful if the output looks like this:
|image8|
Containing a folder with recoloured images to help you know what images
are not useful:
|image9|
, and another folder containing the ‘tag’ transformation output shown
below. The “montage_pca.tif” image has been opened (right-hand side)
showing colour contrast between minerals:
|image10|
The DSA and UMAP transforms will not be used during this workshop, but
you can try them at home (over night). If you are curious to view them,
find them at:
- "D:\\Seminar_material\\exercises
data\\registered_pyramids\\dsa_selected_artefacts_8bit_pyramid.tif"
- "D:\\Seminar_material\\exercises
data\\registered_pyramids\\umap_selected_artefacts_8bit_pyramid.tif"
.. _part-1-image-registration:
Part 3: Image alignment
-----------------------
Correlative microscopy works with multiple images obtained with
different microscopy experiments and/or instruments using diverse
techniques (optical, SEM-BSE/EDX, XFM, XRF, laser ablation maps).
Hundreds of images can be produced and have strikingly different
contents; therefore, they align using mental effort (user-driven) or
automatic registration (algorithm-driven) can be an image analysis
bottleneck. Images from a single microscopy technique (modality) are
usually easier to (pre-)align and correlate, unlike multi-modal images,
where auto-alignment would be ideal. However, not every software can
cope with very large images and/or allow semi-automatic alignment with
100% success rate.
Image alignment (or registration) is a fundamental step. Image
transforms and pixel interpolation are applied sequentially to produce
images of the same different spatial resolution, orientation, and sample
surface coverage (e.g., `Ella Bahry
(2025) `__). The
registration process needs the user to assign two images; a ‘fixed’ (or
reference image) and ‘moving’ (enters the transformation) image. The
output is a modified ‘moving’ image with the same size and resolution as
the ‘fixed’ image, where both can now be used for producing an image
stack. A literature review has explored software for registration and
the most reliable uses control-point (or landmark) selection and
registration enabling non-rigid transformation `(Acevedo Zamora, 2024,
Chapter 2) `__.
There are two software options:
a. BigWarp `(Bogovic et al.,
2016) `__: ImageJ Fiji
plugin for control-point registration allowing the application of
non-rigid image transformation of large TIF images. ImageJ can handle
up to ~4 GB when opening two images (fixed and moving images). The
process can be macro-scripted if a registration loop is required.
b. Warpy `(Chiaruttini et al.,
2022) `__: QuPath
extension that binds Fiji-BigWarp-QuPath software for control-point
registration of very large files. It can handle >4 GB such as
original resolution optical images (at 10X or more) but cannot yet be
macro-scripted.
Working with slide scanner optical images (<0.5 µm/px) and SEM automated
mineralogy maps (>1 µm/px), a good compromise is using Option (a) and a
10X scan at pyramid level 1 (~1 µm/px) as the ‘fixed’ image for
registration. It is recommended to use the reflected light image for
increased precision in selecting control points (corners and edges
required). Registering several images makes them easier to visualise and
analyse in specialised software (GIS, bioinformatics software).
Therefore, this task enables (1) simpler data sharing, (2) remote
worker/expert(s) collaboration (virtual microscopy), and (3) correlative
microscopy discoveries.
.. _option-a-bigwarp-alignment:
Option A: BigWarp
~~~~~~~~~~~~~~~~~
Following the overarching workflow, Cube converter saved folders with
the optical scans as image pyramids (‘../montage_rt’ and
‘../montage_original’). Then, Chemistry simplifier produced single plain
images for each trial
(‘..///transformation/montage_pca.tif’
file). Note that these are not aligned and Chemistry Simplifier produced
plain images (not pyramids). Do not attempt to add or open them in
QuPath software.
This part works for Windows or Mac OS users. The first time, we need to
set up the PC with ImageJ. Please, download
`Fiji `__, unzip,
automatically update, and re-open Fiji until you can find the
`BigWarp `__ plugin.
In your PC, follow these steps:
1. Open Fiji software.
2. Open and modify the fixed image: optical image
a. Drag and drop or ‘Toolbar > Plugins > Bio-Formats > Bio-Formats
Importer’
b. Bio-Formats Import Options menu > View stack with= Hyperstack > OK
c. Bio-Formats Series Options menu > Series 1 (ticked on) > OK. The
chosen series depend on your available RAM (if overloading, use
Series 2).
3. Open and modify the moving image: chemical image
a. Toolbar > Image > Adjust > Brightness/Contrast > adjust the top
and bottom intervals to each channel (repeat for red, green, blue)
b. Analyze > Set Scale > Click to Remove Scale
c. File > Save As > Tiff.. > ‘montage_pca_8bit.tif’
4. Open the BigWarp plugin (Toolbar > Plugins > BigDataViewer > Big
Warp)
a. BigWarp Setup > moving image = ; fixed image
= . Click OK.
b. Three windows will open: (left) BigWarp moving image, (middle)
BigWarp fixed image, and (right) Landmarks table.
5. Select control points
a. Pre-align the images in both windows. Left-click the windows and
rotate the images.
b. Find the first point using the mouse scroll wheel. Beginning by
the moving image, press SPACE *(activate editing)* and click the
location of the first point (purple circle). Then, do the same for
the fixed image. When both coordinates appear listed in the
Landmark table, press SPACE again *(deactivate editing)*. Find the
next point.
c. Repeat (b) until 4 (preferably more) points have been selected.
d. The alignment quality can be ensured following:
i. Click the moving image window and press T *(transform)*.
ii. Click the fixed image window and press Q *(synchronise)*
followed by F *(fuse overlay)*.
iii. If required, edit the location of the control points (press
SPACE) to improve the overlay alignment.
e. Go to the Landmarks table > File > Export landmarks… > Save
‘/landmarks.csv’. For later reutilisation, you can
edit the filename to remind you of the used moving and fixed
images.
f. Go to the Landmarks table > File > Export moving image
i. Click OK. Leave everything by default but notice that you can
use more cores (threads = 4) for speed.
ii. You will see a progress bar appear in (Fiji is Just) ImageJ
window.
iii. The registered moving image will prompt as a new greyscale
image (3-channel format).
6. Save the output as a single plain image
a. Go to Toolbar > Save As > Tiff…
b. Save as TIFF menu > File name= ‘_registered.tif’
7. Close the output and BigWarp windows.
In case you already had placed control points for the same image pair
before, follow these steps:
1. Open Fiji software
2. Open and modify the fixed image: optical image (same as above)
3. Open the modified chemical image (saved above)
4. Go to Toolbar > Plugins > BigDataViewer > Big Warp Apply
5. In the Apply Big Warp transform window:
a. Landmarks image file = Browse… ‘.csv’
b. moving image = Drop down menu ‘’
c. target moving image = Drop down menu ‘’
d. Click OK. Leave everything by default but notice that you can use
more cores (threads = 4) for speed.
6. Save the output as a single plain image
a. Go to Toolbar > Save As > Tiff…
b. Save as TIFF menu > File name= ‘_registered.tif’
7. Close the output\*
\*Note that the whole routine can be macro-scripted in ImageJ language
for many more moving images.
If wanting to import the registered image into QuPath, follow:
1. Open Cube converter
2. Use ‘(2) Multi-modal z-stack generator’ for only 1 image
a. Add > ‘../_registered.tif’
b. Pixel calibration > pixel size from experiment metadata, e.g.,
TIMA experimental conditions
c. Output file > ‘../_registered_pyramid.tif’
d. Select Folder > ‘../’
3. Open Qupath v0.6 and load the image
a. Click Open project… > Open ‘’
b. Add images… > Choose files >
‘../_registered_pyramid.tif’ > Import
.. _option-b-warpy-alignment:
Option B: Warpy
~~~~~~~~~~~~~~~
The `documentation `__ and
the recent `I2K
workshop `__
explained how to use Warpy within QuPath step by step. More work is
required to loop the process through several image pyramids. The reader
is welcome to contribute making more developments.
.. _part-3:
Part 4: Phase mapping and interpretation
----------------------------------------
This part runs on Windows. The MatLab source code repository for version
1 (see GitHub) contains the App that you can also run in Mac OS (with
MatLab installation). However, it is preferable to use the latest
version (re-written in Python and only for Windows).
.. _exercise-1-phase-mapping:
Exercise 1: QuPath phase mapping
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
QuPath was designed as a platform where users can see the deployment of
image analysis algorithms with a tile-based system at multiple
resolution scales (pyramids). The software includes pixel classification
functionality that links images, annotations, and supervised learning
models for semantic segmentation. In this exercise, you will learn to
use the interface to annotate, train, and calibrate (in live mode) image
segmentation in use of all the available dimensions within the input
image stack.
The key is to combine optical with dimensionally reduced chemical maps
(read Part 2A), which ensures that the classifier has enough information
to distingusih the ‘features’ that we are interested in the sample
and/or target minerals.
This part can be run in Mac or Windows OS.
We will ask you to use QuPath to:
I. Navigate the sample. Your petrographic microscopy knowledge will be
key.
II. Define annotation categories and draw polygon *annotations* using
the multi-view (see Part 1).
III. Generate a ‘*multi-channel* overlay’
IV. Transfer annotations to the overlay.
V. Train a Random Tree model and save the model. Then, predict the map
corresponding to that classifier within the QuPath project folder.
Some level of familiarity with the Pixel classifier menu is required but
we will mostly use default values today (try it at home).
I. Navigation
^^^^^^^^^^^^^
On your PC, follow these steps:
1. Go to "../Seminar_material/exercises_data"
2. Create an empty folder
"../Seminar_material/exercises_data/exercise_1"
3. Go to QuPath and create a new project selecting that folder.
4. In QuPath:
a. Right-click in the black canvas > Multi-view > Synchronize viewers
(deactivate)
b. Right-click in the black canvas > Multi-view > Set grid size >
Grid 2x2
c. On the Project tab > Add images > Choose files >
i. "..\\Seminar_material\\exercises
data\\registered_pyramids\\montages_rt\\xpl_max_z0.tif" >
Import
ii. "..\\Seminar_material\\exercises
data\\registered_pyramids\\montages_original\\10x_RL
BF_01_z0.tif"
iii. "..\\Seminar_material\\exercises
data\\registered_pyramids\\BSE_pyramid.tif"
iv. ".. \\Seminar_material\\exercises
data\\registered_pyramids\\pca_selected_artefacts_8bit_pyramid.tif"
d. All images should be displayed in the Data tree.
e. Open the following images:
i. Click the first split (top left) > "xpl_max_z0.tif" (double
click)
ii. Click the third split (top right) > "10x_RL BF_01_z0.tif"
iii. Click the first split (bottom left) > "BSE_pyramid.tif"
iv. Click the fourth split (bottom right) >
"pca_selected_artefacts_8bit_pyramid.tif"
f. Right-click in the canvas > Multi-view > Synchronize viewers
(activate).
g. | If the images are not perfectly aligned, click on “Set the
current viewer’s zoom to fit the images” (for each image) and
re-synchronize
| |image11|
You were successful if you output looks like this:
|image12|
II. Annotation
^^^^^^^^^^^^^^
In your QuPath project, follow these steps:
1. Go to the Annotations tab
2. Add items to the class list:
a. click the “+” button (in red below)
b. cpx, opx, grt, spn, olv, background, hole
3. Change the colour of each category: click square next to each class
(in blue below) and select a new colour. Follow the legend at last
page of the *booklet* printout.
========= =========
|image13| |image14|
========= =========
\
========= =========
4. Annotate each class.
a. In the canvas, choose an image where you feel you can do a good
annotation.
b. Draw polygons on top of each mineral class. The ‘brush’ and ‘wand’
tools are useful.
|image15|
c. In the example below: right-click the annotation (yellow contour) >
Set classification > “cpx”
|image16|
d. The process is satisfactory usually when you have 3 or 4 annotations
per class.
5. When completed, go to Menu toolbar > File > Save.
6. Repeat for each image if you *annotated multiple images* in the
canvas\*.
\*The annotations are saved within each image. If switching images (or
the project) you need to save your progress (File > Save).
III. Generate multi-channel stack (overlay)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
First, we need to install a QuPath extension for image registration
(only once):
1. Go to Menu toolbar > Extensions > Manage extensions > Manage
extensions catalogs (button)
2. Catalog URL (copy-paste: https://github.com/BIOP/qupath-biop-catalog)
> Click Add
3. In the Extension Manager window under the new QuPath-BIOP catalog
expandable menu install QuPath Warpy extension v0.5.0 (click the
green plus button).
4. Exit and reopen the software and open your project.
In your reopened QuPath project, follow these steps:
1. Open an image in the canvas (double click in the data tree). For
example, “BSE_pyramid.tif”.
2. Go to Menu bar > Analyze > Interactive image combiner Warpy
|image17|
3. Choose images from project > select all > OK
4. Click *Create*\ \*
|image18|
5. A multi-channel image will be added in the data tree and opened\*.
\*In old versions, you needed to: Go to the Annotation toolbar >
Brightness & contrast tool > tick on all (or custom selection). Then,
click Create.
6. Close “Image Combiner Warpy (experimental)” window.
|image19|
7. Optional: Compare the new image with the inputs. The multi-channel
image has 12 channels (4 x 3-channels) as below:
========= =========
|image20| |image21|
========= =========
\
========= =========
\*You can improve the overlay appearance by deactivating all channels
and only keeping red, green, and blue (RGB) of one source, corresponding
to C1, C2, and C3 above.
IV. Transfer annotations
^^^^^^^^^^^^^^^^^^^^^^^^
In your QuPath project, follow these steps:
1. Open the image(s) where the annotations were saved.
2. Go to File > Export objects as GeoJSON… > All objects > Save. If you
have annotations in multiple images, repeat.
|image22|
Pop up window:
|image23|
3. Open the multi-channel overlay.
4. File > Import objects from file…
5. Find the QuPath project directory > select/Open “\*.geojson” file. If
you have annotations in multiple images, repeat.
6. All annotations will now show in the overlay.
V. Train and predict using a learning model
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In your QuPath project, follow these steps:
1. Go to Menu toolbar > Classify > Pixel classification > Train pixel
classifier...
2. Select:
a. Classifier > Random trees
b. Resolution > Moderate (default)
|image24|
3. Optional: Click Advanced options > Reweight samples (tick on)
|image25|
4. Click Live prediction. Be patient, the interface will freeze for a
few seconds.
5. The slider at the top allows you to control the transparency of the
segmented map for quality control.
|image26|
6. Since you are in Live mode, you can draw more annotations (see “II.
Annotations”), right-click, and assign mineral class.
a. This will improve your map but freeze the interface\* to allow the
model re-train with the new pixels.
b. If you do not like freezing, try deactivating Live prediction,
annotating more grains (that you remember), and activating Live
when you are done.
7. When satisfied, add a name for your classifier (“my_first_RT_model”)
and save (red circle below).
8. Click “Save prediction” (blue circle below)
9. Find the QuPath project directory > Save “my_first_RT_model.ome.tif”
file.
|image27|
In summary, ‘Live’ segmentation tool has allowed you to rapidly classify
pixels and learn more about your samples (beyond your annotation
dataset). The technology highlights aspects in the whole-sample that
were not sufficiently obvious for human vision and/or might have taken a
very long to recognise and classify.
Take home messages:
- This is an iterative process that uses hybrid-learning knowledge,
color, and texture.
- Since we are not using *resource-intensive* spectral library search
(as in the SEM), we have more control over the output.
- With practice, you will focus on
`features `__
that are resolvable and know when to change the settings, use less
channels, or stop annotating.
- With data acquisition and processing *consistency*, the trained model
can be set up to predict new samples thanks to QuPath advanced
scripting functionalities (`without
interface `__).
.. _exercise-2-phase-interpretation:
Exercise 2: Phase Interpreter work
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A user has segmented a sample for several purposes such as mineralogy
(see Part 2B), texture (fractures, mineral zonation, etc.), or crystal
orientation (using XPL-max index). Phase Interpreter software was
designed to read the predicted map (from the QuPath project directory)
and output a custom mineral map where you can properly document and
quantify the classified minerals. It features:
- Editing of phase names into more accurate mineral/class (for
publication)
- Basic sample display, area selection, and processing
- Image analysis for statistics (modal mineralogy, grain size
distribution, association, accessibility) and measurements
- Saving partial analysis outputs into “trial” folders
The requirements are:
- You have not modified the names of your map or classifier. They need
to match.
- The map can be loaded in memory (future work will implement pyramids).
On your Windows PC, follow these steps:
1. Open Phase interpreter
2. (1) Define map
a. QuPath project >
"../Seminar_material/exercises_data/"
b. Trained classifier > “”
c. Background class > “” (e.g., glass,
background, holes, marker pen). List classes that should not
appear in the output) separated by a *comma*.
d. Click “Generate preview”
3. (2) Customise phase map
a. Originals (ranked) > List of contained phases (equal to QuPath
annotation names)
b. Custom names > List where you can edit phases as minerals
c. Targets > List where you can select the minerals to be shown
(foreground)
d. Region of interest (ROI) > click “Draw” for defining a ROI. It
lowers the computational cost.
4. (3) Choose the analysis
a. Trial tag > “”
b. Generate > CTRL + click for selecting all (multiple analysis to be
run)
i. Association index matrix requires a search radius and
connectivity (‘four’ recommended).
ii. Grain size distribution requires defining “Pixel calibration”.
c. Click “Run”
You were successful if your input looks like this (not for the
websterite sample):
|image28|
, and your output like this:
|image29|
, with several folders for each trial tag that was run.
Finally, custom map outputs have applications such as doing new
experiments on the interesting sample areas using new experiments and
instruments that can “jump” between objects to acquire better spectra.
There should be no need for brute force mapping (and saving) of all
pixels if you can correlate techniques, e.g., ‘dot mapping’ (Hrstka et
al., 2018).
.. _benchmark:
Benchmarking with SEM-EDX
^^^^^^^^^^^^^^^^^^^^^^^^^
**Garnet-websterite phase map.** After Scanning electron microscopy –
Backscattered electron and Energy dispersive spectroscopy (SEM-BSE/EDX)
using default settings and spectral library search:
|image30|
**Colour legend**
|image31| |image32|
.. |image| image:: ./media/image1.png
.. |image1| image:: ./media/image2.png
.. |A screenshot of a computer screen AI-generated content may be incorrect.| image:: ./media/image3.png
.. |image2| image:: ./media/image2.png
.. |image3| image:: ./media/image4.png
.. |image4| image:: ./media/image2.png
.. |image5| image:: ./media/image5.png
.. |A screenshot of a computer AI-generated content may be incorrect.| image:: ./media/image6.png
.. |image6| image:: ./media/image7.png
.. |image7| image:: ./media/image8.png
.. |image8| image:: ./media/image9.png
.. |image9| image:: ./media/image10.png
.. |image10| image:: ./media/image11.png
.. |image11| image:: ./media/image12.png
.. |image12| image:: ./media/image13.png
.. |image13| image:: ./media/image14.png
.. |image14| image:: ./media/image15.png
.. |image15| image:: ./media/image16.png
.. |image16| image:: ./media/image17.png
.. |image17| image:: ./media/image18.png
.. |image18| image:: ./media/image19.png
.. |image19| image:: ./media/image20.png
.. |image20| image:: ./media/image21.png
.. |image21| image:: ./media/image22.png
.. |image22| image:: ./media/image23.png
.. |image23| image:: ./media/image24.png
.. |image24| image:: ./media/image25.png
.. |image25| image:: ./media/image26.png
.. |image26| image:: ./media/image27.png
.. |image27| image:: ./media/image28.png
.. |image28| image:: ./media/image29.png
.. |image29| image:: ./media/image30.png
.. |image30| image:: ./media/image31.png
.. |image31| image:: ./media/image32.png
.. |image32| image:: ./media/image33.png