Understanding Metadata in Flywheel
Metadata in Flywheel is information about your data. While your imaging files contain the actual scan data, metadata describes those files - who the subject is, when the scan was taken, what type of scan it is, and any custom information you want to track.
Understanding metadata is fundamental to using Flywheel effectively because metadata powers nearly every feature: search, filtering, data views, BIDS curation, automated processing with gear rules, and data export.
What you'll learn:
- What metadata is and why it matters
- Types of metadata in Flywheel
- Where metadata comes from
- How metadata is structured
- When to use each metadata type
What is Metadata?
Metadata is structured information attached to containers (projects, subjects, sessions, acquisitions) and files in Flywheel. Think of it as labels, properties, and annotations that make your data discoverable, organized, and meaningful.
Example:
For a brain MRI scan file:
- File itself: The actual DICOM or NIfTI imaging data (multiple megabytes)
- Metadata about the file:
- Subject ID:
sub-001 - Session date:
2024-03-15 - Scan type:
T1-weighted - Scanner:
Siemens Prisma 3T - Custom field:
scan_quality: excellent
- Subject ID:
You use the metadata to find, filter, organize, and process the file - without ever opening the imaging data itself.
Why Metadata Matters
Metadata enables essential Flywheel workflows:
Search and Discovery
- Find all T1 scans from a specific time period
- Locate sessions marked with a particular quality rating
- Filter subjects by demographic information
Automated Processing
- Gear rules trigger based on metadata conditions (e.g., "run fMRIPrep on all sessions with task-fMRI data")
- Processing pipelines read metadata to determine appropriate parameters
Data Organization
- BIDS curation maps DICOM metadata to standardized BIDS fields
- Export tools preserve metadata for reproducibility
- Data views create tabular datasets from metadata fields
Quality Control and Collaboration
- Notes document issues or observations about data
- Tags mark data for specific purposes (cohorts, quality flags, processing stages)
- Custom fields track study-specific information
Types of Metadata in Flywheel
Flywheel organizes metadata into several categories, each serving different purposes.
1. Standard Container Fields
Every container (project, subject, session, acquisition, file) has standard metadata fields built into Flywheel:
All Containers:
id- Unique database identifierlabel- Human-readable namecreated- Timestamp when container was createdmodified- Timestamp of last modificationtags- User-defined labels for filtering and organizationnotes- Free-text annotations with timestamps and authorsinfo- Custom metadata object (key-value pairs)
Subject-Specific:
code- Subject identifier (often same as label)sex- Biological sexcohort- Study cohort assignmentspecies- Subject species (human, mouse, etc.)strain- Animal strain (for non-human subjects)race,ethnicity- Demographic informationmlset- Machine learning dataset assignment (Training, Validation, Test)
Session-Specific:
timestamp- Session date/timeage- Subject age at time of sessionweight- Subject weight at time of sessionoperator- Person who performed the sessiontimezone- Timezone for session timestamp
Acquisition-Specific:
timestamp- Acquisition date/timetimezone- Timezone for acquisition timestamp
File-Specific:
name- Filenamesize- File size in bytestype- File type (dicom, nifti, bids, etc.)mimetype- MIME type (application/zip, application/json, etc.)classification- Structured classification (Intent, Measurement, Features, etc.)modality- Imaging modality extracted from filehash- File integrity checksum
See complete field reference in Data Views documentation
2. Custom Metadata (.info Object)
Custom metadata allows you to add study-specific fields to any container. These fields are stored in the info object as key-value pairs.
Structure:
Supported Data Types:
- String: Text values (
"baseline","excellent") - Number: Numeric values (
2,3.14,-5) - Boolean: True/false values (
true,false) - Array: Ordered lists of values (
["baseline", "followup"]) - Object: Nested key-value structures (
{"visit": 1, "complete": true})
Best Practices:
- Use consistent field names across your site (e.g., always
scan_quality, not sometimesqualityorscanQuality) - Don't mix data types for the same field name
- Avoid highly variable values as field names (use timestamps as values, not field names)
- Keep within system limits: 15,000 unique fields per site, 8KB per container
Learn how to add custom metadata
3. DICOM Metadata
When DICOM files are uploaded to Flywheel, you can extract metadata from DICOM headers by running the File Metadata Importer gear. This gear reads DICOM headers and stores the metadata in the file's info object under file.info.header.dicom.
Common DICOM Fields:
How It Works:
- User uploads DICOM files to Flywheel
- Container hierarchy is created based on DICOM metadata during upload:
PatientID→ Subject labelStudyDescriptionorStudyInstanceUID→ Session labelSeriesDescription→ Acquisition label- Run File Metadata Importer gear (manually or via gear rule) to extract DICOM header metadata
- Metadata is stored in
file.info.header.dicomobject
Important Notes:
- DICOM header extraction requires running the File Metadata Importer gear
- Set up gear rules to run the gear automatically on new DICOM uploads
- Extracted metadata is searchable just like custom metadata
- De-identification can remove or modify DICOM fields before storage
- DICOM metadata is preserved when exporting data
4. Tags
Tags are simple labels you apply to containers for filtering, organization, and workflow management.
Characteristics:
- Must be created at the group level before use
- Can be applied to subjects, sessions, acquisitions, and files
- Case-insensitive (
CONTROLandcontrolare the same tag) - Searchable and usable in filters
Common Use Cases:
- Cohort identification: Tag subjects as
control,treatment,pilot - Quality control: Tag sessions as
good,motion_artifacts,exclude - Processing stages: Tag sessions as
raw,preprocessed,analyzed - Study phases: Tag data as
baseline,intervention,followup
Example:
Learn how to create and use tags
5. Notes
Notes are free-text annotations with timestamps and authorship information. They're useful for documenting observations, issues, or decisions.
Structure:
Best For:
- Quality control observations
- Communication between team members
- Documenting unusual circumstances
- Tracking decisions about data handling
6. File Classification
File classification is structured metadata that categorizes files by their purpose, measurement type, and features.
Classification Dimensions:
- Intent: Purpose of the file (
Structural,Functional,Diffusion, etc.) - Measurement: What was measured (
T1,T2,BOLD,FA, etc.) - Features: Special characteristics (
Derived,Motion Corrected,Aligned, etc.) - Custom: Site-specific classifications
Example:
How It Works:
- Run File Classifier gear to assign classifications
- The gear uses DICOM metadata (from File Metadata Importer) to determine appropriate classifications
- Classifications can be manually adjusted or corrected in the web UI
- Set up gear rules to automatically classify new uploads
- Used by gear rules to trigger appropriate processing
- Essential for BIDS curation
Learn more about file classification
Where Metadata Comes From
Metadata enters Flywheel through several sources:
Automatic Extraction
During DICOM Upload:
- Container hierarchy is created from basic DICOM tags (PatientID, StudyDescription, SeriesDescription)
- Full DICOM header extraction requires running the File Metadata Importer gear
- File classification requires running the File Classifier gear
- Both gears can be automated with gear rules
During BIDS Upload:
- BIDS sidecar JSON files are read automatically
- Metadata is imported into Flywheel containers
- BIDS-specific fields are preserved
User Input
Through Web UI:
- Add custom metadata fields
- Create notes
- Apply tags
- Modify file classifications
Through CLI:
- Use
fw ingestcommands with metadata flags - Bulk metadata import with templates
Through SDK:
- Programmatically add/modify metadata
- Batch operations for large datasets
Gear Processing
Analysis Gears:
- Can read input file metadata
- Can write output metadata
- Can update container metadata
Utility Gears:
- BIDS curation gear writes BIDS metadata
- De-identification gear modifies metadata
- Metadata extraction gears populate custom fields
Metadata Structure and Relationships
Understanding how metadata is organized helps you query and use it effectively.
Container Hierarchy
Metadata exists at each level of the Flywheel hierarchy:
Parent Relationships
Every container knows its parents:
This allows queries like "find all T1 scans for subjects in the control cohort" by combining metadata from multiple hierarchy levels.
Accessing Metadata
Dot Notation:
Metadata fields are referenced using dot notation: container.field or container.info.customfield
Examples:
subject.sex- Subject's biological sexsession.age- Subject age at sessionacquisition.info.SeriesDescription- DICOM series descriptionfile.classification.Intent- File intent classificationsession.tags- Tags applied to session
See field reference for complete list
Using Metadata Effectively
Search and Filter
Basic Search:
Search for metadata values directly in the search bar.
Advanced Search:
Build complex queries combining multiple metadata fields:
subject.cohort = "control" AND session.age < 30acquisition.info.SeriesDescription contains "T1" AND session.tags contains "baseline"
Learn more about searching metadata
Data Views
Create tabular datasets by selecting metadata fields to export:
- Choose which containers to include (sessions, acquisitions, files)
- Select metadata columns to include
- Apply filters based on metadata conditions
- Export as CSV for analysis
Gear Rules
Configure automated processing based on metadata:
- Trigger condition:
file.type = "dicom" AND acquisition.info.SeriesDescription contains "BOLD" - Action: Run fMRIPrep gear
- Result: New functional data is automatically preprocessed
BIDS Curation
Map Flywheel metadata to BIDS standard fields:
- DICOM
SeriesDescription→ BIDStaskfield - Session age → BIDS
agein participants.tsv - Custom
info.run_number→ BIDSrunentity
Data Export and Migration
When exporting or copying data:
Metadata Preserved:
- Container labels and hierarchy
- Custom metadata (
.infofields) - Tags
- Notes
- File classifications
- DICOM metadata
Metadata NOT Preserved:
- Gear job history
- Analyses
- Change log history
- Project permissions
- Gear rules
- Session templates
- Data views
Common Metadata Workflows
Study Setup
- Define custom metadata schema - Decide which study-specific fields you need
- Create tags - Set up tags at group level for cohorts, quality flags, phases
- Configure gear rules - Set up automated processing based on metadata
- Create session templates - Define expected acquisitions and metadata
Data Import
- DICOM import - Container hierarchy created from basic DICOM tags
- Run metadata extraction - Use File Metadata Importer and File Classifier gears (or set up gear rules for automation)
- Review and correct - Verify subject/session labels, classifications, fix any issues
- Add custom fields - Populate study-specific metadata
- Apply tags - Mark cohorts, phases, quality status
Quality Control
- Review data - Check for issues using viewer
- Add notes - Document observations or problems
- Apply QC tags - Mark as
qc-pass,qc-fail,exclude, etc. - Update custom fields - Record quality metrics
Analysis and Export
- Search/filter - Find data meeting analysis criteria using metadata
- Create data view - Export metadata table for statistical analysis
- Run gears - Process data (gear rules use metadata to trigger)
- Export results - Download with metadata preserved
Metadata Best Practices
Consistency
- Use standardized field names across your site and studies
- Document your metadata schema so all team members use the same conventions
- Avoid synonyms - pick one term and stick to it (
subject_idvssubjectIDvssub_id)
Data Types
- Choose appropriate types - Use Number for numeric data you want to search by range
- Don't mix types - Always use the same data type for a given field name
- Use objects over arrays when possible - objects are more searchable
Field Names
- Keep names stable - Don't use timestamps or highly variable values as field names
- Use descriptive names -
scan_qualitynotsq,motion_ratingnotmr - Follow conventions - If working with BIDS, use BIDS field names in custom metadata
System Limits
Be aware of Flywheel's metadata limits:
- 15,000 unique metadata fields per Flywheel site (location + name combinations)
- 8KB per container for combined structured and custom metadata
- Exceeding limits can cause indexing and search issues
Quality and Documentation
- Validate metadata - Check for missing or incorrect values regularly
- Document meaning - Maintain a data dictionary explaining what each custom field means
- Review regularly - Periodically audit metadata quality across your projects
Next Steps
Now that you understand Flywheel's metadata system:
Learn to Add Metadata
- Add custom metadata fields
- Create and use tags
- Annotate data with notes
- Understand file classification