NanoObjectDetection 2.0
This is a new Version of Ronny Foersters Package. The old Package had lots of issues with type safety and RAM usage. This new implementation aims to improve RAM usage and enable us to easily develop new features.
NanoObjectDetection analyzes TIFF image stacks of diffusing particles. It localizes particles, links detections into trajectories, estimates diffusion and hydrodynamic diameter, and exports analysis tables and plots. Version 2.0 keeps compatibility with the 1.0 parameter format and adds blockwise processing and optional CUDA acceleration.
The source checkout also contains the original 1.0 implementation in
nanoobjectdetection_legacy/; the installable
distribution packages the modern pipeline under the nanoobjectdetection
package. For full parameter descriptions,
scientific methods, compatibility details, limitations, and output-file
definitions, see the
2.0 documentation.
Features
- TIFF stack input with spatial and frame-range ROI selection.
- Camera-offset, laser-fluctuation, static-background, and optional SNR preprocessing.
- Trackpy particle localization and trajectory linking, including optional stitching for repeatedly lost single-particle detections.
- Fixed-particle filtering, trajectory quality checks, and global drift correction.
- Mean-squared displacement analysis, diffusion estimation, and Stokes-Einstein hydrodynamic diameter calculations.
- Optional channel hindrance correction, including position-aware correction.
- Single Particle Tracking using stitched Trajectories
- RAM saving options: Single-stack and chunked execution modes, plus optional CUDA preprocessing, Optional Conversion of pixels to 8bit depth, 16bit is probably overkill.
- CSV tables, compatibility output names, run configuration, and plots.
New Features
- Try to implement them on your own! AI is powerful and easy too use. You can then try to submit a merge request here.
Issues
- 1st Try to solve the issue yourself with AI -> if its a bug caused by this repo, not your local installation open an Issue or write me a detailed Bug report on Slack. Paste console logs or anything that helps me solve your issue.
Installation
From PyPI (Recommended)
Install the latest release directly via pip:
python -m pip install --upgrade pip
python -m pip install nanoobjectdetection
For GPU acceleration with CUDA 12.x:
python -m pip install "nanoobjectdetection[gpu]"
From Source Checkout
Download this repo as a .zip file and unpack it, or clone via Git.
From the repository folder, activate your environment and install:
python -m pip install --upgrade pip
python -m pip install .
To install an editable development copy instead, use python -m pip install -e . from the repository folder.
The installation adds the nanoobjectdetection CLI command. It can be run from
any working directory:
nanoobjectdetection --input-file "path/to/stack.tif" --output-dir "path/to/output"
Python Example & Scripting
The recommended way to use the package is to adjust analysis parameters in an example script. Run the included example/example.py from any directory:
python "example/example.py" `
--input-file "path/to/my_stack.tif" `
--output-dir "path/to/my_analysis" `
--background-stack-storage disk `
--processing-bit-depth 8 `
--dimension all
The script imports run directly from the installed package:
from nanoobjectdetection import run
Its PARAMETERS dictionary and processing settings near the top of
example/example.py expose the full analysis configuration for editing. Omit
--parameter-file to use those settings; optionally add
--parameter-file "path/to/parameter.json" to use a legacy JSON instead.
Input/output paths can be configured directly inside the script or passed as CLI options.
Run python example/example.py --help for all options.
Optional GPU preprocessing
GPU mode requires a supported NVIDIA GPU, a compatible CUDA runtime, and the matching CuPy package. For CUDA 12.x, install the package's GPU extra:
python -m pip install ".[gpu]"
If your CUDA version differs, install the CuPy package matching your CUDA runtime instead. The pipeline reports an error if GPU mode is requested but a usable CUDA device is unavailable. Trackpy localization, linking, and MSD fitting remain CPU operations.
Run from an IDE
The source main.py defaults to the included example TIFF and can be run
directly from VS Code, PyCharm, or another Python IDE:
- Open the repository folder in your IDE.
- Select the Python interpreter from the
.venvenvironment created above. In VS Code, use Python: Select Interpreter; in PyCharm, select the project interpreter in the Python interpreter settings. - Run
main.pywith the IDE's Run Python File or Run action to analyze the included example.
For your own data, use the installed command with a parameter JSON rather than
editing main.py. Review camera calibration, acquisition rate, temperature,
viscosity, channel dimensions, ROI, and Trackpy settings in that JSON.
Run from a terminal
Run an installed analysis from any folder in PowerShell:
nanoobjectdetection `
--parameter-file "C:\data\parameter.json" `
--input-file "C:\data\my_stack.tif" `
--output-dir "C:\data\my_analysis" `
--processing-mode single_stack `
--background-stack-storage disk `
--processing-bit-depth 8
To install the package from another folder or drive, use its repository path:
python -m pip install "D:\Python\NanoObjectDetection"
The source script can also be run with options from the repository folder:
python .\main.py `
--input-file "C:\data\my_stack.tif" `
--output-dir "C:\data\my_analysis" `
--processing-mode single_stack `
--dimension 2d `
--background-stack-storage disk
To use a legacy-format parameter file:
python .\main.py `
--parameter-file ".\example\parameter.json" `
--input-file ".\example\20_6µmKap_50Au_20_7C_100fps_5000fr_700us_V1j.tif" `
--output-dir ".\example\my_analysis" `
--processing-mode chunked
The input and output command-line paths override the corresponding paths in
the parameter JSON. If --parameter-file is omitted, the analysis settings
defined in main.py are used.
Available command-line options:
| Option | Purpose |
|---|---|
--processing-mode single_stack |
Read frames directly from the TIFF; this is the default. |
--processing-mode chunked |
Store/process the selected stack in blocks, useful for large inputs. |
--background-stack-storage memory |
Keep the background stack used for subtraction in RAM (default). |
--background-stack-storage disk |
Use a temporary disk-backed stack; needs free space approximately equal to the selected-depth ROI stack. |
--processing-bit-depth 16 |
Preserve the input pixel values (default). |
--processing-bit-depth 8 |
For uint16 input, keep the high 8 bits (value >> 8) for stored/raw processing data; halves raw/background stack storage but discards low-bit precision. |
--dimension all |
Analyze x, y, and 2d trajectories; this is the default. |
--dimension x, --dimension y, --dimension 2d |
Calculate only the selected trajectory dimension. |
--gpu |
Enable GPU preprocessing; requires compatible CuPy/CUDA installation. |
--input-file PATH |
Select the TIFF stack to analyze. |
--output-dir PATH |
Select where results are written. |
--parameter-file PATH |
Load analysis settings from a legacy-format JSON file. |
Disk-backed background storage preserves the same calculation as memory storage at the selected bit depth and removes its temporary stack file after localization. It can use more disk I/O and run more slowly than keeping the stack in RAM.
8-bit processing is opt-in and quantizes uint16 values by shifting right eight bits; it is not equivalent to the default 16-bit analysis and can change background subtraction and particle detections. It reduces raw and background stack storage by about half, but not total process memory because processing also uses float32 working arrays. For uint8 TIFF input, this option leaves the pixel values unchanged.
Chunking reduces localization working-block size, but does not make the exact stack-wide static-background calculation bounded-memory. When that preprocessing option is enabled, the selected ROI stack must fit in RAM even in chunked mode. Reduce the ROI or frame range if memory is insufficient.
See the 2.0 documentation for the complete list of supported settings, generated files, assumptions, and known limitations.
Metadata
Release files for nanoobjectdetection 2.0.0
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 |
|---|---|---|---|---|
| nanoobjectdetection-2.0.0.tar.gz | 52.3 kB | With provenance | Details for nanoobjectdetection-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nanoobjectdetection-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for nanoobjectdetection-2.0.0-py3-none-any.whl |
Total release size: 111.5 kB
Release files / nanoobjectdetection-2.0.0.tar.gz
| Download URL | nanoobjectdetection-2.0.0.tar.gz |
|---|---|
| Size | 52.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c48c348e1bd88ddfd1d016e722dfb6e6f2bbc35456ccb339f7130eca5e6c2f59
|
|
BLAKE2b-256 checksum How to use checksums |
94d852b971091201b09769c297c578968196e337a6e189da74e307c27c042808
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 29, 2026.
Transparency logRelease files / nanoobjectdetection-2.0.0-py3-none-any.whl
| Download URL | nanoobjectdetection-2.0.0-py3-none-any.whl |
|---|---|
| Size | 59.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
581138a66ce8b8ffeb6ecd65dd6f896645ee60e1c3c0a355c39970563692628c
|
|
BLAKE2b-256 checksum How to use checksums |
7dd099feab341453ae2eb288a660a928eadfb418a0b4d9a22958a13a580bf760
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 29, 2026.
Transparency logSecurity for nanoobjectdetection 2.0.0
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
Both files in this release have been uploaded with provenance metadata.
Attestation for nanoobjectdetection-2.0.0.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 Oct 29, 2026.
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.