Skip to content

Commit

Permalink
Merge pull request #534 from olgn/phasediff-magnitude1
Browse files Browse the repository at this point in the history
each phasediff should be accompanied by a magnitude1 file
  • Loading branch information
nellh authored Sep 4, 2018
2 parents 1f9788a + 95a066c commit fbc5ce7
Show file tree
Hide file tree
Showing 43 changed files with 234 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/bids.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,26 @@ var suite = describe('BIDS example datasets ', function() {
isdone()
})
})

it('should not throw a warning if all _phasediff.nii are associated with _magnitude1.nii', function(isdone) {
var options = { ignoreNiftiHeaders: true }
validate.BIDS(
'tests/data/BIDS-examples-' + test_version + '/hcp_example_bids',
options,
function(issues) {
assert.deepEqual(issues.errors, [])
isdone()
},
)
})

it('should throw a warning if there are _phasediff.nii without an associated _magnitude1.nii', function(isdone) {
var options = { ignoreNiftiHeaders: true }
validate.BIDS('tests/data/phasediff_without_magnitude1', options, function(
issues,
) {
assert(issues.warnings.length == 2 && issues.warnings[1].code === '92')
isdone()
})
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"BIDSVersion": "1.0.0rc3",
"Name": "7t_trt"
}
2 changes: 2 additions & 0 deletions tests/data/phasediff_without_magnitude1/participants.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
participant_id sex age_at_first_scan_years number_of_scans_before handedness
sub-01 F 29 17 100
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"EchoTime2": 0.00702,
"EchoTime1": 0.006,
"IntendedFor": "ses-1/func/sub-01_ses-1_task-rest_acq-fullbrain_run-1_bold.nii.gz"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"EchoTime2": 0.00702,
"EchoTime1": 0.006,
"IntendedFor": "ses-1/func/sub-01_ses-1_task-rest_acq-fullbrain_run-2_bold.nii.gz"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
filename positive negative future past myself people surroundings vigilance images words specific_vague intrusive
func/sub-01_ses-1_task-rest_acq-fullbrain_run-1_bold.nii.gz 90 0 100 100 80 100 100 95 0 100 90 30
func/sub-01_ses-1_task-rest_acq-fullbrain_run-2_bold.nii.gz 85 0 90 100 100 100 20 100 0 100 100 30
func/sub-01_ses-1_task-rest_acq-prefrontal_bold.nii.gz 75 0 75 100 100 85 15 100 0 100 95 35
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"EchoTime2": 0.00702,
"EchoTime1": 0.006,
"IntendedFor": "ses-2/func/sub-01_ses-2_task-rest_acq-fullbrain_run-1_bold.nii.gz"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"EchoTime2": 0.00702,
"EchoTime1": 0.006,
"IntendedFor": "ses-2/func/sub-01_ses-2_task-rest_acq-fullbrain_run-2_bold.nii.gz"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
filename positive negative future past myself people surroundings vigilance images words specific_vague intrusive
func/sub-01_ses-2_task-rest_acq-fullbrain_run-1_bold.nii.gz 95 0 100 0 90 100 75 100 20 100 100 60
func/sub-01_ses-2_task-rest_acq-fullbrain_run-2_bold.nii.gz 70 25 100 0 100 100 80 75 0 100 100 65
func/sub-01_ses-2_task-rest_acq-prefrontal_bold.nii.gz 100 0 100 100 100 100 20 70 0 100 80 65
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
session CCPT_avg_succ_RT CCPT_avg_FP_RT CCPT_avg_FN_RT CCPT_succ_count CCPT_FP_count CCPT_FN_count subject_id panas_cheerful panas_disgusted panas_attentive panas_bashful panas_sluggish panas_daring panas_surprised panas_strong panas_scornful panas_relaxed panas_irritable panas_delighted panas_inspired panas_fearless panas_disgusted_with_self panas_sad panas_calm panas_afraid panas_tired panas_amazed panas_shaky panas_happy panas_timid panas_alone panas_alert panas_upset panas_angry panas_bold panas_blue panas_shy panas_active panas_guilty panas_joyful panas_nervous panas_lonely panas_sleepy panas_excited panas_hostile panas_proud panas_jittery panas_lively panas_ashamed panas_at_ease panas_scared panas_drowsy panas_angry_at_self panas_enthusiastic panas_downhearted panas_sheepish panas_distressed panas_blameworthy panas_determined panas_frightened panas_astonished panas_interested panas_loathing panas_confident panas_energetic panas_concentrating panas_dissatisfied_with_self hours_of_sleep_ussually hours_of_sleep_last_night vigilance quality_of_sleep thirst liters_of_water_daily relative_water_intake caffeine_daily relative_caffeine_intake systolic_blood_pressure_left diastolic_blood_pressure_left pulse_left systolic_blood_pressure_right diastolic_blood_pressure_right pulse_right positive negative future past myself people surroundings vigilance_nyc-q images words specific_vague intrusive
ses-1 500.7708333333333 507.0 n/a 96.0 1.0 0.0 1 6 4 6 2 4 4 2 5 4 6 3 5 6 6 2 1 5 2 2 4 2 7 4 1 5 1 2 4 4 1 7 1 7 2 1 5 6 1 4 2 6 2 1 1 4 2 6 1 1 1 4 5 1 5 6 1 4 6 3 5 8.0 9.5 9 5 9 1.0 7 0.5 1 108 64 66 109 69 70 0 0 75 15 5 70 0 100 0 100 95 50
ses-2 503.3333333333333 595.0 n/a 96.0 1.0 0.0 1 4 2 6 1 4 5 2 4 5 6 3 5 5 3 2 5 7 1 5 4 1 7 4 1 6 1 1 4 4 1 6 5 5 3 1 1 6 1 4 2 6 1 1 1 4 1 5 1 4 1 4 4 1 5 7 1 6 6 7 1 8.0 7.5 7 9 9 2.0 5 2.0 3 101 66 70 101 65 76 100 5 80 90 5 80 20 100 0 100 100 50
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"CogAtlasID": "trm_4c8a834779883",
"EchoTime": 0.017,
"EffectiveEchoSpacing": 0.0003333262223739227,
"PhaseEncodingDirection": "j-",
"RepetitionTime": 3.0,
"SliceEncodingDirection": "k",
"SliceTiming": [
1.508,
0.0,
1.55,
0.043,
1.592,
0.087,
1.635,
0.13,
1.677,
0.173,
1.722,
0.215,
1.765,
0.26,
1.808,
0.302,
1.85,
0.345,
1.893,
0.388,
1.938,
0.43,
1.98,
0.475,
2.022,
0.518,
2.065,
0.56,
2.11,
0.603,
2.152,
0.645,
2.195,
0.69,
2.238,
0.733,
2.28,
0.775,
2.325,
0.818,
2.367,
0.86,
2.41,
0.905,
2.453,
0.948,
2.495,
0.99,
2.54,
1.032,
2.583,
1.075,
2.625,
1.12,
2.668,
1.163,
2.71,
1.205,
2.755,
1.248,
2.798,
1.293,
2.84,
1.335,
2.883,
1.378,
2.925,
1.42,
2.97,
1.462
],
"TaskName": "Rest"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"StartTime": 0,
"SamplingFrequency": 100,
"Columns": ["cardiac", "respiratory", "trigger", "oxygen saturation"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"StartTime": 0,
"SamplingFrequency": 100,
"Columns": ["cardiac", "respiratory", "trigger", "oxygen saturation"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"CogAtlasID": "trm_4c8a834779883",
"EchoTime": 0.026,
"EffectiveEchoSpacing": 0.00032998944033790924,
"PhaseEncodingDirection": "j-",
"RepetitionTime": 4.0,
"SliceEncodingDirection": "k",
"SliceTiming": [
3.915,
3.815,
3.715,
3.615,
3.515,
3.413,
3.312,
3.212,
3.112,
3.013,
2.913,
2.81,
2.71,
2.61,
2.51,
2.41,
2.31,
2.21,
2.108,
2.008,
1.908,
1.808,
1.707,
1.608,
1.505,
1.405,
1.305,
1.205,
1.105,
1.005,
0.902,
0.802,
0.703,
0.603,
0.502,
0.402,
0.302,
0.2,
0.1,
0.0
],
"TaskName": "Rest"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"StartTime": 0,
"SamplingFrequency": 100,
"Columns": ["cardiac", "respiratory", "trigger", "oxygen saturation"]
}
6 changes: 6 additions & 0 deletions utils/issues/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,4 +503,10 @@ module.exports = {
reason:
'_fieldmap.nii[.gz] file does not have accompanying _magnitude.nii[.gz] file. ',
},
92: {
key: 'MISSING_MAGNITUDE1_FILE',
severity: 'warning',
reason:
'Each _phasediff.nii[.gz] file should be associated with a _magnitude1.nii[.gz] file.',
},
}
22 changes: 22 additions & 0 deletions validators/bids.js
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,28 @@ BIDS = {
})
// End fieldmap check

// check to see if each phasediff is associated with magnitude1
const phaseDiffNiftis = niftiNames.filter(
nifti => nifti.indexOf('phasediff') > -1,
)
const magnitude1Niftis = niftiNames.filter(
nifti => nifti.indexOf('magnitude1') > -1,
)
phaseDiffNiftis.map(nifti => {
const associatedMagnitudeFile = nifti.replace(
'phasediff',
'magnitude1',
)
if (magnitude1Niftis.indexOf(associatedMagnitudeFile) === -1) {
self.issues.push(
new Issue({
code: 92,
file: niftis.find(niftiFile => niftiFile.name == nifti),
}),
)
}
})

async.eachOfLimit(
niftis,
200,
Expand Down

0 comments on commit fbc5ce7

Please sign in to comment.