Skip to main content

Classification Toolkit

The main documentation for the classification-toolkit can be found at the fw-classification Documentation

Classification toolkit is a library that can act on arbitrary metadata in the form of JSON, with a declarative set of rules. The main use case for this library is for classification of medical imaging files based on their metadata, for example, the SeriesDescription tag in a DICOM file.

Install

poetry add fw-classification, or with optional dependencies poetry add fw-classification -E all.

Run classification via cli

~/ ➜  classify run ./fw_classification/profiles/main.yml ~/Downloads/example.dicom.zip -a dicom
fw_classification:      Block mr_file result: True
fw_classification:      Block set_modality result: True
fw_classification:      Block set_classification_from_acquisition_label_or_series_description result: True
fw_classification:      Block set_contrast_from_acquisition_label_or_series_description result: False
fw_classification:      Block add_features_from_acquisition_label_or_series_description result: False
fw_classification:      Block add_measurement_from_acquisition_label_or_series_description result: False
fw_classification:      Block add_intent_from_acquisition_label_or_series_description result: False
{
  "file": {
    "info": {
      "header": {
        "dicom": {
          "FileMetaInformationGroupLength": 216,
          "WindowWidth": 199.0,
          ... # Many more tags
          "dBdt": 0.0
        }
      }
    },
    "type": "dicom",
    "modality": "MR",
    "classification": {
      "Intent": [
        "Structural"
      ],
      "Measurement": [
        "T1"
      ]
    }
  }
}

Run via python

from fw_classification.classify import run_classification
import json

input_data = {}
with open('/path/to/input','r') as fp:
   input_data = json.load(fp)

result, out_data = run_classification('MR_classifier', input_data)

Out:

~/ ➜   python test.py
{
  "file": {
    "info": {
      "header": {
        "dicom": {
          "FileMetaInformationGroupLength": 216,
          ... # Many more tags
          "WindowWidth": 199.0,
          "dBdt": 0.0
        }
      }
    },
    "type": "dicom",
    "modality": "MR",
    "classification": {
      "Intent": [
        "Structural"
      ],
      "Measurement": [
        "T1"
      ]
    }
  }
}

Development

Install the project using poetry (requires poetry > 1.2.0b1), enable plugin and pre-commit:

poetry install --extras "all"
pre-commit install

Release files for fw-classification 0.6.3

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

Built distribution (wheel)

Table of built distributions (wheels) for fw-classification 0.6.3
File Interpreter ABI Platform
fw_classification-0.6.3-py3-none-any.whl Python 3 none any Details

Release files / fw_classification-0.6.3-py3-none-any.whl

Download URL fw_classification-0.6.3-py3-none-any.whl
Size 31.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a8d5f9fe3909339c0d9355dc8f8914d4970536466fe4efdd31c3a74bbc68868b
BLAKE2b-256 checksum
How to use checksums
90eeb9977a82b3a4769f1fb7a48999b665dc56bfaa4408b1354f6447d1396359
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.12.14 Linux/5.15.154+

Release history Release notifications | RSS feed

This release

0.6.3 This release

1 release file

0.6.2

1 release file

0.6.1

1 release file

0.6.0

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.7

1 release file

0.4.6

1 release file

0.4.5

1 release file

0.4.4

1 release file

0.4.3

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.5

1 release file

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.1

1 release file

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