Skip to content

TCox-Lab/PicRed_Transmitted

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

CMM Lab - Picrosirius Red (PR-Red) Analyser

CMM Lab website: Homepage

CMM Lab GitHub: Homepage


ImageJ / FIJI script to batch-analyse and quantify picrosirius red (PR) stained tissue sections imaged under brightfield microscopy.

Requires ImageJ/FIJI 1.38m or above.

Current version: 2.05


Description

This script wraps ImageJ's HSB (Hue/Saturation/Brightness) colour thresholding into a batch loop that iterates through every image of a specified file type in a user-selected directory (and all of its sub-directories).

For each image, the script:

  1. Optionally detects the total tissue area in the image (excluding background/slide), or uses the whole image frame as the reference area.
  2. Thresholds the Hue, Saturation and Brightness channels independently using user-defined ranges, then combines them (logical AND) to isolate PR-Red positive (collagen) staining.
  3. Measures the area of detected signal and calculates it as a percentage of the total reference area.
  4. Optionally saves a PNG overlay of the detected signal for each image, for QC and figures.
  5. Writes a collated results table and a parameters log for the whole batch run.

If using multiple sub-directories of images, please ensure that filenames are unique, as outputs are named after the source image.

All processed images should be taken using identical acquisition parameters (staining, exposure, white balance, magnification) to ensure thresholds are comparable across a dataset.


Installation

Ensure you have ImageJ or FIJI (preferred) installed.

  • ImageJ is available from here.
  • FIJI is available from here.

Copy CMM_PR-Red_Analyser_v2_04.ijm to the ImageJ/FIJI plugins directory.

Restart ImageJ/FIJI.

The script should now appear in the Plugins dropdown menu.


Basic settings

Upon launching, the script will ask for the following inputs:

Setting Description
Specify File Type Input image file extension to process, e.g. .tif, .jpg. Only files ending in this extension will be analysed.
Save Mask Output [Slower] Saves a PNG overlay of the detected PR-Red signal for each image. Useful for QC and figures, but slower and uses more disk space.
Detect Tissue Area [Advanced] If enabled, automatically segments tissue from background/slide and uses that area as the denominator for % PR Area. If disabled, the whole image area is used instead.
Edit Thresholds [Advanced] Opens a second dialog allowing manual adjustment of HSB thresholds and other advanced options (see below).
Launch Memory Monitor [Debugging] Opens ImageJ's Memory Monitor window. Mainly useful for troubleshooting large batch runs.
Batch Mode On [Faster] Runs the script without displaying image windows during processing, significantly speeding up large batches.

You will then be asked to select the input directory containing the images to be analysed. Sub-directories are searched recursively.


Advanced settings (if enabled)

If "Edit Thresholds" is ticked in the basic dialog, a second window allows customisation of the colour thresholds and pre/post-processing steps:

Setting Description
Hue Min / Max HSB Hue threshold range used to detect PR-Red staining (0-255 scale).
Saturation Min / Max HSB Saturation threshold range used to detect PR-Red staining.
Brightness Min / Max HSB Brightness threshold range used to detect PR-Red staining.
Threshold Minimum / Maximum Saturation threshold range used specifically for automatic tissue area detection (only relevant if "Detect Tissue Area" is enabled).
Skip Fill-Close Skips the hole-filling / close / dilate clean-up steps normally applied to the tissue mask.
Remove Noise from Red Detection Enables speckle/noise removal (via Remove Outliers) on the Saturation channel prior to signal detection.
Noise Pixel Radius Radius (pixels) used by the Remove Outliers noise-removal step.
Noise Pixel Threshold Threshold used by the Remove Outliers noise-removal step.

Default thresholds (tuned for standard PR-Red brightfield staining):

  • Hue: 216–255
  • Saturation: 115–255
  • Brightness: 0–255
  • Tissue detection (Saturation): 32–255

Only change these values if you understand HSB colour thresholding, and always validate against a subset of images first.


Output image files

If Save Mask Output is enabled, the script saves a PNG overlay of the detected PR-Red signal for each analysed image, named:

<filename>_A_Signal.png

If Detect Tissue Area is enabled, a PNG of the tissue mask is also saved for every image (useful for confirming tissue segmentation worked correctly), named:

<filename>_B_TotalMask.png

Both are saved in the same directory as the source image. The original image file is never modified.


Output text files

The analysis writes two text files to the top-level directory selected at the start of the run:

  1. PR-Red_Results.txt - Tab-separated results table with one row per successfully analysed image, containing:

    • Image - source filename
    • Total Area - reference area (tissue area or whole image, depending on settings)
    • Total PR Area - area positive for PR-Red staining
    • % PR Area - PR-Red positive area as a percentage of Total Area
  2. Parameters.txt - A log of every setting used for the run (file type, HSB thresholds, tissue detection mode, noise removal, etc.), for reproducibility.


Citation

If you use this script in published work, please cite the CMM Lab and link back to this repository.


Contact

CMM Lab - www.matrixandmetastasis.com

About

ImageJ / FIJI script to analyse picrosirius red stained sections imaged under transmitted light

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors