-
Notifications
You must be signed in to change notification settings - Fork 1
Distance Analysis
This macro automates the process of analyzing distances between two sets of label images (Channel 1 - C1 and Channel 2 - C2), measuring their properties, and merging the two channels for visualization. It uses the DiAna_Analyse plugin for distance analysis between corresponding C1 and C2 labels (edge-to-edge). The results of the analysis are saved as CSV files, and the merged images are saved as TIFF files for further review.
Macro location: https://github.com/CellMigrationLab/PDAC_DL/blob/main/Analysis_scripts/distance_analysis_general.ijm
Before running this macro, ensure that the following plugins are installed in your ImageJ/Fiji setup:
- DiAna_Analyse plugin
- MorphoLibJ plugin
You can install these plugins through Fiji's updater:
- Open Fiji.
- Go to
Help > Update...and check for updates. - Use the update site manager to find and install the plugins if needed.
- Channel 1 (C1) Label Images: Prepare a folder containing all your label images for Channel 1 (e.g., nuclear or cell label images).
- Channel 2 (C2) Label Images: Prepare a separate folder containing the corresponding label images for Channel 2 (e.g., protein or marker label images).
- Ensure that both the C1 and C2 folders contain label images with corresponding filenames, as the macro processes them in pairs.
- Open Fiji/ImageJ: Start Fiji or ImageJ on your system.
- Open the Macro: Load the macro into the Fiji/ImageJ editor.
-
Run the Macro: Click on
Runin the macro editor. -
Select Input Directories:
- The macro will prompt you to select the folders containing the C1 and C2 label images.
-
Select Output Directories:
- The macro will ask for directories where the CSV distance results and the merged images will be saved.
- The macro will automatically process the images, perform distance analysis, and save the results.
-
Distance Results: CSV files containing the distance analysis results will be saved in the specified output directory for CSVs (
dirSaveCsv). -
Merged Images: TIFF files that merge the C1 and C2 channels for visualization will be saved in the specified output directory for merged images (
dirMerge).
Ensure that the filenames in the C1 and C2 directories match appropriately. The macro will process files in pairs (one from C1 and one from C2) based on their position in the sorted file list.
If the number of images in the C1 and C2 folders does not match, the macro will terminate and display an error message. Please ensure that both folders contain the same number of corresponding files.
- Place the C1 label images (e.g.,
image1_C1.tif,image2_C1.tif, ...) in theC1folder. - Place the C2 label images (e.g.,
image1_C2.tif,image2_C2.tif, ...) in theC2folder. - Run the macro, select the directories when prompted, and review the generated CSVs and merged TIFF files.
- The macro uses 8-bit conversion to merge channels, but this can lead to data loss. Ensure this is acceptable for your analysis, or modify the conversion process as needed.
- After processing, the macro restores the default image scaling settings.