Skip to main content

A plugin for optical projection tomography reconstruction with model-based neural networks.

Project description

tomopari

License MIT PyPI Python Version

codecov napari hub

A plugin for optical projection tomography reconstruction with model-based neural networks.


This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-plugin template.

🔬 Introduction

tomopari is a napari plugin that enables users to easily reconstruct tomography images directly from raw projection data. Simply load an ordered stack of projection files into the napari viewer, and the plugin takes care of reconstructing the corresponding tomographic volume.

🚀 Usage

  1. Load ordered stack
    plot

    Go to File → Open Files as Stack... and load the angular projections for parallel beam optical tomography reconstruction.

    After loading, the stack of θ-angular projection images should have shape of $N_{angles} × det_h × det_w$, where:

    • $N_{angles}$ is the number of projection views (one image per rotation angle θ),
    • $det_h$ is the detector height (vertical pixel dimension),
    • $det_w$ is the detector width (horizontal pixel dimension).
  2. Select image layer
    plot

    In the dropdown menu, click Select image layer and choose the loaded volume.

From here you can choose between two reconstruction modes: Basic and Advanced.

🔹 Basic Mode

plot

  1. Half-rotation

    • Click Half rotation if your projection data was acquired from 0° to 180°.
    • Leave it unchecked if data was acquired from 0° to 360°.
  2. Automatic axis alignment
    If the rotation axis is not correctly aligned during acquisition, enable Automatic axis alignment. This aligns the sinogram to the detector center using the Wall-method.

  3. Compression
    Compression affects the detector dimension differently depending on the acquisition mode:

    • Vertical-axis mode → the $det_w$ will be resized
    • Horizontal-axis mode → the $det_h$ will be resized

    Available compression levels:

    • HIGH → resize to 100
    • MEDIUM → resize to 256
    • LOW → resize to 512
    • NO → no compression
  4. Reconstruction method

    • FBP CPU / FBP GPU → from the QBI_radon library
    • TOMODL CPU / TOMODL GPU / UNET CPU / UNET GPU → proposed in our ToMoDL-paper
  5. Smoothing level
    Select smoothing strength (only applies to TOMODL methods). Can be more fine tuned in the Advanced mode.

    • LOW → 2
    • MEDIUM → 4
    • HIGH → 6
  6. Rotation axis
    Select how your data is organized with respect to the rotation axis:

    • Vertical → $det_w$ corresponds to the axis perpendicular to rotation.
    • Horizontal → $det_h$ corresponds to the axis perpendicular to rotation.

🔹 Advanced Mode

plot

  1. Manual axis alignment
    Shift the object along $det_w$ in vertical mode, and along $det_h$ in horizontal mode.

    • Negative values → shift left (toward lower pixel indices)
    • Positive values → shift right (toward higher pixel indices)
  2. Reshape volume
    Select a reconstruction size (alternative to compression levels from Basic mode).

  3. Flat-field correction
    Apply flat-field correction to projection data before reconstruction.

  4. Clip to circle
    Constrain the reconstructed object inside a circular region.

  5. Filter (FBP only)
    Choose the filter to apply when using FBP methods.

  6. Full volume mode

    • Enabled → reconstruct the whole volume.
  7. One Slice mode

    • Enabled → reconstruct only a single slice at the Slice # index.
  8. Slices mode

    • Enabled → reconstruct from index 0 up to the chosen slice index in the Slice # field.
  9. Batch size
    Number of slices processed simultaneously:

    • Higher values → faster reconstruction but greater GPU memory usage.
    • On CPU → limited to processing 1 slice at a time.
  10. Invert colors
    Invert grayscale values in the reconstructed volume.

  11. 16-bit conversion
    The reconstructed volume is always generated in 32-bit float precision. Enable this option to convert the final volume to 16-bit, which significantly improves 3D rendering performance in napari. Leave it unchecked if you prefer to keep the full 32-bit float output.


  1. Reconstruct!

plot

A new layer will appear on top of the projections stack with the reconstructed volume.

💻 Installation Guide (No Code — Highly Recommended)

🧩 Step 1: Install Napari (Bundled App)

💡 Skip this step if you already installed Napari via pip.

You can directly download the official Napari bundled installer for your operating system:

📘 Official Guide: Follow the Napari documentation for detailed installation steps: 🔗 Napari Installation Guide (Bundled App)


⚙️ Step 2: Install PyTorch Inside Napari’s Bundled Environment

💡 Skip this step if PyTorch is already installed in your Napari environment.

This step ensures PyTorch is properly installed within Napari’s internal Conda environment for full compatibility.

🪟 Windows Users

  1. Download the installer: 🔗 install_torch2napari_windows.bat
  2. Double-click the .bat file to run it. (It will automatically detect Napari’s environment and install PyTorch.)

🐧 Linux Users

  1. Download the installer: 🔗 install_torch2napari_linux.sh

  2. Run it in your terminal:

    bash install_torch2napari_linux.sh
    

3️⃣ Install our plugin — tomopari

Our plugin is available on the napari-hub.

🔹 Option 1: Install directly from napari

  1. Open napari.
  2. Go to Plugins → Install/Uninstall Plugins.
  3. Search for tomopari and click Install.

🔹 Option 2: Install via pip (from Napari Console) Open napari’s Python Console and type:

pip install tomopari

After installation, restart napari to apply the changes. 😊

🤝 Contributing

Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.

📜 License

Distributed under the terms of the MIT license, "tomopari" is free and open source software

🐛Issues

If you encounter any problems, please [file an issue] along with a detailed description.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tomopari-0.1.0.tar.gz (877.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tomopari-0.1.0-py3-none-any.whl (873.3 kB view details)

Uploaded Python 3

File details

Details for the file tomopari-0.1.0.tar.gz.

File metadata

  • Download URL: tomopari-0.1.0.tar.gz
  • Upload date:
  • Size: 877.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for tomopari-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5114de30830cc40bf1005edbf481939707f20f96e00c3192f082fb348277c138
MD5 9ef990dc6dde505f9ecf78a5e68136a9
BLAKE2b-256 0381d81e241969e7c35a65e74f3825aae11820e9cbcbbd90dbbc6bee18aa5de4

See more details on using hashes here.

File details

Details for the file tomopari-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tomopari-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 873.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for tomopari-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b16e31bc47886bdcfdd13493ca5d327ece96d827a94a5450c4a3c20e55f1c51
MD5 ed61aa0f9cd567cd5a9d4fea7257b9ce
BLAKE2b-256 0f9dfcacc77267195110eaeb134262201c2f90a5a03538798445ea954fd937fe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page