Skip to content

fw-gear

Introduction

fw-gear is a Python package designed to simplify the development of Flywheel gears. It provides a set of modules that make gear creation more efficient and streamlined, with standardized interfaces for accessing inputs, outputs, and configuration. This package is maintained by Flywheel and requires Python 3.8 or higher.

Key Features

  • Simplified Gear Development: Provides a standardized framework for creating Flywheel gears
  • Context Management: Easily access and manage gear inputs, outputs, and configuration
  • Specification Handling: Tools for working with gear specifications and manifests
  • Utility Functions: Common operations for file handling, logging, and more
  • SDK Integration: Optional integration with the Flywheel SDK

Installation

The package can be installed using pip or poetry:

pip install fw-gear  # or
poetry add fw-gear

Basic Usage

Here's a simple example of using fw-gear in a gear:

from fw_gear.context import GearContext
from my_awesome_module import do_something

def main(context):
    # Do something with your input dicom file
    do_something(
        dicom=context.config.get_input_path('dicom'),
        output_dir=context.output_dir
    )

if __name__ == "__main__":
    with GearContext() as context:
        # Setup basic logging
        context.init_logging()
        # Call my main function
        main(context)

Resources