Skip to main content

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

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:

  1. Open the repository folder in your IDE.
  2. Select the Python interpreter from the .venv environment created above. In VS Code, use Python: Select Interpreter; in PyCharm, select the project interpreter in the Python interpreter settings.
  3. Run main.py with 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.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nanoobjectdetection 2.1.1
File Size Uploaded Provenance Actions
nanoobjectdetection-2.1.1.tar.gz 52.3 kB With provenance Details for nanoobjectdetection-2.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nanoobjectdetection 2.1.1
File Interpreter ABI Platform Actions
nanoobjectdetection-2.1.1-py3-none-any.whl Python 3 none any Details for nanoobjectdetection-2.1.1-py3-none-any.whl

Total release size: 111.3 kB

Release files / nanoobjectdetection-2.1.1.tar.gz

Download URL nanoobjectdetection-2.1.1.tar.gz
Size 52.3 kB
Tags Source
SHA-256 checksum
How to use checksums
dc0f8f7361c4aeebd48106e2076faba2c925c2857a418e2ff4e180c4f4b12084
BLAKE2b-256 checksum
How to use checksums
1833efa2eb188226075d2675cdb8a4b0036092ff672ae8755e23d0d9c9298e35
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 Nov 3, 2026.

Transparency log

Release files / nanoobjectdetection-2.1.1-py3-none-any.whl

Download URL nanoobjectdetection-2.1.1-py3-none-any.whl
Size 59.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0131e063edca7ae463d1e8dd78a2eeb4290c5e9d3be81bd79903552e2a79550b
BLAKE2b-256 checksum
How to use checksums
0a0d61b5205c7703d6c7dc54c03c33ebc90169a61d29415192ae6f1a6a7db47c
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 Nov 3, 2026.

Transparency log

Security for nanoobjectdetection 2.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nanoobjectdetection-2.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 Nov 3, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page