napari-timelapse-processor
meta plugin to ease processing timelapse image data
API
This plugin exposes two principal funcionalities:
TimelapseConverter
The TimelapseConverter class allows you to stack or unstack any of the supported napari layers from 4D data into a list of 3D layers or vice versa. Currently supported layers are:
napari.layers.Imagenapari.layers.Labelsnapari.layers.Pointsnapari.layers.Vectorsnapari.layers.Surface
napari.layers.Tracks are intrinsically 4D and thus not supported.
Unstacking example usage:
from napari_timelapse_processor import TimelapseConverter
import numpy as np
image_4d = np.random.rand(10, 32, 32, 32) # 10 timepoints of 32x32x32 data
converter = TimelapseConverter()
list_of_images = converter.unstack(image_4d, layertype='napari.types.ImageData')
Stacking example usage:
from napari_timelapse_processor import TimelapseConverter
import numpy as np
random_points = [np.random.rand(10, 3) for _ in range(10)] # 10 timepoints of 10 random 3D points
converter = TimelapseConverter()
# stack the points into a single 4D layer
stacked_points = converter.stack(random_points, layertype='napari.types.PointsData')
The TimeLapseConverter class also supports (un)stacking the napari.layers.Layer type (and its above-listed subclasses). Importantly, features that are associated with the respective layer are also (un)stacked.
Layer example usage
from napari_timelapse_processor import TimelapseConverter
import numpy as np
from napari.layers import Points
import pandas as pd
random_points = [np.random.rand(10, 3) for _ in range(10)] # 10 timepoints of 10 random 3D points
random_features = [pd.DataFrame(np.random.rand(10)) for _ in range(10)] # 10 timepoints of 10 random feature values
# create a list of 10 Points layers
points = [Points(random_points[i], properties=random_features[i]) for i in range(10)]
converter = TimelapseConverter()
stacked_points = converter.stack(points, layertype='napari.layers.Points')
frame_by_frame
The frame-by-frame functionality provides a decorator that will inspect the decorated function for TimelapseConverter-compatible arguments and, if a 4D value is passed as argument, will automatically (un)stack the data before and after the function call. This allows for a more intuitive API when working with timelapse data. Currently supported type annotations are:
napari.types.ImageDatanapari.types.LabelsDatanapari.types.PointsDatanapari.types.VectorsDatanapari.types.SurfaceDatanapari.layers.Layernapari.layers.Imagenapari.layers.Labelsnapari.layers.Pointsnapari.layers.Vectorsnapari.layers.Surface
Additionally, the frame_by_frame supports parallelization with dask.distributed. To use it, simply pass the use_dask=True argument to the decorated function, even if the function itself does not require this argument. The decorater will then automatically parallelize the function call over the time-axis and remove the use_dask argument when calling the function.
Example interactive code usage: If you want to use the frame_by_frame functionality in, say, a Jupyter notebook, use it like this:
from napari_timelapse_processor import frame_by_frame
import numpy as np
def my_function(image: 'napari.types.ImageData') -> 'napari.types.ImageData':
return 2 * image
image_4d = np.random.rand(10, 32, 32, 32) # 10 timepoints of 32x32x32 data
image_4d_processed = frame_by_frame(my_function)(image_4d) # without dask
image_4d_processed = frame_by_frame(my_function)(image_4d, use_dask=True) # with dask
Example napari code If you want to use the frame_by_frame functionality in a napari plugin, use it like this:
from napari_timelapse_processor import frame_by_frame
@frame_by_frame
def my_function(image: 'napari.types.ImageData') -> 'napari.types.ImageData':
return 2 * image
Hint: The frame_by_frame functionality runs under the assumption that input napari-data (e.g., an Image, a Surface, Points, etc) are always arguments and any other parameters are always keyword arguments. If this is not the case, the decorator will not work as intended.
# This works
frame_by_frame(my_function)(image_4d, some_parameter=2, use_dask=True)
# This does not work
frame_by_frame(my_function)(image=image_4d, some_parameter=2, use_dask=True)
This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-plugin template.
Installation
You can install napari-timelapse-processor via pip:
pip install napari-timelapse-processor
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 BSD-3 license, "napari-timelapse-processor" is free and open source software
Issues
If you encounter any problems, please [file an issue] along with a detailed description.
Metadata
Release files for napari-timelapse-processor 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| napari_timelapse_processor-0.1.1.tar.gz | 19.7 kB | With provenance | Details for napari_timelapse_processor-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| napari_timelapse_processor-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for napari_timelapse_processor-0.1.1-py3-none-any.whl |
Total release size: 35.5 kB
Release files / napari_timelapse_processor-0.1.1.tar.gz
| Download URL | napari_timelapse_processor-0.1.1.tar.gz |
|---|---|
| Size | 19.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8dc98888bb1a7c3895ffff01c1217b4812eee0f4f27bbb7f005c7c86c1221974
|
|
BLAKE2b-256 checksum How to use checksums |
cef761c88b9def82da19f4d0202bc38c34951cea9932819414b8397d56712f14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 16, 2025.
Transparency logRelease files / napari_timelapse_processor-0.1.1-py3-none-any.whl
| Download URL | napari_timelapse_processor-0.1.1-py3-none-any.whl |
|---|---|
| Size | 15.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
94a61475853fbbe17066b7d2e83ea32d5ef891fd71782cb9590dfa607358092a
|
|
BLAKE2b-256 checksum How to use checksums |
e6d6c57471ccc3a6d0b320d223e2e20575e5f217d7140ddefd9823f808e30b9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 16, 2025.
Transparency logSecurity for napari-timelapse-processor 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for napari_timelapse_processor-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 16, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.