Commit 95859bf7fb9ff3bbd6c0ddd29f85b6d86decdccd
1 parent
64cb1ae1
Exists in
master
and in
68 other branches
FIX: The images inverteds related in ticket #74
Showing
1 changed file
with
1 additions
and
15 deletions
Show diff stats
invesalius/reader/dicom.py
@@ -17,7 +17,6 @@ | @@ -17,7 +17,6 @@ | ||
17 | # PARTICULAR. Consulte a Licenca Publica Geral GNU para obter mais | 17 | # PARTICULAR. Consulte a Licenca Publica Geral GNU para obter mais |
18 | # detalhes. | 18 | # detalhes. |
19 | #--------------------------------------------------------------------- | 19 | #--------------------------------------------------------------------- |
20 | -import tempfile | ||
21 | import time | 20 | import time |
22 | 21 | ||
23 | import gdcm | 22 | import gdcm |
@@ -1875,16 +1874,11 @@ class Image(object): | @@ -1875,16 +1874,11 @@ class Image(object): | ||
1875 | spacing[2] = round(spacing[2],2) | 1874 | spacing[2] = round(spacing[2],2) |
1876 | self.spacing = spacing | 1875 | self.spacing = spacing |
1877 | 1876 | ||
1878 | - def SetTempDir(self, directory): | ||
1879 | - self.directory = directory | ||
1880 | - | ||
1881 | @property | 1877 | @property |
1882 | def jpeg_file(self): | 1878 | def jpeg_file(self): |
1883 | if self._jpeg_file: | 1879 | if self._jpeg_file: |
1884 | return self._jpeg_file | 1880 | return self._jpeg_file |
1885 | else: | 1881 | else: |
1886 | - self._jpeg_file = tempfile.mktemp(suffix='.jpeg', dir=self.directory) | ||
1887 | - | ||
1888 | colorer = vtk.vtkImageMapToWindowLevelColors() | 1882 | colorer = vtk.vtkImageMapToWindowLevelColors() |
1889 | colorer.SetInput(self.imagedata) | 1883 | colorer.SetInput(self.imagedata) |
1890 | colorer.SetWindow(float(self.window)) | 1884 | colorer.SetWindow(float(self.window)) |
@@ -1894,18 +1888,10 @@ class Image(object): | @@ -1894,18 +1888,10 @@ class Image(object): | ||
1894 | 1888 | ||
1895 | width, height, z = colorer.GetOutput().GetDimensions() | 1889 | width, height, z = colorer.GetOutput().GetDimensions() |
1896 | 1890 | ||
1897 | - #jpeg_writer = vtk.vtkJPEGWriter() | ||
1898 | - #jpeg_writer.SetInput(colorer.GetOutput()) | ||
1899 | - ##jpeg_writer.SetFileName(self._jpeg_file) | ||
1900 | - #jpeg_writer.WriteToMemoryOn() | ||
1901 | - #jpeg_writer.Write() | ||
1902 | - ##jpeg_writer.Write() | ||
1903 | - | ||
1904 | r = colorer.GetOutput().GetPointData().GetScalars() | 1891 | r = colorer.GetOutput().GetPointData().GetScalars() |
1905 | ni = numpy_support.vtk_to_numpy(r) | 1892 | ni = numpy_support.vtk_to_numpy(r) |
1906 | #ni = ni.reshape(width, height, 3) | 1893 | #ni = ni.reshape(width, height, 3) |
1907 | - print width, height, z,ni.shape | ||
1908 | img = wx.ImageFromBuffer(width, height, ni) | 1894 | img = wx.ImageFromBuffer(width, height, ni) |
1909 | - img.Rescale(70, 70) | 1895 | + img = img.Rescale(70, 70).Mirror(False) |
1910 | self._jpeg_file = wx.BitmapFromImage(img) | 1896 | self._jpeg_file = wx.BitmapFromImage(img) |
1911 | return self._jpeg_file | 1897 | return self._jpeg_file |