1 #ifndef __IMAGEMPR__H__
2 #define __IMAGEMPR__H__
10 #include <vtkSmartPointer.h>
11 #include <cpExtensions/Visualization/MPRObjects.h>
14 #include <cpPlugins/Interface/Interface.h>
15 #include <cpPlugins/Interface/ProcessObject.h>
16 #include <cpPlugins/Interface/Image.h>
17 #include <cpPlugins/Interface/ImplicitFunction.h>
18 #include <cpPlugins/Interface/Mesh.h>
19 #include <vtkMetaImageWriter.h>
20 #include <vtkMetaImageReader.h>
23 // -------------------------------------------------------------------------
29 //==========================================================================
31 //typedef cpPlugins::Interface::Interface TPluginsInterface;
32 //typedef cpPlugins::Interface::Object TPluginObject;
33 //typedef cpPlugins::Interface::DataObject TPluginData;
34 //typedef cpPlugins::Interface::Image TPluginImage;
35 //typedef cpPlugins::Interface::ImplicitFunction TPluginImplicitFunction;
36 //typedef cpPlugins::Interface::Mesh TPluginMesh;
37 //typedef cpPlugins::Interface::ProcessObject TPluginFilter;
38 //typedef cpPlugins::Interface::Parameters TParameters;
40 //typedef cpExtensions::Visualization::MPRObjects TMPRObjects;
57 // MementoState(long id, TPluginImage* _img)
59 // char * base = "state";
60 // std::ostringstream oss;
62 // std::string str = oss.str();
63 // auto complement = str.c_str();
65 // std::string fileName(base);
66 // fileName.append(complement);
67 // fileName.append(".mhd");
69 // std::string fileNameRaw(base);
70 // fileNameRaw.append(complement);
71 // fileNameRaw.append(".raw");
72 // save(fileName, fileNameRaw, _img);
75 // vtkSmartPointer<vtkMetaImageReader> getMemento(long id)
77 // char * base = "state";
78 // std::ostringstream oss;
80 // std::string str = oss.str();
81 // auto complement = str.c_str();
83 // std::string fileName(base);
84 // fileName.append(complement);
85 // fileName.append(".mhd");
86 // return load(fileName);
89 // void save(const std::string& filename, const std::string& filenameRaw, TPluginImage* img) {
90 // vtkSmartPointer<vtkMetaImageWriter> writer =
91 // vtkSmartPointer<vtkMetaImageWriter>::New();
92 // writer->SetInputData(img->GetVTK< vtkImageData >());
93 // writer->SetFileName(filename.c_str());
94 // writer->SetRAWFileName(filenameRaw.c_str());
98 // vtkSmartPointer<vtkMetaImageReader> load(const std::string& filename) {
99 // vtkSmartPointer<vtkMetaImageReader> reader =
100 // vtkSmartPointer<vtkMetaImageReader>::New();
101 // reader->SetFileName(filename.c_str());
108 //==========================================================================
110 // -------------------------------------------------------------------------
123 typedef cpPlugins::Interface::Interface TPluginsInterface;
124 typedef cpPlugins::Interface::Object TPluginObject;
125 typedef cpPlugins::Interface::DataObject TPluginData;
126 typedef cpPlugins::Interface::Image TPluginImage;
127 typedef cpPlugins::Interface::ImplicitFunction TPluginImplicitFunction;
128 typedef cpPlugins::Interface::Mesh TPluginMesh;
129 typedef cpPlugins::Interface::ProcessObject TPluginFilter;
130 typedef cpPlugins::Interface::Parameters TParameters;
132 typedef cpExtensions::Visualization::MPRObjects TMPRObjects;
135 explicit ImageMPR( QWidget* parent = 0 );
136 virtual ~ImageMPR( );
139 bool _LoadPlugins( const std::string& filename );
140 std::string _LoadImage( TPluginImage::Pointer& image );
141 std::string _ConfigureMeshActors( );
144 void _triggered_actionOpenPlugins( );
145 void _triggered_actionOpenInputImage( );
146 void _triggered_actionOpenSegmentation( );
147 void _triggered_actionOpenInputPolyData( );
148 void _triggered_actionImageToImage( );
149 void _triggered_actionImageToMesh( );
150 void _triggered_actionUndo();
151 void _triggered_actionRedo();
156 TPluginsInterface m_Plugins;
158 // Needed object from plugins
159 std::string m_ImageReaderClass;
160 std::string m_ImageWriterClass;
161 std::string m_MeshReaderClass;
162 std::string m_MeshWriterClass;
163 std::string m_MeshCutterClass;
166 TPluginImage::Pointer m_Image;
167 TPluginImage::Pointer m_Segmentation;
168 TPluginMesh::Pointer m_Mesh;
171 TPluginFilter::Pointer m_Cutters[ 3 ];
172 TPluginImplicitFunction::Pointer m_Planes[ 3 ];
174 // Visualization stuff
175 vtkSmartPointer< TMPRObjects > m_MPRObjects;
178 unsigned long m_state;
179 unsigned long m_max_state;
182 vtkSmartPointer< vtkOrientationMarkerWidget > m_3DOrientationWidget;
186 #endif // __IMAGEMPR__H__