- ✅ Set up analysis repository with 10 major neuroimaging projects as submodules
- ✅ Analyzed PyBIDS usage across 8 projects (2 don't use PyBIDS)
- ✅ Identified usage patterns for 14 different PyBIDS methods/features
- ✅ Created comprehensive migration guide with three migration paths
- ✅ Designed compatibility layer architecture for bids2table
- ✅ Developed implementation plan with phased approach and timeline
- Total PyBIDS method calls: ~145 occurrences
- Projects using PyBIDS: 8/10 (80%)
- Using: fmriprep, smriprep, nibabies, mriqc, qsiprep, fitlins, niworkflows, templateflow
- Not using: neurosynth, bids-apps-example
- BIDSLayout() - 51 uses (100% of PyBIDS projects)
- layout.get_metadata() - 35 uses (50% of projects)
- layout.get() - 34 uses (75% of projects)
- layout.get_sessions() - 8 uses (38% of projects)
- layout.get_subjects() - 7 uses (63% of projects)
- Critical methods (Phase 1): 83% of all usage
- High-value methods (Phase 2): 14% of usage
- Specialized methods (Phase 3+): 3% of usage
Insight: Focus on 5-6 core methods covers 97% of real-world usage.
# Change this:
from bids.layout import BIDSLayout
# To this:
from bids2table.compat import BIDSLayout
# Everything else stays the same!Best for: Quick wins, large codebases, conservative teams
import bids2table as b2t
tab = b2t.index_dataset('/path/to/dataset')
df = tab.to_pandas()
# Query with pandas
files = df[(df['sub'] == '01') & (df['suffix'] == 'T1w')]['file_path'].tolist()Best for: New code, performance-critical applications, pandas-savvy developers
Use compat layer for complex operations (fieldmaps), native b2t for simple queries.
Best for: Gradual migration, learning curve management
-
PYBIDS_USAGE_ANALYSIS.md (9 methods analyzed)
- Detailed analysis of each PyBIDS method
- Usage patterns and examples
- Common parameters and metadata fields
- Project-specific notes
- Priority rankings
-
MIGRATION_GUIDE.md (Complete migration reference)
- Method-by-method migration instructions
- Three approaches for each method (Old → Compat → Native)
- Advanced patterns (caching, derivatives, multi-dataset)
- Compatibility layer implementation sketch
- Performance comparisons
- Testing strategies
-
IMPLEMENTATION_PLAN.md (4-week execution plan)
- Architecture and design principles
- Phased implementation (5 phases)
- Testing strategy
- Success criteria
- Risk assessment
- Timeline and milestones
-
UPDATED_ANALYSIS.md (Post-validation)
- Analysis of 3 additional repositories
- New methods discovered (Query.NONE, Query.ANY, etc.)
- Validation of approach
- Updated priorities
- Recommendations
bids2table/
└── compat/ (NEW - optional import)
├── __init__.py (exports BIDSLayout, Query, BIDSFile)
├── layout.py (BIDSLayout wrapper class)
├── query.py (Query.OPTIONAL, Query.NONE, Query.ANY)
├── bidsfile.py (BIDSFile wrapper for get_entities())
└── fieldmaps.py (Complex fieldmap association logic)
- Optional, not core - Separate submodule, not part of main API
- Thin wrapper - Delegates to native b2t functions
- Educational - Shows both compat and native approaches
- Performance-conscious - Leverages b2t's speed (~20x faster)
- Deprecation path - Easy to sunset when PyBIDS retires
- BIDSLayout class with initialization and caching
.get()method with entity filtering.get_metadata()wrapper- Basic tests
Deliverable: MVP that enables simple migrations
- BIDSFile class with
.get_entities() .get_subjects()and.get_sessions()- Query helpers (OPTIONAL, NONE, ANY)
- Integration tests
Deliverable: Full support for entity-based workflows
.get_fieldmap()- Complex fieldmap association.build_path()- Path construction.get_fmapids()- Fieldmap ID retrieval- Advanced tests
Deliverable: Feature parity with common PyBIDS usage
- Performance optimization
- Comparison tests with PyBIDS
- Documentation finalization
- Real-world validation (niworkflows, fmriprep)
Deliverable: Production-ready compatibility layer
- Drop-in replacement for 80% of PyBIDS usage
- Core methods working (Layout, .get(), .get_metadata())
- Unit tests pass
- Basic documentation
- 95%+ PyBIDS method coverage
- Fieldmap association working
- All integration tests pass
- Performance >10x faster than PyBIDS
- At least one pipeline migrated successfully
- niworkflows migrated (affects all nipreps pipelines)
- 3+ pipelines using compat layer in production
- Performance benchmarks published
- Community feedback incorporated
- ✅ Complete usage analysis (DONE)
- ✅ Validate approach with additional repos (DONE)
- ✅ Create migration guide (DONE)
- ✅ Design implementation plan (DONE)
- 🔲 Present findings to b2t maintainers
- 🔲 Get feedback on compat layer approach
- 🔲 Create feature branch:
feat/pybids-compat - 🔲 Implement Phase 1 (MVP)
- 🔲 Write unit tests
- 🔲 Get early user feedback
- 🔲 Implement Phases 2-3 (full features)
- 🔲 Integration testing with real pipelines
- 🔲 Performance benchmarking
- 🔲 Documentation completion
- 🔲 Merge to main branch
- 🔲 Release as optional extra:
pip install bids2table[compat] - 🔲 Migrate niworkflows (highest leverage)
- 🔲 Support other pipelines in migration
- 🔲 Gather adoption metrics
- Fieldmap logic complexity: Start simple, iterate based on real needs
- API differences: Comprehensive testing, clear documentation of differences
- Performance overhead: Profile and optimize, keep wrapper thin
- User resistance: Provide multiple migration paths, excellent docs
- Maintenance burden: Keep compat layer minimal, deprecate eventually
- Breaking changes: Version pin dependencies, thorough testing
b2t-pybids/
├── README.md (Project overview)
├── PYBIDS_USAGE_ANALYSIS.md (Detailed method analysis)
├── MIGRATION_GUIDE.md (Complete migration reference)
├── IMPLEMENTATION_PLAN.md (Execution roadmap)
├── UPDATED_ANALYSIS.md (Post-validation findings)
├── SUMMARY.md (This file)
├── projects/ (10 submodules for analysis)
│ ├── fmriprep/
│ ├── smriprep/
│ ├── nibabies/
│ ├── mriqc/
│ ├── qsiprep/
│ ├── fitlins/
│ ├── niworkflows/
│ ├── templateflow/
│ ├── neurosynth/
│ ├── bids-apps-example/
│ ├── pybids/ (Reference implementation)
│ └── bids2table/ (Target library)
└── datasets/
└── bids-examples/ (Test datasets)
- Analysis: PYBIDS_USAGE_ANALYSIS.md, UPDATED_ANALYSIS.md
- Migration: MIGRATION_GUIDE.md
- Implementation: IMPLEMENTATION_PLAN.md
- Testing: Use datasets/bids-examples/* for validation
- PyBIDS: https://github.com/bids-standard/pybids
- bids2table: https://github.com/childmindresearch/bids2table
- BIDS Spec: https://bids-specification.readthedocs.io/
- nipreps: https://www.nipreps.org/
- Is a compat layer acceptable in the main repo?
- Alternative: separate package
bids2table-pybids-compat? - Should fieldmap logic be in core b2t or compat only?
- Preferred caching convention (location, naming)?
- Can we add PyBIDS as optional test dependency?
- Would you adopt a compat layer if it's drop-in compatible?
- Timeline for migration (urgent, nice-to-have, not interested)?
- Any PyBIDS features we missed in analysis?
- Performance requirements (how fast is fast enough)?
- Support needs (documentation, migration help)?
This analysis demonstrates:
- ✅ Feasibility: 97% of PyBIDS usage is covered by 5-6 core methods
- ✅ Value: 20x performance improvement possible with b2t
- ✅ Strategy: Three-path approach maximizes adoption
- ✅ Roadmap: Clear 4-week implementation plan
- ✅ Impact: Migrating niworkflows affects all downstream pipelines
Recommendation: Proceed with compat layer implementation. Start with MVP (Week 1), gather feedback, iterate based on real-world testing.
Expected Outcome: Drop-in PyBIDS replacement that's faster, simpler, and sets foundation for eventual PyBIDS retirement.
Status: ✅ Analysis Phase Complete
Next: Present to b2t maintainers, get green light for implementation
Timeline: 4 weeks to production-ready compat layer
Impact: Enable migration of 8+ major neuroimaging pipelines