Skip to content

MrDongZhenyu/napari-3Drendering

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

napari-3Drendering

This repository contains the codes and examples for generating 3D renderings using Napari, a fast, interactive, multi-dimensional image viewer for Python. While Napari is a powerful tool, there is a lack of comprehensive tutorials that provide a systematic approach for visualizing 3D data and creating videos, particularly for scientific papers. This repository aims to fill that gap.

Note: This repository is also used to generate 3D visualizations in the Analytic Fourier Ptychotomography (AFP) paper. Paper link, Project page.

Top-level folder structure:

├── Data                               # Data used for 3D visualiztion
├── utils.py                           # Subfunctions
├── Volumerendering_Embryo.ipynb       # A demo jupyter notebook code
└── README.md                          # Documentation (this file)

Table of Contents

Introduction

  • This code is designed for 3D rendering in Napari and provides several key functionalities:

    1. Add multiple 3D objects with Maximum Intensity Projection (MIP) rendering or other renderings.

    2. Customize colormaps for different channels.

    3. Add 3D bounding boxes to the volume.

    4. Edit axes and the scale bar.

    5. Adjust viewing angles and zoom levels.

    6. Overlay cross-sectional boxes onto the 3D visualization.

    7. Save screenshots of static views.

    8. Generate 3D rendering videos for dynamic presentations.

  • A demo code is provided in jupyter notebook: Volumerendering_Embryo.ipynb

Installation

  • Follow the installation instructions and then install a few additional required libraries and napari plugins (napari-bbox, napari-animation). For example:

    conda create -y -n napari-env -c conda-forge python=3.10
    conda activate napari-env
    
    pip install "napari[all]"
    pip install h5py os numpy jupyter matplotlib
    
    pip install napari-bbox
    pip install napari-animation
  • Note: After installing the napari_bbox plugin, open the file qt_bounding_box_control.py in the installation folder, and comment out the lines that import or use the QSlider module.

Data source

Please download the example data and put them in the 'Data' folder. The data are stored as .h5 file in Data/Reconstruction folder in Data link.

Example results

  1. Fixed mouse embryo (Eight cell stage)
Embryo_Eightcell_demo.mp4
  1. Fixed mouse embryo (Blasto stage)
Embryo_Blasto_demo.mp4
  1. 3D Pathology slide
Pathology_demo.mp4

Contact

This code is written and maintained by Zhenyu Dong. For any questions or comments about this code, please contact zdong@caltech.edu.

Citing the code

If the code was helpful to your work, please consider citing it (BibTeX):

@software{Dong_napari-3Drendering,
author = {Dong, Zhenyu},
title = {{napari-3Drendering}},
url = {https://github.com/MrDongZhenyu/napari-3Drendering}
}

About

3D volume rendering using napari

Resources

License

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors