Skip to content

Create a new core library for DataLab: sigimaΒ #166

Open
@PierreRaybaut

Description

@PierreRaybaut

πŸŽ‰ New repository

Here is the associated repository: https://github.com/DataLab-Platform/sigima

✨ Objective

Create a standalone Python package named datalab-processing that consolidates the computation engine, data I/O logic (except HDF5), and the simple XML-RPC client for DataLab.

This package will serve as the non-GUI backend for DataLab, and provide reusable functionality for headless applications and remote control workflows.


πŸ”§ Scope of sigima

The datalab-processing package will include:

  • 🧠 Signal and image processing logic (BaseProcessor, SignalProcessor, ImageProcessor)
  • πŸ—ƒοΈ I/O and file format support for signals and images (except HDF5)
  • 🧩 I/O plugin system (moved out of the GUI package)
  • πŸ§ͺ Internal validation and test datasets (optional)
  • 🚦 Type annotations and compatibility with mypy, pytest, and other quality tools

Options (to be discussed):

  • πŸ›°οΈ Lightweight XML-RPC client to control a remote instance of DataLab

Note: HDF5 file handling will temporarily remain in datalab-app, but all other input/output logic (including the plugin mechanism for custom readers/writers) will be moved to sigima.


βœ… To Extract into sigima

1. cdl.algorithms

  • βœ… All core functions operating on raw NumPy arrays
  • πŸ” Refactored under sigima.algorithms

2. cdl.computation

  • βœ… All functions operating on SignalObj and ImageObj
  • πŸ” Refactored into two top-level modules:
    • sigima.signal β†’ for SignalObj-based operations
    • sigima.image β†’ for ImageObj-based operations

3. cdl.core.model

  • ⏳ Partially extract:
    • SignalObj, ImageObj
    • Other basic computation-related objects (e.g. wrappers for result types)
  • ❌ Leave GUI- or application-specific classes in DataLab
  • πŸ” Refactored under sigima.datatypes

4. cdl.core.io

  • ⏳ Partially extract:
    • I/O for signals/images that are not tied to HDF5 or GUI persistence
    • ❌ Exclude HDF5-specific or GUI-related I/O
  • πŸ” Refactored under sigima.io

5. cdl.plugins

  • ❌ Do not reuse existing plugin classes (tightly coupled to DataLab GUI)
  • βœ… Instead, define a clean plugin interface under sigima.plugins
    • For extendable compute operations

6. cdl.tests

  • βœ… Migrate tests related to:
    • cdl.algorithms
    • cdl.computation
  • πŸ” Refactor under tests/ in sigima, preserving coverage

7. cdl.utils

  • ⏳ Only migrate utility functions strictly required by above modules
  • πŸ” Refactor and isolate as sigima.utils (minimal)

8. Test Infrastructure & Data

  • βœ… Migrate reusable parts:
    • tests.data/
    • Core test helpers
    • CI-compatible test layout

πŸ”„ Refactoring Considerations

  • βœ… Isolate any dependency on cdl.config, cdl.qt, or cdl.app
  • βœ… Ensure standalone execution with no Qt/UI import chain
  • βœ… Prepare pyproject.toml with optional plugin extras

πŸ“‚ Proposed Package Layout

sigima/
β”œβ”€β”€ algorithms/           # NumPy-based processing functions
β”œβ”€β”€ signal/               # SignalObj-based operations (e.g., normalize, filter, resample)
β”‚   β”œβ”€β”€ __init__.py
β”‚   └── processing.py
β”œβ”€β”€ image/                # ImageObj-based operations (e.g., ROI, threshold, morphology)
β”‚   β”œβ”€β”€ __init__.py
β”‚   └── filters.py
β”œβ”€β”€ datatypes/            # SignalObj, ImageObj, Result wrappers
β”œβ”€β”€ io/                   # Portable I/O for signal/image
β”œβ”€β”€ plugins/              # Plugin architecture for compute functions
β”œβ”€β”€ utils/                # Minimal utilities used by core modules
β”œβ”€β”€ tests/                # Pytest-compatible test suite
β”‚   β”œβ”€β”€ data/             # Test images/signals
β”‚   └── ...
β”œβ”€β”€ __init__.py
└── pyproject.toml

πŸ“Œ Notes

  • The name sigima emphasizes the unification of signal and image processing logic.
  • GUI-specific functionality remains in datalab-app.
  • The library will be MIT-licensed and documented as a reusable scientific computing core.
  • With this structure, common imports become clean and readable:
from sigima.signal import normalize
from sigima.image import enhance_contrast

🚧 Tasks

  • Extract computation and non-HDF5 I/O logic from cdl/ into sigima/
  • Migrate the plugin-based I/O mechanism for signals/images
  • Clean up internal dependencies and prepare pyproject.toml structure
  • (eventually) Integrate the simple XML-RPC client (previously cdlclient)
  • Write unit tests and CI configuration (GitHub Actions)
  • Add Sphinx documentation and usage examples
  • Publish to PyPI as sigima

πŸ“Œ Context

This package replaces and unifies:

  • the computational backend of the original DataLab codebase (cdl)
  • (eventually) the external cdlclient RPC wrapper
  • the future programmatic API surface of DataLab (headless usage, scripting, integration)

It complements:

  • datalab-app: GUI frontend (HDF5 support remains here temporarily)
  • sigimax: reusable GUI components and infrastructure

πŸ”— Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions