The derotation package offers a robust solution for reconstructing multiphoton movies of rotating samples acquired with a line scanning microscope.
On the left, the mean image of a 3-photon movie in which the sample was rotating. In the center, the mean image after derotation, and on the left the mean image of the derotated movie after suite2p registration. As you can see, already after derotation the cells are visible and have well defined shapes.
Install the latest stable release in a conda environment:
conda create -n derotation-env python=3.12
conda activate derotation-env
pip install derotation
Note
Read the documentation for more information, including examples and API reference.
To address certain neuroscience questions, it might be necessary to image the brain while the head of the animal rotates. In such a case, and even more when the frame rate is low, the acquired movies are distorted by the rotation. These distortions have a peculiar pattern due to the line scanning nature of the microscope, which can be corrected by the derotation package.
With derotation
you can:
- Recover calcium imaging movies by line-by-line derotation that can be fed into standard analysis pipelines such as suite2p
- Estimate the center of rotation using Bayesian optimization
- Validate improvements to the derotation algorithm and pipelines using synthetic data
- Verify the quality of the derotation using debugging plotting tools
- Batch-process multiple datasets with consistent configuration files
Warning
🏗️ The package is currently in early development and it requires rotation information coming from a step motor.
All microscopy data presented here as an example has been acquired with a 3-photon microscope by Simon Weiler in the Margrie Lab.
This project was sponsored by the Margrie Lab in the Sainsbury Wellcome Centre for Neural Circuits and Behaviour at University College London.
Previous work on derotation of calcium imaging movies:
- Velez-Fort et al., 2018, Neuron
- Hennestad et al., 2021, Cell Reports
- Sit & Goard, 2023, Nature Communications
- Voigts & Harnett, 2020, Neuron
This package was inspired by previous MATLAB script on derotation.
Contributions to derotation
are encouraged, whether to fix a bug, develop a new feature, or improve documentation. Get in touch through our Zulip chat.
Open an issue to report a bug or request a new feature.