Commit a573cf37396304e59d9131a5cd925cdcaed2a9d7
1 parent
afdb3ce1
Exists in
master
Handling orientation
Showing
1 changed file
with
13 additions
and
2 deletions
Show diff stats
invesalius/data/imagedata_utils.py
| ... | ... | @@ -681,11 +681,22 @@ def dcmmf2memmap(dcm_file, orientation): |
| 681 | 681 | |
| 682 | 682 | d = numpy_support.vtk_to_numpy(o.GetPointData().GetScalars()) |
| 683 | 683 | d.shape = z, y, x |
| 684 | - matrix[:] = d | |
| 685 | - matrix.flush() | |
| 684 | + if orientation == 'CORONAL': | |
| 685 | + matrix.shape = y, z, x | |
| 686 | + for n in xrange(z): | |
| 687 | + matrix[:, n, :] = d[n] | |
| 688 | + elif orientation == 'SAGITTAL': | |
| 689 | + matrix.shape = x, z, y | |
| 690 | + for n in xrange(z): | |
| 691 | + matrix[:, :, n] = d[n] | |
| 692 | + else: | |
| 693 | + matrix[:] = d | |
| 686 | 694 | |
| 695 | + matrix.flush() | |
| 687 | 696 | scalar_range = matrix.min(), matrix.max() |
| 688 | 697 | |
| 698 | + print "ORIENTATION", orientation | |
| 699 | + | |
| 689 | 700 | return matrix, spacing, scalar_range, temp_file |
| 690 | 701 | |
| 691 | 702 | ... | ... |