-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Differences in legacy and schema RepetitionTime check. #2091
Comments
We can either add rounding to the language, or we can hack it into loading the sidecar and NIfTI headers. The latter is faster. The former might be more useful to ensure consistency across implementations? |
In Deno validator I get "[ERROR] REPETITION_TIME_MISMATCH Repetition time did not match between the scan's header and the associated JSON metadata file." For example:
|
Okay, thinking about a rounding function, we could either explicitly create a
Any preference? I like keeping the language small, but this might be over-complicating the |
I don't know much about MRI data myself. I'm wandering why the Repetition Time values would be different in NIFTI header and JSON file and still correct. Shouldn't they be exactly the same? From the Neurostart post, I understand that they should be the same. In such a case, I don't understand the need for rounding. We generate the JSONs with dcm2niix. I assume the values are equal, and they are when I check. That would mean that the validator does something to fail the equality test of equal numbers 🤔 |
The JSON value is a decimal string that will generally be converted to a >>> import numpy as np
>>> import json
>>> RepetitionTime = json.loads('1.299')
>>> pixdim4 = np.float32(RepetitionTime)
>>> pixdim4 == RepetitionTime
False Equality checks for floating points require tolerances, one way or another, or you'll eventually hit a case like this. |
Interesting. Thanks for explaining. I didn't expect that. But then the problem is already in converting DICOMs to NIFTIs and writing the JSON files, because there are two representations. I'm sorry, I didn't want to trigger any unnecessary discussion. |
Without adding anything to the schema language would something like the following work? |
Since checks are implicitly checks:
- sidecar.RepetitionTime - nifti_header.pixdim[4] < 0.01
- sidecar.RepetitionTime - nifti_header.pixdim[4] > -0.01 |
@rwblair Adopting this approach in bids-standard/bids-specification#1893: bids-standard/bids-specification@cf48a47 |
FYI I wanted to try it out and used the command as in https://github.com/bids-standard/bids-validator/issues/2081#issuecomment-2296830932 and got this error:
|
https://neurostars.org/t/bids-naming-question-code-1-not-included/30005/9
Legacy cast to number and limits precision:
Schema on the other hand has:
The text was updated successfully, but these errors were encountered: