Commit ff5ac19376b917254fdc7526eb0d28e532b05162
1 parent
e53432ed
Exists in
master
and in
67 other branches
ENH: Using the right shape in memmap
Showing
1 changed file
with
2 additions
and
4 deletions
Show diff stats
invesalius/data/imagedata_utils.py
@@ -462,15 +462,13 @@ def dcm2memmap(files, slice_size): | @@ -462,15 +462,13 @@ def dcm2memmap(files, slice_size): | ||
462 | returns it and its related filename. | 462 | returns it and its related filename. |
463 | """ | 463 | """ |
464 | temp_file = tempfile.mktemp() | 464 | temp_file = tempfile.mktemp() |
465 | - shape = len(files), slice_size[0], slice_size[1] | 465 | + shape = len(files), slice_size[1], slice_size[0] |
466 | 466 | ||
467 | matrix = numpy.memmap(temp_file, mode='w+', dtype='int16', shape=shape) | 467 | matrix = numpy.memmap(temp_file, mode='w+', dtype='int16', shape=shape) |
468 | - | 468 | + dcm_reader = vtkgdcm.vtkGDCMImageReader() |
469 | for n, f in enumerate(files): | 469 | for n, f in enumerate(files): |
470 | - dcm_reader = vtkgdcm.vtkGDCMImageReader() | ||
471 | dcm_reader.SetFileName(f) | 470 | dcm_reader.SetFileName(f) |
472 | dcm_reader.Update() | 471 | dcm_reader.Update() |
473 | - | ||
474 | image = dcm_reader.GetOutput() | 472 | image = dcm_reader.GetOutput() |
475 | array = numpy_support.vtk_to_numpy(image.GetPointData().GetScalars()) | 473 | array = numpy_support.vtk_to_numpy(image.GetPointData().GetScalars()) |
476 | array.shape = matrix.shape[1], matrix.shape[2] | 474 | array.shape = matrix.shape[1], matrix.shape[2] |