Commit 9d673a4694047ef68d9e5c9ba4c43e75f06bf2df

Authored by Thiago Franco de Moraes
1 parent 1a679045
Exists in master

Forcing matrix shape to int when resizing

Showing 1 changed file with 6 additions and 6 deletions   Show diff stats
invesalius/data/imagedata_utils.py
... ... @@ -531,21 +531,21 @@ def dcm2memmap(files, slice_size, orientation, resolution_percentage):
531 531 if resolution_percentage == 1.0:
532 532 shape = slice_size[0], slice_size[1], len(files)
533 533 else:
534   - shape = math.ceil(slice_size[0]*resolution_percentage),\
535   - math.ceil(slice_size[1]*resolution_percentage), len(files)
  534 + shape = int(math.ceil(slice_size[0]*resolution_percentage)),\
  535 + int(math.ceil(slice_size[1]*resolution_percentage)), len(files)
536 536  
537 537 elif orientation == 'CORONAL':
538 538 if resolution_percentage == 1.0:
539 539 shape = slice_size[1], len(files), slice_size[0]
540 540 else:
541   - shape = math.ceil(slice_size[1]*resolution_percentage), len(files),\
542   - math.ceil(slice_size[0]*resolution_percentage)
  541 + shape = int(math.ceil(slice_size[1]*resolution_percentage)), len(files),\
  542 + int(math.ceil(slice_size[0]*resolution_percentage))
543 543 else:
544 544 if resolution_percentage == 1.0:
545 545 shape = len(files), slice_size[1], slice_size[0]
546 546 else:
547   - shape = len(files), math.ceil(slice_size[1]*resolution_percentage),\
548   - math.ceil(slice_size[0]*resolution_percentage)
  547 + shape = len(files), int(math.ceil(slice_size[1]*resolution_percentage)),\
  548 + int(math.ceil(slice_size[0]*resolution_percentage))
549 549  
550 550 matrix = numpy.memmap(temp_file, mode='w+', dtype='int16', shape=shape)
551 551 dcm_reader = vtkgdcm.vtkGDCMImageReader()
... ...