Skip to content

Commit f55a9aa

Browse files
committed
Pass ignore_nifti_headers to bids-validator-deno in only-non-data mode
When --missing-file-content=only-non-data is active, pass ignore_nifti_headers=True to bids_validate() so that the deno BIDS validator runs with --ignoreNiftiHeaders, skipping content-dependent NIfTI header checks while still validating BIDS layout and naming. https://claude.ai/code/session_01CLi49c7QcJx11b7UfshbvE
1 parent 75524e9 commit f55a9aa

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

dandi/files/bids.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,16 @@ def _get_metadata(self) -> None:
112112
result.metadata
113113
)
114114

115-
def _validate(self) -> None:
115+
def _validate(self, ignore_nifti_headers: bool = False) -> None:
116116
with self._lock:
117117
if self._dataset_errors is None:
118118

119119
# Obtain BIDS validation results of the entire dataset through the
120120
# deno-compiled BIDS validator
121-
v_results = bids_validate(self.bids_root)
121+
v_results = bids_validate(
122+
self.bids_root,
123+
ignore_nifti_headers=ignore_nifti_headers,
124+
)
122125

123126
# Validation results from the deno BIDS validator with an additional
124127
# hint, represented as a `ValidationResult` object, following
@@ -169,9 +172,13 @@ def _validate(self) -> None:
169172
bids_version = self._dataset_errors[0].origin.standard_version
170173
self._bids_version = bids_version
171174

172-
def get_asset_errors(self, asset: BIDSAsset) -> list[ValidationResult]:
175+
def get_asset_errors(
176+
self,
177+
asset: BIDSAsset,
178+
ignore_nifti_headers: bool = False,
179+
) -> list[ValidationResult]:
173180
""":meta private:"""
174-
self._validate()
181+
self._validate(ignore_nifti_headers=ignore_nifti_headers)
175182
assert self._asset_errors is not None
176183
return self._asset_errors[asset.bids_path].copy()
177184

@@ -190,7 +197,11 @@ def get_validation_errors(
190197
"""
191198
Return all validation results for the containing dataset per the BIDS standard
192199
"""
193-
self._validate()
200+
self._validate(
201+
ignore_nifti_headers=(
202+
missing_file_content == MissingFileContent.only_non_data
203+
),
204+
)
194205
assert self._dataset_errors is not None
195206
return self._dataset_errors.copy()
196207

@@ -241,7 +252,12 @@ def get_validation_errors(
241252
devel_debug: bool = False,
242253
missing_file_content: MissingFileContent | None = None,
243254
) -> list[ValidationResult]:
244-
return self.bids_dataset_description.get_asset_errors(self)
255+
return self.bids_dataset_description.get_asset_errors(
256+
self,
257+
ignore_nifti_headers=(
258+
missing_file_content == MissingFileContent.only_non_data
259+
),
260+
)
245261

246262
def get_metadata(
247263
self,

0 commit comments

Comments
 (0)