diff --git a/nrrd/reader.py b/nrrd/reader.py index cdf2e11..be30286 100644 --- a/nrrd/reader.py +++ b/nrrd/reader.py @@ -367,7 +367,7 @@ def read_data(header, fh=None, filename=None, index_order='F'): fh = open(data_filename, 'rb') # Get the total number of data points by multiplying the size of each dimension together - total_data_points = header['sizes'].prod() + total_data_points = header['sizes'].prod(dtype=np.int64) # Skip the number of lines requested when line_skip >= 0 # Irrespective of the NRRD file having attached/detached header diff --git a/nrrd/tests/test_reading.py b/nrrd/tests/test_reading.py index 2551a97..4280496 100644 --- a/nrrd/tests/test_reading.py +++ b/nrrd/tests/test_reading.py @@ -412,16 +412,18 @@ def test_invalid_endian(self): with self.assertRaisesRegex(nrrd.NRRDError, 'Invalid endian value in header: "fake"'): nrrd.read_data(header, fh, RAW_NRRD_FILE_PATH) - def test_invalid_index_order(self): with self.assertRaisesRegex(nrrd.NRRDError, 'Invalid index order'): nrrd.read(RAW_NRRD_FILE_PATH, index_order=None) + class TestReadingFunctionsFortran(TestReadingFunctions, unittest.TestCase): index_order = 'F' + class TestReadingFunctionsC(TestReadingFunctions, unittest.TestCase): index_order = 'C' + if __name__ == '__main__': unittest.main()