/manannan

Manual annotation and quantification of IMC pseudoimages

Primary LanguagePythonMIT LicenseMIT

manannan

Manual annotation and quantification of IMC pseudoimages

See Manannán mac Lir

Installation (Windows)

  1. Install the latest version of Python, taking care to ADD PYTHON TO PATH
  2. If not already installed you will need to install Microsoft C++ Build Tools (warning 6.7Gb!)
    • Video showing installation here.
  3. Open a command prompt (e.g. Start->cmd)
  4. Use Python package installer to install some packages:
    • pip install numpy matplotlib pillow tifffile scikit-image pandas scipy
  5. Navigate to src directory

Set up image directories

  1. Within src directory create two subdirectories: MCDs and MultiTIFFs
  2. Copy all .mcd files into MCDs directory
  3. Open each one using Fluidigm's MCD viewer
  4. Export contents of each .mcd file as a scaled, 16bit, multi-page .tiff file, into the MultiTIFFs directory

Generate image previews from multipage TIFFs

  1. Navigate to src directory
  2. Download and save explore.py into this directory (right-click link and choose "Save link as..." to download)
  3. Execute explore.py (e.g. by double-clicking on explore.py)
  4. Will create a new directory in src: PreviewImages
  5. Will also create subdirectories corresponding to each multipage TIFF in MultiTIFFS
  6. Will also write two types of 8bit, compressed preview images, derived from multipage TIFF files found in MultiTIFFs, to subdirectories in PreviewImages
    • Files named e.g. PATID_laminin_Q.jpg are contrast stretched by stretching histogram to truncate the intensity of the brightest 5% pixels
    • Files named e.g. PATID_laminin.jpg are contrast stretched by adaptive equalization
  7. Will also create sub-directories named geojson_annotations within each PreviewImages directory, to store any annotations

Annotate images with QuPath

  1. Download and install QuPath
  2. Open one of the preview images
  3. Generate some annotations
  4. Export the annotations into the relevant geojson_annotations directory
    • File->Object data->Export as GeoJSON...
    • Choose "All objects" in the Export dropdown menu
    • OK -> Write file to the relevant geojson_annotations directory

Generate annotation preview images & ROI quantifications

  1. Navigate to src directory
  2. Download and save annotation.py into this directory (right-click link and choose "Save link as..." to download)
  3. Execute annotation.py (e.g. by double-clicking on annotation.py)
  4. Generates further versions of preview images highlighting numbered, annotated areas (calculated from .geojson files)
  5. Generates an overall summary .csv file containing area of each ROI, along with area of positive signal from each channel within each ROI and average positive intensity within each ROI
  6. Generates correlation matrix, showing Pearson's pairwise correlations between all intensities in positive pixels from all pairs of channels. Note that AB correlation is not equal to BA correlation because of different "positive" pixels in each case.