Skip to content

Distance to ROI analyses

HGrobe edited this page May 23, 2024 · 14 revisions

CellTracksColab - Distance to ROI

Notebook Input data Optional data
Distance to ROI CellTracksColab format*, ROI images Raw movies

* Output of the TrackMate and Custom notebooks, for more information see here

Introduction

The "Distance to ROI" notebook in CellTracksColab analyzes movement tracks relative to designated Regions of Interest (ROIs). It computes the distances between moving objects (tracks) and ROIs, providing insights into spatial behavior. This notebook is essential for studying movement patterns, interactions, and overall dynamics of tracked entities in relation to ROIs.

Note: This notebook only works with 2D + t datasets

  • CellTracksColab - Distance to ROI Open In Colab

Requirements

  • DataFrames from CellTracksColab: Ensure spots and tracks DataFrames compiled by CellTracksColab are available.
  • ROI Images in TIF Format: Use mask or label images in TIF format with a pixel value of 0 for the background.
  • Consistent Naming of ROI Images: Follow a consistent naming convention like File_name_ROI_name.tif.
  • ROI Image Files in One Folder: For streamlined access and analysis, store all ROI image files in the same folder.

How to Use

  1. Load Your Dataset: Import spots and tracks DataFrames from CellTracksColab.
  2. Specify ROI Folder Path: Indicate the directory containing ROI images, following the correct format and naming conventions.
  3. Define ROI Name and Pixel Calibration: Align the ROI name with image files and specify pixel calibration for accurate measurements.

Distance Calculation Process

  • ROI Image Processing: Read ROI images, ensuring correct naming and format.
  • Distance Transform Application: For each spot in the DataFrame, calculate the distance to the nearest labeled pixel in the ROI image using the distance transform method.
  • Pixel Calibration Adjustment: Convert distances from pixel units to real-world units (e.g., micrometers) using the pixel calibration value.

Visual Validation

  • Visual Check: Validate computed distances in the notebook.

Distance_to_ROI

Metrics Computation

Calculate metrics like MaxDistance, MinDistance, MedianDistance, and more to analyze spatial behavior in relation to ROIs.

  1. MaxDistance_{ROI_name}:

    • The maximum distance of the track from the ROI during the tracking period.
    • Indicates the farthest point reached relative to the ROI.
  2. MinDistance_{ROI_name}:

    • The minimum distance of the track from the ROI during the tracking period.
    • Represents the closest approach to the ROI.
  3. StartDistance_{ROI_name} and EndDistance_{ROI_name}:

    • Distances from the ROI at the start and end of the tracking period, respectively.
    • Useful for understanding initial and final positioning relative to the ROI.
  4. MedianDistance_{ROI_name}:

    • The median of all recorded distances to the ROI.
    • Provides a central tendency measure, less affected by outliers than the mean.
  5. StdDevDistance_{ROI_name}:

    • Standard deviation of the distances.
    • Indicates the variability or consistency of the track's distance from the ROI.
  6. DirectionMovement_{ROI_name}:

    • Calculated as EndDistance - StartDistance.
    • A positive value indicates moving away from the ROI over time, and a negative value suggests moving closer.
  7. AvgRateChange_{ROI_name}:

    • Average rate of change in distance per frame.
    • Helps assess the speed of movement towards or away from the ROI.
  8. PercentageChange_{ROI_name}:

    • Percentage change in distance from the start to the end of the track.
    • Normalizes the movement relative to the initial distance.
  9. TrendSlope_{ROI_name}:

    • Slope of a linear regression line fitted to the distance values over time.
    • Indicates the general trend of movement (increasing or decreasing distance).
  • These metrics are calculated considering the distance to the closest ROI at each time point. If the ROI moves, the metrics reflect the relative motion between the track and the ROI.
  • The closest ROI to a track at each time point may change if multiple ROIs exist. This factor is inherently considered in the distance calculations.
  • It is essential to consider the movement of both the track and the ROI when interpreting these metrics. For example, a decreasing distance over time could mean the track is moving towards the ROI, the ROI is moving towards the track, or both.

Quality Control and Plotting

  • Follow standard procedures for quality control and plotting track parameters as detailed in other sections. Refer to the wiki pages for instructions.

Classifying Tracks by Distance and Plotting

  • Analyze and visualize tracks based on their distance to the ROIs.

Results Storage

  • Results, including computed distances and metrics, are saved in the Distance_to_ROI sub-folder within your Results_Folder.

This notebook offers a comprehensive tool for researchers to understand the interactions and dynamics of tracked entities relative to critical areas in their experiments.

Clone this wiki locally