3D Variational optical-flow motion estimation and correction for 2-photon microscopy 3D videos
Project description
🚧 Under Development
This project is still in an alpha stage. Expect rapid changes, incomplete features, and possible breaking updates between releases.
- The API may evolve as we stabilize core functionality.
- Documentation and examples are incomplete.
- Feedback and bug reports are especially valuable at this stage.
- GPU implementation currently produces numerical differences compared to the CPU version and might require different parameter settings.
flowreg3D
Python implementation of volumetric optical flow for motion correction in 3D fluorescence microscopy. Building on the 2D Flow-Registration insights, flowreg3D provides natively 3D dense motion analysis and correction with subpixel-precision for non-rigid motion volumetric microscopy data.
Related projects
- Flow-Registration: https://github.com/FlowRegSuite/flow_registration
- PyFlowReg: https://github.com/FlowRegSuite/pyflowreg
- ImageJ/Fiji plugin: https://github.com/FlowRegSuite/flow_registration_IJ
- Napari plugin: https://github.com/FlowRegSuite/napari-flowreg
Alignment of two 2P imaging stacks with difficult, synthetic non-rigid motion patterns.
Features
- 3D Variational Optical Flow: Directly estimates dense 3D motion fields between volumetric frames, capturing complex non-rigid deformations with subpixel accuracy.
- GPU Acceleration: Optional torch backend with fully GPU-optimized solver for fast processing of large 3D frames.
- Parallelized Processing: Efficiently handles long sequences of volumetric data.
Requirements
This code requires python 3.10 or higher.
Initialize the environment with
conda create --name flowreg3d python=3.10
conda activate flowreg3d
pip install -r requirements.txt
Installation via pip and conda
conda create --name flowreg3d python=3.10
conda activate flowreg3d
pip install flowreg3d
To install the project with GPU support, you can install it with the gpu extra:
pip install flowreg3d[gpu]
Getting started
[Examples and notebooks coming soon]
The plugin supports most of the commonly used file types such as HDF5, tiff stacks and matlab mat files. To run the motion compensation, the options need to be defined into a OF_options object.
Dataset
The 3D motion benchmark dataset used for our evaluations will be available for download soon. Meanwhile, synthetic test data with controllable 3D motion fields can be generated using the included motion_generation module, which creates biologically-informed displacement patterns including injection/recoil events, rotations, scanning jitter, and other microscopy-specific artifacts.
Citation
If you use parts of this code or the plugin for your work, please cite
"flowreg3D: Volumetric optical flow for motion analysis and correction in 3D fluorescence microscopy," (in preparation), 2025.
License
flowreg3D Non-commercial License
Copyright (c) 2025 Okinawa Institute of Science and Technology Graduate University. All rights reserved.
Redistribution and use for non-commercial purposes in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
The software is used solely for non-commercial purposes. It may not be used indirectly for commercial use, including operation on or for a website or service that receives advertising, sponsorship, or other revenue. For commercial use rights, contact Okinawa Institute of Science and Technology, OIST Innovation, at tls@oist.jp.
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
Neither the name of the Okinawa Institute of Science and Technology Graduate University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE OKINAWA INSTITUTE OF SCIENCE AND TECHNOLOGY GRADUATE UNIVERSITY AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT OF PATENTS, TRADEMARKS, OR OTHER PROPRIETARY RIGHTS, ARE DISCLAIMED. NO PATENT RIGHTS ARE GRANTED, WHETHER EXPRESSLY, BY IMPLICATION, ESTOPPEL, OR OTHERWISE. IN NO EVENT SHALL THE OKINAWA INSTITUTE OF SCIENCE AND TECHNOLOGY GRADUATE UNIVERSITY OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flowreg3d-0.1.0a1.tar.gz.
File metadata
- Download URL: flowreg3d-0.1.0a1.tar.gz
- Upload date:
- Size: 4.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e38af3819fa5c1ee96c0c358befa56dee8507d4cc3ae9050d102c9492f6bf23
|
|
| MD5 |
90c4693ba85e674a6e1de1190f982a58
|
|
| BLAKE2b-256 |
3467286899fddca5828745fd15f5b974ad23df9513beafdd74854b0dc840cbfa
|
Provenance
The following attestation bundles were made for flowreg3d-0.1.0a1.tar.gz:
Publisher:
pypi-release.yml on FlowRegSuite/flowreg3D
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flowreg3d-0.1.0a1.tar.gz -
Subject digest:
7e38af3819fa5c1ee96c0c358befa56dee8507d4cc3ae9050d102c9492f6bf23 - Sigstore transparency entry: 989244647
- Sigstore integration time:
-
Permalink:
FlowRegSuite/flowreg3D@9f37de414ce91877f5ad6a63a3bc995665228dca -
Branch / Tag:
refs/tags/v0.1.0a1 - Owner: https://github.com/FlowRegSuite
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-release.yml@9f37de414ce91877f5ad6a63a3bc995665228dca -
Trigger Event:
push
-
Statement type:
File details
Details for the file flowreg3d-0.1.0a1-py3-none-any.whl.
File metadata
- Download URL: flowreg3d-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 128.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58c07c7e4d7423d4a2e0c6791ff3102ecca99faac36a5c8f43710b60e161ab9f
|
|
| MD5 |
06d647566be875380bf2a9152a9b26bc
|
|
| BLAKE2b-256 |
0629822991747b854628e3711595b7aa91d74deb01f020fc25b04966af1f2b8d
|
Provenance
The following attestation bundles were made for flowreg3d-0.1.0a1-py3-none-any.whl:
Publisher:
pypi-release.yml on FlowRegSuite/flowreg3D
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flowreg3d-0.1.0a1-py3-none-any.whl -
Subject digest:
58c07c7e4d7423d4a2e0c6791ff3102ecca99faac36a5c8f43710b60e161ab9f - Sigstore transparency entry: 989244741
- Sigstore integration time:
-
Permalink:
FlowRegSuite/flowreg3D@9f37de414ce91877f5ad6a63a3bc995665228dca -
Branch / Tag:
refs/tags/v0.1.0a1 - Owner: https://github.com/FlowRegSuite
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-release.yml@9f37de414ce91877f5ad6a63a3bc995665228dca -
Trigger Event:
push
-
Statement type: