Chapter 3 ImageJ Script Walkthrough
This section of the manual will provide an overview of the steps taken in the ImageJ script, starting with the input parameters required for the script to function, followed by a walkthrough of how each marker is analysed.
3.1 Specifying Parameters
When the ImageJ script is ran, the following dialog boxes will appear one at a time, with the latter dialog boxes changing depending on the initial inputs. It is important to find parameters that work best for each marker. A useful resource for information about markers is the Human Protein Atlas. Checking what markers should look like will help to guide decisions on parameters such as minimum area and thresholding method.
3.1.1 Dialog Box (1/3)
![](images/Dialog_1.png)
Dialog Box (1/3)
Reference marker: Add here the name of the reference marker to be analysed. The name should match the image file name minus the ‘.tif’.
Minimum area: This refers to the minimum number of pixels a marker signal is required to cover in order to be analysed. It is desired to eliminate as much noise as possible while keeping all relevant signal. It would be a good idea to look at a few sample images when determining the minimum area.
Autothresholding method: Select an autothresholding method from the drop-down menu. See the thresholding section of this manual for more information.
Has DNA marker: select “Yes” if a nuclei marker or present or “No” if not. The image name should always be ‘DNA.tif’.
Has region of interest: “Yes” if the study involves a region of interest (ROI) or “No” if not.
Number of markers to colocalise: Input here the number of markers that you wish to analyse in addition to the reference, nuclei and ROI markers.
Click ‘OK’ once done.
3.1.2 Dialog Box (2/3)
![](images/Screenshot%202022-08-15%20at%2013.40.56.png)
Dialog Box (2/3)
Marker colocalisation radius: this refers to the maximum proximity two markers can be in order to be deemed to be colocalised. This radius applies to reference marker-marker and (reference) marker-DNA colocalisation.
Region of interest: Input the ROI marker here, ensuring that the name of the marker matches that in the file name.
Use Gaussian and Watershed on ROI: Select either “Yes” or “No”. If “Yes”, this function blurs the ROI signal, before using a Watershed transform to segregate them. This is useful when the ROI signal is fragmented and is not densely populated within the region.
ROI minimum area: If the answer was “Yes” to the previous input, then the minimum area should be higher as any gaps left by sparse markers will be filled by the blur.
Radius around ROI: This allows for the region of interest to be expanded around the marker signal. If this is not desired set the value to 0.
Click ‘OK’ once done.
3.2 Region of Interest
3.2.2 Gaussian Blur
The Gaussian blur function takes the average of the signal in all pixels within a given radius. For our function, we use a radius of 5 pixels after extensive comparisons.
The blur is a means of resolving a problem faced when dealing with disperse or fragmented markers, such as amyloid-beta. Below is an example of the effects of the Gaussian blur on a slide stained for amyloid-beta.
3.2.3 Watershed Transform
The Gaussian blur can cause clusters of signal to merge into each other so we use a watershed transform to separate those signals, as seen below.
3.2.4 Particle Analysis
The next step is to run the analyse particles function, using the specified minimum area. Below is the outcome of the optional Gaussian-watershed function with a default minimum area of 1100 pixels compared with the raw image. The sensitivity of the function can be modified by changing the minimum size.
3.3 Nuclei
3.3.1 Thresholding
The chosen threshold ultimately determines how much signal is included in the processed image. Our default threshold for DNA is ‘Otsu’ as it is a good mid-range threshold which includes as much signal as possible whilst eliminating noise.
Otsu thresholding returns a single intensity threshold determined by minimizing intra-class intensity variance, or equivalently, by maximizing inter-class intensity variance.
![](images/DNA_thresh.png)
DNA Threshold Montage
3.3.2 Watershed
The watershed transform is used here to separate overlapping DNA signal in the 2D image.
3.3.3 Particle Analysis
DNA signal is then counted and analysed. Each DNA count represents a cluster of touching pixels with an area larger than the specified minimum area. We have set the default minimum area as 4 pixels due to some cells having nuclei with a diameter as small as 2 microns, thereby covering at least 4 pixels. Most nuclei, however, are larger than this, so it may be beneficial to increase the minimum area depending on the study.
3.4 Reference Marker
3.4.1 Thresholding
Our default threshold for the reference marker is ‘Otsu’ as it is a good mid-range threshold which includes as much signal as possible whilst eliminating noise.
![](images/Iba1_thresh.png)
Iba1 Threshold Montage
3.4.2 Particle Analysis
Reference marker-positive cells are identified by overlaying enlarged reference marker signal and DNA. Here, we present several close-up images to display how the script recognises each positive cell and avoids false positives/negatives. The images show our reference marker (Iba1) in red, merged with DNA in cyan.
![](images/ref_cell4.png)
Despite tightly clustered DNA, only the correct cells are counted.
![](images/ref_cell5.png)
Cell only counted once (same colour overlay) despite fragmented signal.
Reference marker cells within the ROI are simply these detected cells which are situated within the enlarged region of interest.
3.5 Colocalisation Markers
This section of the code is identical for each of the colocalisation markers used, however different minimum areas and thresholds can be used.
3.5.1 Thresholding
The default threshold is again set to ‘Otsu’ which we recommend due to its balance between removing noise and retaining useful signal. It is important, however, that different thresholds for each marker. Thresholding montages can be produced in FIJI ImageJ through Image -> Adjust -> Auto Threshold -> Try All. Find here a few example thresholding montages.
![](images/CD68_thresh.png)
CD68 Thresholding Montage
![](images/HLA-DR_thresh.png)
HLA-DR Thresholding Montage
![](images/pTau_thresh.png)
pTau Thresholding Montage
3.5.2 Particle Analysis
Colocalisation marker-positive cells by the same processes as reference markers. (See here Particle Analysis).