Skip to main content

Flywheel classification toolkit.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

fw_classification-0.4.5-py3-none-any.whl (30.7 kB view details)

Uploaded Python 3

File details

Details for the file fw_classification-0.4.5-py3-none-any.whl.

File metadata

File hashes

Hashes for fw_classification-0.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 178575fdd6f9ff0415ad4e370f496847aca52b1b3ae3989f666f23f77e0fad5a
MD5 ddc007c0c423ea9f81ad4c33a0f528f8
BLAKE2b-256 9291904a00f0c0d13891b3495eb82e39ba250fadc085b82dd400ffe91dc58829

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page