Commit d643301e9ccd2cd8181e8e40f37b2cc30c645b55
1 parent
6dc42bf8
Exists in
master
and in
67 other branches
ENH: Fixed problem fliped image in mesh generation
Showing
1 changed file
with
6 additions
and
2 deletions
Show diff stats
invesalius/data/surface_process.py
... | ... | @@ -53,7 +53,11 @@ class SurfaceProcess(multiprocessing.Process): |
53 | 53 | smoothed = numpy.array(self.mask[roi]) |
54 | 54 | image = imagedata_utils.to_vtk(smoothed, self.spacing, roi.start, |
55 | 55 | "AXIAL") |
56 | - | |
56 | + flip = vtk.vtkImageFlip() | |
57 | + flip.SetInput(image) | |
58 | + flip.SetFilteredAxis(1) | |
59 | + flip.FlipAboutOriginOn() | |
60 | + flip.Update() | |
57 | 61 | # Create vtkPolyData from vtkImageData |
58 | 62 | #print "Generating Polydata" |
59 | 63 | #if self.mode == "CONTOUR": |
... | ... | @@ -68,7 +72,7 @@ class SurfaceProcess(multiprocessing.Process): |
68 | 72 | #polydata = contour.GetOutput() |
69 | 73 | #else: #mode == "GRAYSCALE": |
70 | 74 | mcubes = vtk.vtkMarchingCubes() |
71 | - mcubes.SetInput(image) | |
75 | + mcubes.SetInput(flip.GetOutput()) | |
72 | 76 | mcubes.SetValue(0, self.min_value) |
73 | 77 | mcubes.SetValue(1, self.max_value) |
74 | 78 | mcubes.ComputeScalarsOff() | ... | ... |