Commit 2dd530d10f56fbe81ec6a0b889dedfdff3aed902
1 parent
1ea30e1a
Exists in
master
and in
6 other branches
FIX: Again function to reduce vtkImageData with 3 dimension.
Showing
1 changed file
with
8 additions
and
8 deletions
Show diff stats
invesalius/reader/dicom_reader.py
@@ -25,7 +25,7 @@ import gdcm | @@ -25,7 +25,7 @@ import gdcm | ||
25 | 25 | ||
26 | import dicom | 26 | import dicom |
27 | import dicom_grouper | 27 | import dicom_grouper |
28 | -from data.imagedata_utils import ResampleMatrix | 28 | +from data.imagedata_utils import ResampleImage2D |
29 | 29 | ||
30 | def LoadImages(dir_): | 30 | def LoadImages(dir_): |
31 | # TODO!!! SUPER GAMBIARRA!!! DO THIS BETTER | 31 | # TODO!!! SUPER GAMBIARRA!!! DO THIS BETTER |
@@ -92,22 +92,22 @@ def LoadImages(dir_): | @@ -92,22 +92,22 @@ def LoadImages(dir_): | ||
92 | for x in xrange(len(files)): | 92 | for x in xrange(len(files)): |
93 | if not(reduce_matrix): | 93 | if not(reduce_matrix): |
94 | array.InsertValue(x,files[x]) | 94 | array.InsertValue(x,files[x]) |
95 | - else: | 95 | + else: |
96 | #SIf the resolution of the | 96 | #SIf the resolution of the |
97 | #matrix is very large | 97 | #matrix is very large |
98 | read = vtkgdcm.vtkGDCMImageReader() | 98 | read = vtkgdcm.vtkGDCMImageReader() |
99 | read.SetFileName(files[x]) | 99 | read.SetFileName(files[x]) |
100 | read.Update() | 100 | read.Update() |
101 | - | 101 | + |
102 | #Resample image in x,y dimension | 102 | #Resample image in x,y dimension |
103 | - img = ResampleMatrix(read.GetOutput(), 256) | ||
104 | - | 103 | + img = ResampleImage2D(read.GetOutput(), 256) |
104 | + | ||
105 | #Stack images in Z axes | 105 | #Stack images in Z axes |
106 | img_app.AddInput(img) | 106 | img_app.AddInput(img) |
107 | - | 107 | + |
108 | img_app.Update() | 108 | img_app.Update() |
109 | img_axial = vtk.vtkImageData() | 109 | img_axial = vtk.vtkImageData() |
110 | - | 110 | + |
111 | if (reduce_matrix): | 111 | if (reduce_matrix): |
112 | img_axial.DeepCopy(img_app.GetOutput()) | 112 | img_axial.DeepCopy(img_app.GetOutput()) |
113 | img_axial.SetSpacing(img_axial.GetSpacing()[0],\ | 113 | img_axial.SetSpacing(img_axial.GetSpacing()[0],\ |
@@ -117,7 +117,7 @@ def LoadImages(dir_): | @@ -117,7 +117,7 @@ def LoadImages(dir_): | ||
117 | read = vtkgdcm.vtkGDCMImageReader() | 117 | read = vtkgdcm.vtkGDCMImageReader() |
118 | read.SetFileNames(array) | 118 | read.SetFileNames(array) |
119 | read.Update() | 119 | read.Update() |
120 | - | 120 | + |
121 | img_axial.DeepCopy(read.GetOutput()) | 121 | img_axial.DeepCopy(read.GetOutput()) |
122 | img_axial.SetSpacing(spacing, spacing, spacing_z) | 122 | img_axial.SetSpacing(spacing, spacing, spacing_z) |
123 | 123 |