Skip to content

Latest commit

 

History

History
219 lines (147 loc) · 4.06 KB

README.md

File metadata and controls

219 lines (147 loc) · 4.06 KB

Organoid 3D Segmenter

Software for 3D microscopy image analysis combining classical Computer Vision in Java with deep-learning segmentation in Python.

Features

  • Bio-Formats image reading
  • microscopy metadata extraction
  • 3D intensity-volume generation
  • threshold-based 3D segmentation
  • StarDist deep-learning segmentation
  • stack overlay visualization
  • automated unit tests
  • Java/Python execution through TIFF files

Project structure

organoid-3d-segmenter/
├── java-app/              Java image analysis and Python launcher
├── python-deep-learning/  StarDist segmentation and visualization
├── test-data/             Lightweight sample microscopy data for manual examples
├── results/               Generated outputs
├── model-cache/           Local StarDist model cache
└── README.md

Java unit tests and small Java image-reading examples use synthetic TIFF files from:

java-app/src/test/resources/

Manual examples that should run on a real microscopy crop use:

test-data/organoid_stack_sample_crop.tif

Working directory

Use the repository root as working directory for both Java and Python:

organoid-3d-segmenter

Example on Windows:

D:/my/path/organoid-3d-segmenter

Do not use java-app or python-deep-learning as working directory when running examples from IntelliJ, Spyder or the terminal.

Entry points

Java threshold segmentation

Run from IntelliJ:

com.organoid.examples.RunJavaThresholdSegmentation

The input image and threshold are configured in:

java-app/config/threshold-segmentation.properties

Example:

input.path=test-data/organoid_stack_sample_crop.tif
segmentation.threshold=210.0

Paths are resolved from the repository root. The example reads the configured image, applies threshold-based segmentation, shows the resulting mask stack, and prints the foreground voxel count.

Java image-reading examples

Run from IntelliJ:

com.organoid.examples.ReadImageMetadata
com.organoid.examples.ReadImageFile
com.organoid.examples.ShowRawImageStack

These examples use small synthetic TIFF files stored in:

java-app/src/test/resources/

Expected synthetic files:

synthetic_rgb_image.tif
synthetic_3d_stack.tif

Python StarDist segmentation

From the repository root:

python python-deep-learning/examples/run_stardist_segmentation.py

Java/Python workflow

Run from IntelliJ:

com.organoid.examples.RunPythonSegmentation

Java starts the Python StarDist workflow, which reads the input TIFF and writes the label TIFF.

Python environment

Use Python 3.11.

Use an existing Python environment containing the dependencies listed in:

python-deep-learning/requirements.txt

Example setup:

conda activate tensorflow_stardist
pip install -r python-deep-learning/requirements.txt

Find the Python interpreter on Windows:

where python

Copy:

config/python-integration.properties.example

to:

config/python-integration.properties

Set the returned interpreter path:

python.interpreter=C:/path/to/python.exe

Configuration

Java threshold segmentation:

java-app/config/threshold-segmentation.properties

Java/Python execution:

config/python-integration.properties

Python StarDist segmentation and viewer:

python-deep-learning/config/stardist_segmentation.toml

Tests

Run Java tests from the repository root:

cd java-app
mvn clean test

Run Python tests from the repository root:

python -m pytest python-deep-learning/tests -v

Java tests use lightweight synthetic TIFF fixtures. Python unit tests do not require a real StarDist model, TensorFlow execution, model downloads or large image files.

IntelliJ setup

Open the repository folder:

organoid-3d-segmenter

Import the Maven project from:

java-app/pom.xml

For Java run configurations, set:

Working directory:
D:/my/path/organoid-3d-segmenter