{
  "name": "napari-feature-classifier",
  "display_name": "napari feature classifier",
  "visibility": "public",
  "icon": null,
  "categories": [],
  "schema_version": "0.3.0",
  "on_activate": null,
  "on_deactivate": null,
  "contributions": {
    "commands": [
      {
        "id": "napari-feature-classifier.annotator_init_widget",
        "title": "Annotator",
        "python_name": "napari_feature_classifier.annotator_init_widget:InitializeLabelAnnotatorWidget",
        "short_title": null,
        "category": null,
        "icon": null,
        "enablement": null
      },
      {
        "id": "napari-feature-classifier.initialize_classifier_new",
        "title": "Initialize a Classifier",
        "python_name": "napari_feature_classifier.classifier_widget:ClassifierWidget",
        "short_title": null,
        "category": null,
        "icon": null,
        "enablement": null
      },
      {
        "id": "napari-feature-classifier.load_classifier",
        "title": "Load a Classifier",
        "python_name": "napari_feature_classifier.classifier_widget:LoadClassifierContainer",
        "short_title": null,
        "category": null,
        "icon": null,
        "enablement": null
      },
      {
        "id": "napari-feature-classifier.load_csv_features",
        "title": "CSV Feature loader",
        "python_name": "napari_feature_classifier.feature_loader_widget:load_features_factory",
        "short_title": null,
        "category": null,
        "icon": null,
        "enablement": null
      }
    ],
    "readers": null,
    "writers": null,
    "widgets": [
      {
        "command": "napari-feature-classifier.annotator_init_widget",
        "display_name": "Annotator",
        "autogenerate": false,
        "default_dock_area": "right",
        "tabify": false
      },
      {
        "command": "napari-feature-classifier.initialize_classifier_new",
        "display_name": "Initialize a Classifier",
        "autogenerate": false,
        "default_dock_area": "right",
        "tabify": false
      },
      {
        "command": "napari-feature-classifier.load_classifier",
        "display_name": "Load Classifier",
        "autogenerate": false,
        "default_dock_area": "right",
        "tabify": false
      },
      {
        "command": "napari-feature-classifier.load_csv_features",
        "display_name": "CSV Feature loader",
        "autogenerate": false,
        "default_dock_area": "right",
        "tabify": false
      }
    ],
    "sample_data": null,
    "themes": null,
    "menus": {},
    "submenus": null,
    "keybindings": null,
    "configurations": {}
  },
  "package_metadata": {
    "metadata_version": "2.5",
    "name": "napari-feature-classifier",
    "version": "0.5.0",
    "dynamic": null,
    "platform": null,
    "supported_platform": null,
    "summary": "An interactive classifier plugin to use with label images and feature measurements",
    "description": "# napari-feature-classifier\n\n[![License](https://img.shields.io/pypi/l/napari-feature-classifier.svg?color=green)](https://github.com/fractal-napari-plugins-collection/napari-feature-classifier/raw/main/LICENSE)\n[![PyPI](https://img.shields.io/pypi/v/napari-feature-classifier.svg?color=green)](https://pypi.org/project/napari-feature-classifier)\n[![Python Version](https://img.shields.io/pypi/pyversions/napari-feature-classifier.svg?color=green)](https://python.org)\n[![tests](https://github.com/fractal-napari-plugins-collection/napari-feature-classifier/workflows/tests/badge.svg)](https://github.com/fractal-napari-plugins-collection/napari-feature-classifier/actions)\n[![codecov](https://codecov.io/gh/fractal-napari-plugins-collection/napari-feature-classifier/branch/main/graph/badge.svg)](https://codecov.io/gh/fractal-napari-plugins-collection/napari-feature-classifier)\n[![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/napari-feature-classifier)](https://napari-hub.org/plugins/napari-feature-classifier)\n\nAn interactive classifier plugin for napari that lets you annotate objects in a label image and train a random forest classifier to generalize those annotations across all objects — without leaving the viewer.\n\n![napari-feature-classifier](https://github.com/user-attachments/assets/e1a3156a-bc78-442e-9294-f81aba503ee4)\n\n## When to use this\n\nThis plugin is designed for tasks where visual inspection defines the ground truth:\n- Classifying cell types (e.g. mitotic vs. interphase cells)\n- Quality control (flagging mis-segmented objects)\n- Any labeling task where you can recognize the classes by eye but want to scale it to thousands of objects automatically\n\nYou need: a **label image** and a **feature table** — measurements per object (area, intensity, shape descriptors, etc.) stored in `layer.features`. The classifier learns from your manual annotations and applies those patterns to every object.\n\n## Usage\n\n### 1. Prepare your label layer\n\nLoad your label image into napari and attach feature measurements to `layer.features` of that layer. You can have multiple label layers open at once — the classifier handles them all.\n\nYour feature table must have:\n- A `label` column matching the integer labels in the image\n- A `roi_id` column identifying which image each row belongs to (used when training on multiple images)\n\n**Ways to load features:**\n- From an OME-Zarr file: use [napari-ome-zarr-navigator](https://github.com/fractal-napari-plugins-collection/napari-ome-zarr-navigator), which handles correct loading of both the label image and the feature table and populates the `roi_id` column automatically.\n- From a CSV file: `Plugins → napari-feature-classifier → CSV Feature Loader`, then select the label layer and point to the CSV.\n- Programmatically: `label_layer.features = your_dataframe`\n\n### 2. Initialize a classifier\n\nGo to `Plugins → napari-feature-classifier → Initialize a Classifier`.\n\n<img width=\"1000\" alt=\"classifier_init\" src=\"https://github.com/user-attachments/assets/05a2495a-b7fd-40be-bd9c-607177c0aa68\" />\n\n\n- Select the features to use for training. Hold Cmd/Ctrl to select multiple. The feature list reflects the currently selected label layer.\n- Name your classes (e.g. \"Mitotic\", \"Interphase\"). Classes without a name won't be created.\n- Click **Initialize**.\n\n> Feature selection is fixed after initialization. If you want different features, start a new classifier.\n\n### 3. Annotate and train\n\n<img width=\"1000\" alt=\"classifier_annotation\" src=\"https://github.com/user-attachments/assets/25a9c90a-0d58-4fc2-92df-9006cdae00aa\" />\n\n\n- Select your label layer in the napari layer list.\n- Pick a class using the panel buttons or keyboard shortcuts (keys **1–9** for classes, **0** to deselect).\n- Click on label objects in the viewer to annotate them.\n- The live count display shows how many objects you've annotated per class across all open images.\n- Once you have at least a handful of examples per class (aim for 10+), click **Run Classifier**.\n\nThe classifier splits your annotations 80/20 into training and test sets, trains a random forest, and applies it to all objects. Predictions appear as a color-coded **Predictions** layer.\n\n<img width=\"1000\" alt=\"classifier-predict\" src=\"https://github.com/user-attachments/assets/273d696f-669f-4d01-88e4-e74e204a066d\" />\n\nCorrect mistakes the classifier made and click Run Classifier again to improve it. Iterative annotation is the intended workflow.\n\n### 4. Save and reload\n\nAfter each run, the classifier auto-saves to a `.clf` file named after the label layer (in the current working directory). To save to a different location: expand **▶ Saving & Export** and click **Save Classifier As…**.\n\nTo resume work or apply a trained classifier to new images:\n`Plugins → napari-feature-classifier → Load Classifier`\n\nSelect the `.clf` file, make sure your label layers with features are already open, and click **Load Classifier**. \n\n### 5. Export results\n\nExpand **▶ Saving & Export** and click **Export Results As…** to save predictions for the currently selected layer as a CSV file.\n\nThe exported CSV contains:\n- `label` — integer object ID\n- `prediction` — classifier prediction (1–N for each class; NaN for objects with missing features)\n- `annotations` — your manual annotations (NaN = not annotated, −1 = explicitly deselected, 1–N = class)\n- One column per annotation class name\n\n<img width=\"317\" height=\"137\" alt=\"classifier-save\" src=\"https://github.com/user-attachments/assets/62236f0d-7cc5-4760-8158-efe65e52109a\" />\n\n\n### 6. Standalone annotator\n\nYou can use the annotation tool independently from the classifier:\n`Plugins → napari-feature-classifier → Annotator`\n\nName up to 9 classes, click **Initialize**, then annotate as above. Annotations are stored in `layer.features[\"annotations\"]` and can be saved to CSV via **▶ Save Annotations**.\n\n<img width=\"322\" height=\"239\" alt=\"annotator\" src=\"https://github.com/user-attachments/assets/05c3bebc-3d9c-4a78-bfde-b821e8f565cc\" />\n\n### Batch / scripted use\n\nClassifiers can be applied programmatically without the napari UI. See [examples/simple_classifier_example.ipynb](examples/simple_classifier_example.ipynb) for a worked example.\n\n## Installation\n\nRequires Python ≥ 3.10 and napari ≥ 0.6.0.\n\nWe recommend installing into a dedicated environment to avoid dependency conflicts:\n\n```bash\n# With conda\nconda create -n napari-feature-classifier -c conda-forge napari python=3.12 -y\nconda activate napari-feature-classifier\npip install napari-feature-classifier\n```\n\nOr with [pixi](https://pixi.sh):\n\n```bash\npixi init my-project\npixi add napari napari-feature-classifier\npixi run napari\n```\n\nOr into an existing environment:\n\n```bash\npip install napari-feature-classifier\n```\n\n## Similar napari plugins\n\n- [napari-convpaint](https://github.com/guiwitz/napari-convpaint) — deep feature-based pixel and object classifier by Guillaume Witz, @quasar1357 & others\n- [napari-accelerated-pixel-and-object-classification (APOC)](https://github.com/haesleinhuepf/napari-accelerated-pixel-and-object-classification) — pixel and object classifier by Robert Haase\n- [napari-svetlana](https://www.napari-hub.org/plugins/napari-svetlana) — deep learning based classifier by Clément Cazorla\n\n## Release process\n\n1. Tag a release on GitHub with the new version number (e.g. `v0.3.2`). The version is set automatically from the git tag via `hatch-vcs`.\n2. Once CI tests pass, the package is automatically deployed to PyPI.\n3. A conda-forge PR will be opened automatically within 1–2 days — review and merge it at [napari-feature-classifier-feedstock](https://github.com/conda-forge/napari-feature-classifier-feedstock).\n\n## Contributing\n\nContributions are very welcome. Please open an issue to discuss significant changes before starting work.\n\n## License\n\nDistributed under the terms of the [BSD-3-Clause](LICENSE) license.\n\n## Issues\n\nIf you encounter any problems, please [file an issue](https://github.com/fractal-napari-plugins-collection/napari-feature-classifier/issues) along with a detailed description.\n\n## Contributors\n\n[Joel Lüthi](https://github.com/jluethi) & [Max Hess](https://github.com/MaksHess)\n",
    "description_content_type": "text/markdown",
    "keywords": null,
    "home_page": null,
    "download_url": null,
    "author": null,
    "author_email": "Joel Luethi and Max Hess <joel.luethi@uzh.ch>",
    "maintainer": null,
    "maintainer_email": null,
    "license": "BSD-3-Clause",
    "classifier": [
      "Development Status :: 4 - Beta",
      "Framework :: napari",
      "Intended Audience :: Developers",
      "License :: OSI Approved :: BSD License",
      "Operating System :: OS Independent",
      "Programming Language :: Python",
      "Programming Language :: Python :: 3",
      "Programming Language :: Python :: 3.10",
      "Programming Language :: Python :: 3.11",
      "Programming Language :: Python :: 3.12",
      "Topic :: Software Development :: Testing"
    ],
    "requires_dist": [
      "hypothesis",
      "magicgui",
      "matplotlib",
      "napari>=0.6.0",
      "numpy",
      "pandas<3.0.0,>=2.2.0",
      "pandera",
      "scikit-learn>=1.2.2",
      "xxhash",
      "hypothesis; extra == 'testing'",
      "pytest; extra == 'testing'",
      "pytest-cov; extra == 'testing'",
      "pytest-qt; extra == 'testing'",
      "qtpy; extra == 'testing'"
    ],
    "requires_python": ">=3.10",
    "requires_external": null,
    "project_url": [
      "Bug Tracker, https://github.com/fractal-napari-plugins-collection/napari-feature-classifier/issues",
      "Documentation, https://github.com/fractal-napari-plugins-collection/napari-feature-classifier#napari-feature-classifier",
      "Source Code, https://github.com/fractal-napari-plugins-collection/napari-feature-classifier",
      "User Support, https://github.com/fractal-napari-plugins-collection/napari-feature-classifier/issues"
    ],
    "provides_extra": [
      "testing"
    ],
    "provides_dist": null,
    "obsoletes_dist": null
  },
  "npe1_shim": false
}