Flywheel Gear Toolkit (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. The package is maintained by Flywheel and requires Python 3.8 or higher.
This documentation provides an overview of the fw-gear library and points to the official documentation for detailed information.
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:
Optional Dependencies
The fw-gear library supports several optional dependencies that provide additional functionality:
- all: Installs all optional dependencies
- dicom: Provides the
fw-file
andnibabel
packages - fw-file: Adds support for interacting with various file types and their metadata
- nipype: Includes the
nipype
andnibabel
packages - numpy: Adds support for numpy arrays in JSON operations
- sdk: Provides the
flywheel-sdk
andflywheel-bids
packages
Install optional dependencies using:
Core Modules
Context
The Context module provides access to the gear's runtime environment, including:
- Input files and their metadata
- Configuration options
- Output directory
- Logging facilities
Specs
The Specs module helps with handling gear specifications and manifests, including:
- Parsing and validating manifest files
- Working with input and configuration specifications
- Managing gear metadata
Utils
The Utils module offers various utility functions for common gear operations:
- File handling and manipulation
- Logging and error reporting
- Data conversion and formatting
Basic Usage Example
Here's a simple example of using fw-gear in a gear script:
API Reference
For detailed API documentation, please refer to the official fw-gear documentation.
Migration from gear-toolkit
If you're migrating from the older gear-toolkit
package, please refer to the Migration Guide for detailed instructions on updating your code.