bids-validator icon indicating copy to clipboard operation
bids-validator copied to clipboard

Inconsistency in RepetitionTime between nifti header and json not detected

Open Remi-Gau opened this issue 3 years ago • 11 comments

I just tested this on a manually converted dataset (and on the MoAE SPM dataset) by modifying the value in the json file and the validator did not detect it.

What it may detect is "inconsistencies" with the events.tsv like is this:

- Warning 2: [Code 85] SUSPICIOUSLY_LONG_EVENT_DESIGN
- Warning 2: [Code 86] SUSPICIOUSLY_SHORT_EVENT_DESIGN

depending if you give it RepetitionTime that are either very small or very long.

I am pretty sure that the bids validator used to be able to do this (see #34) so I suspect this is a regression.

Can someone reproduce that bug?

Remi-Gau avatar Oct 13 '21 07:10 Remi-Gau

Strange I was able to generate the code by modifying either the last value in an events file, or by making the TR in json file very big. Here's the code where the check is performed:

https://github.com/bids-standard/bids-validator/blob/39b71556ea0c9ead4618cf6f5669e7ea19b9b23f/bids-validator/validators/events/events.js#L75

The check is only performed if there are headers for the niftis, so using --ignoreNiftiHeaders will skip the check all together.

What were the values for RepetitionTime and the event onset that you looked at?

rwblair avatar Oct 13 '21 20:10 rwblair

I think those warnings make sense (for certain values in the json) but I am more worried that the fact that no error is thrown when the repetition time in the json is different from that in the nifiti header

Remi-Gau avatar Oct 14 '21 06:10 Remi-Gau

Sorry, I misread the original post.

Just downloaded that MoAEpilot dataset and received this error when I modified the TR in the task json:

1: [ERR] Repetition time did not match between the scan's header and the associated JSON metadata file. (code: 12 - REPETITION_TIME_MISMATCH)
                ./sub-01/func/sub-01_task-auditory_bold.nii 

What value did you put for "RepetitionTime" in the "task-auditory_bold.json"? Were you testing any on particular version/branch of the validator? See if I can't recreate issue from there.

rwblair avatar Oct 14 '21 16:10 rwblair

what the ????

tested on the command line (version 1.8.4 - not a specific branch just got the npm package) and online version of the validator.

Tried RepetitionTime values ranging from 2 to 200. Only get warnings. Never an error.

Remi-Gau avatar Oct 15 '21 06:10 Remi-Gau

I downloaded and replicated on the web...

effigies avatar Oct 15 '21 12:10 effigies

I downloaded and replicated on the web...

"computational reproducibility" also includes: "does the bug replicate?"

Remi-Gau avatar Oct 15 '21 12:10 Remi-Gau

The NIfTI validation code is so deeply nested. I wouldn't be surprised if it's a misplaced curly brace. Still, we have a test for this case that's passing, so there must be some combination of bools that's triggering the wrong way.

effigies avatar Oct 15 '21 12:10 effigies

Ah this may have been fixed in #1339

rwblair avatar Oct 15 '21 16:10 rwblair

My brain is shot. I thought about that, but thought it happened long enough ago that it must be released.

effigies avatar Oct 15 '21 17:10 effigies

I waffled on merging it because of the tests were failing for an unrelated reason. I'll cut a new release soon.

rwblair avatar Oct 15 '21 17:10 rwblair

Thanks both for looking into this! :hugs:

Remi-Gau avatar Oct 16 '21 07:10 Remi-Gau