-
Notifications
You must be signed in to change notification settings - Fork 12
Example Usage and Tutorials
The DeepImageJ case studies repository contains various examples demonstrating how to use DeepImageJ for different bioimage analysis tasks. These case studies illustrate the application of deep learning models for image-to-image translation, nuclei segmentation, and integration with the BioImage Model Zoo. Each example includes scripts, macros, and detailed instructions to replicate the workflows. More details can be found in this article.
- Description: This case study demonstrates the use of deepImageJ for performing image-to-image translation from actin to DAPI images, followed by nuclei segmentation using the StarDist model. The pipeline is then integrated into a macro for batch processing demonstrating the ability of deepImageJ to run several models in a simple macro script.
-
Files:
- prepare_dataset.py: Script for preparing the dataset for image-to-image translation and segmentation.
- StarDist_Postprocess_macro_CS1.ijm: ImageJ Macro for StarDist post-processing in Case Study 1.
- Notebooks: Pix2Pix and StarDist 2D from ZeroCostDL4Mic.
- Dataset: Pix2Pix, Lifeact-RFP actin stain images and StarDist, sir-DNA dapi stain images
- Models: Pix2Pix for Image Translation from Lifeact-RFP to sir-DNA and StarDist Model for Nuclei Segmentation in Synthetic Lifeact-RFP
To fine-tune the models for your specific data, follow these steps:
-
Download Datasets:
- Obtain the two datasets required for this case study. If using Google Colab, upload these datasets to Google Drive. If fine-tuning locally, ensure the datasets are accessible on your local drive.
-
Fine-Tune Pix2Pix:
- Use the ZeroCostDL4Mic notebook for Pix2Pix to fine-tune the Pix2Pix model for 200 epochs with default parameters.
- Training parameters:
- Batch size: 1
- Loss function: Vanilla Generative Adversarial Network (GAN)
- Patch size: 512 × 512
- Initial learning rate: 2e-4
- Data augmentation: None
- The Pix2Pix model is exported using PyTorch 2.0.1.
-
Fine-Tune StarDist:
- Use the ZeroCostDL4Mic notebook for StarDist to fine-tune the StarDist model for 100 epochs.
- Training parameters:
- Dataset: 45 paired image patches (1024 × 1024)
- Patch size: 1024 × 1024
- Batch size: 2
- Initial learning rate: 3e-4
- Data augmentation: None
- The StarDist model is exported using TensorFlow 2.14.
-
Export Models:
- Ensure both fine-tuned models are exported in the BioImage Model Zoo format. Pay careful attention to the exporting and packaging requirements, including metadata.
Once the models are exported, follow these steps to install and use them in DeepImageJ:
-
Install Models in DeepImageJ:
- Open Fiji and navigate to
Plugins > DeepImageJ > DeepImageJ Install Model. - Move to the
Private Modeltab, selectFrom ZIP file, and add the path to your model zip file one by one.
- Open Fiji and navigate to
-
Run the Macro:
- Use the macro provided here.
- Modify the paths for the input and output folders in the macro to match your directories.
- The macro workflow includes:
- Running the fine-tuned Pix2Pix model through DeepImageJ to perform image translation from actin to DAPI images.
- Running the fine-tuned StarDist model on the synthetic DAPI images.
- Performing StarDist post-processing steps.
-
Output:
- You will obtain a folder with the masks of your input images. If using the same data, expect five masks corresponding to the five time points.
To conclude this use case, you can use TrackMate for tracking and data visualization:
-
Load Time Points:
- Load the final five masks into TrackMate.
-
Perform Tracking:
- Follow the default options and documentation in TrackMate to perform the tracking analysis.
- Refer to the TrackMate documentation for detailed instructions.
By following these steps, you will successfully fine-tune and apply Pix2Pix and StarDist models using DeepImageJ, and perform tracking analysis with TrackMate.
- Description: In this case study, deepImageJ is utilized for detailed 3D nuclei segmentation, showcasing its capability in handling complex volumetric data. The pipeline involves the generation of ground truth data, followed by the use of StarDist for nuclei segmentation. The pipeline is then integrated into a macro for batch processing.
-
Files:
- Generated_GT.py: Script for generating ground truth data for 3D nuclei segmentation.
- Mount_stardist_dataset.py: Script for setting up the StarDist dataset for 3D segmentation.
- StarDist_postprocess_macro_cs2.ijm: ImageJ Macro for StarDist post-processing in Case Study 2.
- Notebooks: StarDist 2D
- Dataset: Developing Tribolium Castaneum Embryo from Cell Tracking Challenge
- Model: StarDist Model for Developing Tribolium Castaneum Embryo
Case Study 3: Segmentation of Arabidopsis Apical Stem Cells and Integration with the BioImage Model Zoo in deepImageJ
- Description: This case study involves the segmentation of Arabidopsis apical stem cells and demonstrates the integration with the BioImage Model Zoo using deepImageJ.
- Dataset: Research data supporting Cell size and growth regulation in the Arabidopsis thaliana apical stem cell niche
-
Models: 3D Unet Arabidopsis Apical Stem Cells with
emotional-cricketID for the BioImage Model Zoo
Introduction:
User Guide:
Model Developers Guide:

