Skip to content
bidsapp-nidm-standards logo

BIDSapp NIDM Standards

bidsapp-nidm-standards

Standards and tools for creating, maintaining, and refactoring NIDM-integrated BIDSapps that run through BABS. Use when working with sensein BIDSapp repositories (freesurfer_bidsapp, mriqc-nidm_bidsapp, ants_bidsapp) or creating new BIDSapps. Helps with repository structure consistency, NIDM inte...

SKILL.md

Full skill instructions

BIDSapp NIDM Standards

Standardize BIDSapp repositories with NIDM integration for consistent structure, output formats, and BABS compatibility.

Overview

This skill defines standards for BIDSapp repositories that:

  1. Process neuroimaging data (FreeSurfer, MRIQC, ANTs, etc.)
  2. Integrate NIDM (Neuroimaging Data Model) outputs
  3. Run through BABS (BIDS App Bootstrap) on HPC clusters
  4. Maintain consistent structure across multiple analysis tools

Core Standards

Repository Structure

All BIDSapp repos follow this structure:

<bidsapp_name>/
├── src/
│   ├── <analysis_name>/          # Main analysis code
│   │   ├── __init__.py
│   │   ├── run.py               # Entry point
│   │   └── <analysis>_runner.py
│   └── nidm/                     # NIDM conversion (analysis-specific)
│       ├── __init__.py
│       ├── nidm_converter.py
│       └── data/
├── tests/
│   ├── test_<analysis>.py
│   └── test_nidm.py
├── examples/
├── Dockerfile
├── Singularity
├── setup.py
├── requirements.txt
├── VERSION
└── README.md

CLI Arguments

Standard BIDS arguments (required):

  • bids_dir - Input BIDS dataset path
  • output_dir - Output directory path
  • analysis_level - Must be "participant"
  • --participant-label - Subject ID(s) without "sub-" prefix
  • --session-label - Session ID(s) without "ses-" prefix (optional)

Standard NIDM arguments (required):

  • --nidm-input-dir - Path to existing NIDM files directory
  • --skip-nidm - Skip NIDM conversion
  • --skip-<analysis> - Skip analysis if already run (e.g., --skip-freesurfer, --skip-mriqc, --skip-ants)

Analysis-specific arguments (optional):

  • Add as needed for specific analysis tools (e.g., --fs-license for FreeSurfer, --nprocs for MRIQC)

See references/​cli_arguments.md for complete specifications.

Output Structure

BIDS-compliant derivatives structure:

<output_dir>/
└── <bidsapp_name>/              # e.g., freesurfer_nidm, mriqc_nidm, ants_nidm
    ├── dataset_description.json
    ├── <analysis>/              # e.g., freesurfer, mriqc, ants
    │   ├── dataset_description.json
    │   └── sub-{id}/
    │       └── ses-{session}/   # Optional
    │           └── [analysis outputs]
    └── nidm/
        ├── dataset_description.json
        └── sub-{id}/
            └── ses-{session}/   # Optional
                └── sub-{id}_ses-{session}.ttl

NIDM Integration Workflow

The standard NIDM workflow:

  1. Copy existing NIDM file from --nidm-input-dir to output NIDM folder
  2. Run analysis (unless --skip-<analysis>)
  3. Extract metrics from analysis outputs
  4. Integrate into NIDM file (overwrite the copied file)

The NIDM input directory should contain:

  • Single nidm.ttl file at root, OR
  • Per-subject files: sub-{id}/​ses-{session}/​sub-{id}_ses-{session}.ttl

For complete NIDM integration specifications, see references/​nidm_integration.md.

Common Workflows

Check Repository Compliance

Verify a repo follows standards:

  1. Directory structure: Compare against references/​repo_structure.md
  2. CLI arguments: Check src/<analysis>/​run.py for standard args
  3. Output structure: Verify code creates <bidsapp_name>/​{<analysis>, nidm}/ pattern
  4. NIDM integration: Ensure copy→run→integrate workflow exists
  5. Containers: Check Dockerfile/​Singularity follow references/​container_patterns.md

Refactor Existing Repository

To update a repo to match standards:

  1. Review: Compare current structure against references/​repo_structure.md
  2. Reorganize: Move files to match standard layout
  3. Update CLI: Add missing standard arguments
    • Ensure --participant-label, --session-label
    • Add --nidm-input-dir, --skip-nidm, --skip-<analysis>
  4. Fix output structure: Update code to create proper BIDS derivatives
  5. Update NIDM workflow: Implement copy→run→integrate pattern
  6. Align containers: Update Dockerfile/​Singularity
  7. Standardize setup.py: Match template configuration
  8. Update tests: Ensure test coverage for all components

Create New BIDSapp

To create a new NIDM-integrated BIDSapp from scratch:

  1. Initialize structure: Copy assets/​template/ directory
  2. Rename components: Replace <analysis> placeholders throughout
  3. Implement analysis: Code src/<analysis>/<analysis>_runner.py
  4. Implement NIDM: Code src/​nidm/​nidm_converter.py for this analysis
  5. Build containers:
    • Create Dockerfile following references/​container_patterns.md
    • Create Singularity file for HPC deployment
  6. Add tests: Follow standard test patterns
  7. Generate BABS config: Use references/​babs_config.md template
  8. Document: Update README with usage examples

Update Standards Across All Repos

When changing standards that affect all BIDSapps:

  1. Update this skill: Modify reference documentation first
  2. Identify affected repos: List all BIDSapps needing updates
  3. Update each repo:
    • NIDM converter pattern changes → src/​nidm/​nidm_converter.py
    • CLI changes → src/<analysis>/​run.py
    • Output structure changes → Runner and output code
    • Container changes → Dockerfile, Singularity
  4. Test with BABS: Ensure all repos work with BABS workflow
  5. Update BABS configs: Regenerate YAML files if needed

Reference Documentation

All reference files provide detailed specifications:

  • references/​repo_structure.md - Complete repository structure template with explanations
  • references/​nidm_integration.md - Full NIDM workflow, file formats, integration patterns
  • references/​babs_config.md - BABS YAML configuration template with examples
  • references/​cli_arguments.md - Complete CLI argument specifications and validation
  • references/​container_patterns.md - Docker and Singularity build patterns
  • references/​testing_patterns.md - Test structure and coverage requirements

Container Standards

Both Dockerfile and Singularity should:

  • Use analysis tool base images where available (e.g., vnmd/​freesurfer_8.0.0)
  • Install Python package via setup.py
  • Set appropriate entry points
  • Support both Docker and Apptainer/​Singularity execution
  • Follow BIDS App containerization best practices

See references/​container_patterns.md for complete specifications.

Testing Standards

Standard test coverage:

  • CLI argument parsing and validation
  • BIDS input dataset validation
  • Analysis execution (with mock or example data)
  • NIDM conversion correctness
  • Output structure validation
  • Container build and execution

Use pytest with fixtures for test data. See references/​testing_patterns.md.

BABS Integration

All BIDSapps must work with BABS for HPC deployment. Key requirements:

  • Accept standard BIDS App CLI arguments
  • Output to BIDS derivatives structure
  • Support DataLad input datasets
  • Work with Singularity/​Apptainer containers
  • Include proper resource requirements

Generate BABS YAML configs using references/​babs_config.md template.

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View