diff --git a/invesalius/constants.py b/invesalius/constants.py index 38ed439..8a15148 100644 --- a/invesalius/constants.py +++ b/invesalius/constants.py @@ -403,6 +403,7 @@ FILETYPE_VRML = wx.NewId() FILETYPE_OBJ = wx.NewId() FILETYPE_VTP = wx.NewId() FILETYPE_PLY = wx.NewId() +FILETYPE_X3D = wx.NewId() FILETYPE_IMAGEDATA = wx.NewId() diff --git a/invesalius/data/viewer_volume.py b/invesalius/data/viewer_volume.py index 2b7debf..02334ca 100755 --- a/invesalius/data/viewer_volume.py +++ b/invesalius/data/viewer_volume.py @@ -168,7 +168,6 @@ class Viewer(wx.Panel): def OnExportPicture(self, pubsub_evt): ps.Publisher().sendMessage('Begin busy cursor') id, filename, filetype = pubsub_evt.data - if id == const.VOLUME: if filetype == const.FILETYPE_POV: renwin = self.interactor.GetRenderWindow() @@ -458,6 +457,12 @@ class Viewer(wx.Panel): writer.SetFileName(filename) writer.SetInput(renwin) writer.Write() + elif filetype == const.FILETYPE_X3D: + writer = vtk.vtkX3DExporter() + writer.SetInput(renwin) + writer.SetFileName(filename) + writer.Update() + writer.Write() elif filetype == const.FILETYPE_OBJ: writer = vtk.vtkOBJExporter() writer.SetFilePrefix(fileprefix) diff --git a/invesalius/gui/task_exporter.py b/invesalius/gui/task_exporter.py index 8498e53..66533ac 100644 --- a/invesalius/gui/task_exporter.py +++ b/invesalius/gui/task_exporter.py @@ -42,7 +42,8 @@ WILDCARD_SAVE_3D = "Inventor (*.iv)|*.iv|"\ "STL ASCII (*.stl)|*.stl|"\ "VRML (*.vrml)|*.vrml|"\ "VTK PolyData (*.vtp)|*.vtp|"\ - "Wavefront (*.obj)|*.obj" + "Wavefront (*.obj)|*.obj|"\ + "X3D (*.x3d)|*.x3d" INDEX_TO_TYPE_3D = {0: const.FILETYPE_IV, 1: const.FILETYPE_PLY, @@ -51,7 +52,8 @@ INDEX_TO_TYPE_3D = {0: const.FILETYPE_IV, 4: const.FILETYPE_STL_ASCII, 5: const.FILETYPE_VRML, 6: const.FILETYPE_VTP, - 7: const.FILETYPE_OBJ} + 7: const.FILETYPE_OBJ, + 8: const.FILETYPE_X3D} INDEX_TO_EXTENSION = {0: "iv", 1: "ply", 2: "rib", @@ -59,7 +61,8 @@ INDEX_TO_EXTENSION = {0: "iv", 4: "stl", 5: "vrml", 6: "vtp", - 7: "obj"} + 7: "obj", + 8: "x3d"} WILDCARD_SAVE_2D = "BMP (*.bmp)|*.bmp|"\ "JPEG (*.jpg)|*.jpg|"\ -- libgit2 0.21.2