bids.layout.BIDSValidator¶
-
class
BIDSValidator
(index_associated=True)[source]¶ An object for BIDS (Brain Imaging Data Structure) verification in a data.
The main method of this class is is_bids(). You should use it for checking whether a file path compatible with BIDS.
- Parameters
index_associated (bool, default: True) – Specifies if an associated data should be checked. If it is true then any file paths in directories code/, derivatives/, sourcedata/ and stimuli/ will pass the validation, else they won’t.
Examples
>>> from bids.grabbids import BIDSValidator >>> validator = BIDSValidator() >>> filepaths = ["/sub-01/anat/sub-01_rec-CSD_T1w.nii.gz", >>> "/sub-01/anat/sub-01_acq-23_rec-CSD_T1w.exe", #wrong extension >>> "/participants.tsv"] >>> for filepath in filepaths: >>> print( validator.is_bids(filepath) ) True False True
Methods
get_path_values
(self, path)Takes a file path and returns values found for the following path keys: sub- ses-
is_associated_data
(self, path)Check if file is appropriate associated data.
is_bids
(self, path)Checks if a file path appropriate for BIDS.
is_file
(self, path)Check if file is phenotypic data.
is_phenotypic
(self, path)Check if file is phenotypic data.
is_session_level
(self, path)Check if the file has appropriate name for a session level.
is_subject_level
(self, path)Check if the file has appropriate name for a subject level.
is_top_level
(self, path)Check if the file has appropriate name for a top-level file.
conditional_match
get_regular_expressions
-
__init__
(self, index_associated=True)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(self[, index_associated])Initialize self.
conditional_match
(self, expression, path)get_path_values
(self, path)Takes a file path and returns values found for the following path keys: sub- ses-
get_regular_expressions
(self, fileName)is_associated_data
(self, path)Check if file is appropriate associated data.
is_bids
(self, path)Checks if a file path appropriate for BIDS.
is_file
(self, path)Check if file is phenotypic data.
is_phenotypic
(self, path)Check if file is phenotypic data.
is_session_level
(self, path)Check if the file has appropriate name for a session level.
is_subject_level
(self, path)Check if the file has appropriate name for a subject level.
is_top_level
(self, path)Check if the file has appropriate name for a top-level file.