Skip to content

Commit ae2f946

Browse files
committed
ENH(TST): basic test for consistent choice of slice_code in case of multiple available
1 parent 7ba14b1 commit ae2f946

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

nibabel/tests/test_nifti1.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,16 @@ def test_slice_times(self):
558558
assert_equal(hdr['slice_end'], 5)
559559
assert_array_almost_equal(hdr['slice_duration'], 0.1)
560560

561+
# Ambiguous case
562+
hdr2 = self.header_class()
563+
hdr2.set_dim_info(slice=2)
564+
hdr2.set_slice_duration(0.1)
565+
hdr2.set_data_shape((1, 1, 2))
566+
hdr2.set_slice_times([0.1, 0]) # will generate warning that multiple match
567+
# but always must be choosing sequential one first
568+
assert_equal(hdr2.get_value_label('slice_code'), 'sequential decreasing')
569+
570+
561571
def test_intents(self):
562572
ehdr = self.header_class()
563573
ehdr.set_intent('t test', (10,), name='some score')

0 commit comments

Comments
 (0)