From 9d673a4694047ef68d9e5c9ba4c43e75f06bf2df Mon Sep 17 00:00:00 2001 From: Thiago Franco de Moraes Date: Tue, 30 May 2017 14:27:16 -0300 Subject: [PATCH] Forcing matrix shape to int when resizing --- invesalius/data/imagedata_utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/invesalius/data/imagedata_utils.py b/invesalius/data/imagedata_utils.py index 90da58c..473a62d 100644 --- a/invesalius/data/imagedata_utils.py +++ b/invesalius/data/imagedata_utils.py @@ -531,21 +531,21 @@ def dcm2memmap(files, slice_size, orientation, resolution_percentage): if resolution_percentage == 1.0: shape = slice_size[0], slice_size[1], len(files) else: - shape = math.ceil(slice_size[0]*resolution_percentage),\ - math.ceil(slice_size[1]*resolution_percentage), len(files) + shape = int(math.ceil(slice_size[0]*resolution_percentage)),\ + int(math.ceil(slice_size[1]*resolution_percentage)), len(files) elif orientation == 'CORONAL': if resolution_percentage == 1.0: shape = slice_size[1], len(files), slice_size[0] else: - shape = math.ceil(slice_size[1]*resolution_percentage), len(files),\ - math.ceil(slice_size[0]*resolution_percentage) + shape = int(math.ceil(slice_size[1]*resolution_percentage)), len(files),\ + int(math.ceil(slice_size[0]*resolution_percentage)) else: if resolution_percentage == 1.0: shape = len(files), slice_size[1], slice_size[0] else: - shape = len(files), math.ceil(slice_size[1]*resolution_percentage),\ - math.ceil(slice_size[0]*resolution_percentage) + shape = len(files), int(math.ceil(slice_size[1]*resolution_percentage)),\ + int(math.ceil(slice_size[0]*resolution_percentage)) matrix = numpy.memmap(temp_file, mode='w+', dtype='int16', shape=shape) dcm_reader = vtkgdcm.vtkGDCMImageReader() -- libgit2 0.21.2