diff --git a/README.md b/README.md index c73b75c..e3de136 100644 --- a/README.md +++ b/README.md @@ -42,36 +42,39 @@ with bidsi.BidsWriter(Path("/home/bids/root/dir"), bidsi.MergeStrategy.OVERWRITE ## Configuration -``` -clean_fields: bool # if true, limit field values in output paths to alphanumeric characters. -include_session_dir: bool # if true, include ses- in BIDS tree. Autoincrement if no id available. -merge_config: # object representing how to merge into existing BIDS structure. - merge_participants: # participants.tsv - merge_dataset_description: # dataset_description.json - merge_entity_metadata: # JSON sidecar for entities - merge_entity: # Entity data itself. MERGE unavailable except for TSV entities - merge_subject_dir: # Merge each subject directory - merge_session_dir: # Merge each session directory -entity_name_config: - - name: # Used for logging / debugging - filter: # Select to which entities this name config applies - - field: # Field of entity to filter on - pattern: # Pattern to match against field - suffix: # Suffix to use for entities that match filters. This does not include - # the file extension, which will be .tsv for tabular data and copied from - # the original file if entity is a file. - fields: # Field order in name. Uses BidsEntity field names and BidsEntity.metadata - - subject - - task - - ... - default: # Default naming convention. No filters, uses only default extensions. - name: - suffix: - fields: - - subject - - session - - task - - ... +```toml +[structure] +clean_fields = true # if true, limit field values in output paths to alphanumeric characters. +include_session_dir = false # if true, include ses- in BIDS tree. Autoincrement if no id available. + +[merge] # object representing how to merge into existing BIDS structure. +participants = "MERGE" # participants.tsv +dataset_description = "OVERWRITE" # dataset_description.json +entity_metadata = "OVERWRITE" # JSON sidecar for entities +entity = "OVERWRITE" # Entity data itself. MERGE unavailable except for TSV entities +subject_dir = "OVERWRITE" # Merge each subject directory +session_dir = "OVERWRITE" # Merge each session directory + +[entity] # Entity config. Controls how specific BIDS entities are named, referencing fields of BidsEntity and metadata. +default_template = ["subject", "task", "suffix"] # Default fields included in name. + +[[entity.templates]] # List of templates for specific entity types. +name = "name" # Name of this entity type, for debugging. +suffix = "suffix" # Suffix for this entity type. +fields = ["subject", "task", "suffix"] # Fields included in entity file name. + +[[entity.templates.filters]] # List of filter specifications for which entity types the above template applies. +field = "task" # Field to match. +pattern = "regex" # Pattern to match against field. + +[[entity.templates]] # Second entity template example. +name = "name2" +suffix = "suffix2" +fields = ["subject", "suffix"] + +[[entity.templates.filters]] +field = "subject" +pattern = "regex2" ``` ``` merge_type = MERGE | OVERWRITE | KEEP | INCREMENT | NONE diff --git a/src/bidsi/bids_config.py b/src/bidsi/bids_config.py index 4ce031f..ac79987 100644 --- a/src/bidsi/bids_config.py +++ b/src/bidsi/bids_config.py @@ -118,7 +118,6 @@ def from_string(cls, config_string: str) -> BidsConfig: """Create BidsConfig object from string.""" return cls.from_dict(tomllib.loads(config_string)) - # @model_validator(mode="before") @classmethod def from_dict(cls, config_dict: dict) -> BidsConfig: """Create BidsConfig object from dictionary."""