fw-classification
Introduction
fw-classification
is a generalized file classifier for medical images. At its core, it's an engine that takes in a JSON document and applies a set of declarative rules to modify that JSON. This package enables automated organization and labeling of data within Flywheel based on configurable rules and profiles.
Key Features
- Declarative Rules: Define classification rules using YAML profiles
- Multiple File Types: Support for various medical imaging formats
- Extensible Architecture: Easily add new classification rules and operators
- Integration with Flywheel: Seamless integration with the Flywheel platform
- Standalone Operation: Can be used both inside and outside of Flywheel
Motivation
Existing DICOM classification in Flywheel relies on using hard-coded rules and heuristics, principally using DICOM tags like SeriesDescription
and ProtocolName
to classify a DICOM. This has many drawbacks, including the difficulty to change classification rules.
This library provides a generalized declarative metadata modification system that can perform classification on multiple file types, both inside and outside of Flywheel.
Installation
fw-classification
requires Python >= 3.8, and can be installed via pip:
Or using poetry:
Optional Dependencies
There are several extras that can be optionally installed:
Or with poetry:
Available extras:
- all: Includes both of the following
- fw: Includes
fw-core-client
for integration with Flywheel - geartk: Includes
flywheel-gear-toolkit
for updating metadata via gears
Basic Concepts
Profiles
A profile is a YAML file that defines how to classify files. It contains blocks of rules that match on certain criteria and perform various actions.
Blocks
Blocks are collections of rules that are applied to the input JSON. Each block has a name and contains one or more rules.
Rules
Rules define the conditions for matching and the actions to take when a match is found. They use logical operators to match specific keys in the input JSON.
Basic Usage
Example Profile
Resources
Related Resources
- Data Classification in Flywheel
- fw-file: Package for working with various file formats