/[Slicer3]/branches/Slicer4-EMSegment/vtkEMSegmentLogic.h
ViewVC logotype

Contents of /branches/Slicer4-EMSegment/vtkEMSegmentLogic.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 17135 - (show annotations) (download)
Tue Aug 8 17:21:54 2017 UTC (2 months, 1 week ago) by msmolens
File MIME type: text/plain
File size: 10861 byte(s)
COMP: Fix inconsistent-missing-override warnings

This commit fixes warnings like the following:

    Slicer-0-build/EMSegment/MRML/vtkMRMLEMSNode.h:27:8: warning: 'PrintSelf' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
      void PrintSelf(ostream& os, vtkIndent indent);
           ^
    Slicer-0/Libs/MRML/Core/vtkMRMLNode.h:144:8: note: overridden virtual function is here
      void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
           ^

From: Hina Shah <hina.shah@kitware.com>


1 #ifndef __vtkEMSegmentLogic_h
2 #define __vtkEMSegmentLogic_h
3
4 // Slicer includes
5 #include <vtkSlicerModuleLogic.h>
6 #include <vtkSlicerConfigure.h> // For Slicer3_USE_KWWIDGETS
7
8 // EMSegment includes
9 #include "vtkEMSegment.h"
10 #include "vtkSlicerCommonInterface.h"
11
12 #ifdef Slicer3_USE_KWWIDGETS
13 class vtkMRMLAtlasCreatorNode;
14 #endif
15
16 class vtkEMSegmentMRMLManager;
17 class vtkGridTransform;
18 class vtkImageData;
19 class vtkImageEMLocalClass;
20 class vtkImageEMLocalGenericClass;
21 class vtkImageEMLocalSegmenter;
22 class vtkImageEMLocalSuperClass;
23 class vtkImageLevelSets;
24 class vtkMatrix4x4;
25 class vtkMRMLScalarVolumeNode;
26 class vtkMRMLVolumeNode;
27 class vtkSlicerApplicationLogic;
28 class vtkTransform;
29
30 class VTK_EMSEGMENT_EXPORT vtkEMSegmentLogic: public vtkSlicerModuleLogic
31 {
32 public:
33 static vtkEMSegmentLogic *New();
34
35 vtkTypeMacro(vtkEMSegmentLogic,vtkSlicerModuleLogic);
36
37 // Description: The name of the Module---this is used to construct
38 // the proc invocations
39 vtkGetStringMacro(ModuleName)
40 vtkSetStringMacro(ModuleName)
41
42 vtkGetStringMacro(CurrentTmpFileName)
43 vtkSetStringMacro(CurrentTmpFileName)
44
45 char* mktemp_file(const char* postfix);
46 // creates up to two directories - one without postfix and one with - returns the name without postfix
47 const char* mktemp_dir(const char* postfix);
48
49 //
50 // actions
51 //
52 virtual bool StartPreprocessingInitializeInputData();
53 //BTX
54 std::string GetTclGeneralDirectory();
55 //ETX
56
57 // Used within StartSegmentation to copy data from the MRMLManager
58 // to the segmenter algorithm. Possibly useful for research
59 // purposes.
60 virtual void CopyDataToSegmenter(vtkImageEMLocalSegmenter* segmenter);
61
62 //
63 // progress bar related functions: not currently used, likely to
64 // change
65 vtkGetStringMacro(ProgressCurrentAction)
66 vtkGetMacro(ProgressGlobalFractionCompleted, double)
67 vtkGetMacro(ProgressCurrentFractionCompleted, double)
68
69 //
70 // MRML Related Methods. The collection of MRML nodes for the
71 // EMSegmenter is complicated. Therefore, the management of these
72 // nodes are delegated to the vtkEMSegmentMRMLManager class.
73 vtkGetObjectMacro(MRMLManager, vtkEMSegmentMRMLManager)
74
75 // Register all the nodes used by this module with the current MRML
76 // scene.
77 virtual void RegisterMRMLNodesWithScene();
78
79 /// Register MRML Node classes to Scene. Gets called automatically when the MRMLScene is attached to this logic class.
80 virtual void RegisterNodes() VTK_OVERRIDE;
81 virtual void SetAndObserveMRMLScene(vtkMRMLScene* scene);
82
83 // this is needed in Slicer4 to properly listen to the nodeAdded and nodeRemoved events
84 void InitializeEventListeners();
85
86 virtual void ProcessMRMLEvents(vtkObject *caller, unsigned long event, void *callData);
87
88 // ProcessMRMLEvents is renamed into ProcessMRMLSceneEvents in Slicer4
89 virtual void ProcessMRMLSceneEvents(vtkObject *caller,
90 unsigned long event,
91 void *callData) VTK_OVERRIDE;
92
93 // events to observe
94 virtual vtkIntArray* NewObservableEvents();
95
96 void
97 StartPreprocessingResampleAndCastToTarget(vtkMRMLVolumeNode* movingVolumeNode, vtkMRMLVolumeNode* fixedVolumeNode, vtkMRMLVolumeNode* outputVolumeNode);
98
99 static void
100 TransferIJKToRAS(vtkMRMLVolumeNode* volumeNode, int ijk[3], double ras[3]);
101 static void
102 TransferRASToIJK(vtkMRMLVolumeNode* volumeNode, double ras[3], int ijk[3]);
103
104 static double GuessRegistrationBackgroundLevel(vtkMRMLVolumeNode* volumeNode);
105
106 static void
107 SlicerImageResliceWithGrid(vtkMRMLVolumeNode* inputVolumeNode, vtkMRMLVolumeNode* outputVolumeNode, vtkMRMLVolumeNode* outputVolumeGeometryNode, vtkGridTransform* outputRASToInputRASTransform, int iterpolationType, double backgroundLevel);
108
109 // utility---should probably go to general slicer lib at some point
110 static void
111 SlicerImageReslice(vtkMRMLVolumeNode* inputVolumeNode, vtkMRMLVolumeNode* outputVolumeNode, vtkMRMLVolumeNode* outputVolumeGeometryNode, vtkTransform* outputRASToInputRASTransform, int iterpolationType, double backgroundLevel);
112
113 // Helper Classes for tcl
114 void PrintTextNoNewLine(char *TEXT);
115 void PrintText(char *TEXT);
116
117 void DefineValidSegmentationBoundary();
118 void AutoCorrectSpatialPriorWeight(vtkIdType nodeID);
119
120 // This function is part of the EMSegmenter's stable API
121 vtkMRMLScalarVolumeNode
122 * AddArchetypeScalarVolume(const char* filename, const char* volname, vtkSlicerApplicationLogic* appLogic, vtkMRMLScene* mrmlScene);
123
124 vtkMRMLScalarVolumeNode
125 * AddArchetypeScalarVolume(const char* filename, const char* volname, vtkSlicerApplicationLogic* appLogic, vtkMRMLScene* mrmlScene, bool centered);
126
127 //BTX
128 std::string GetErrorMessage()
129 {
130 return this->ErrorMsg;
131 }
132 //ETX
133
134 virtual void CreateOutputVolumeNode();
135
136 void SubParcelateSegmentation(vtkImageData* origSegmentation, vtkImageData* currentParcellation, vtkIdType nodeID);
137
138 // functions for packaging and writing intermediate results
139 virtual void
140 CreatePackageFilenames(vtkMRMLScene* scene, const char* packageDirectoryName);
141 virtual bool CreatePackageDirectories(const char* packageDirectoryName);
142 virtual bool WritePackagedScene(vtkMRMLScene* scene);
143
144 //BTX
145 void
146 AddDefaultTasksToList(const char* FilePath, std::vector<std::string> & DefaultTasksName, std::vector<
147 std::string> & DefaultTasksFile, std::vector<std::string> & DefinePreprocessingTasksName, std::vector<
148 std::string> & DefinePreprocessingTasksFile);
149 //ETX
150
151 int StartSegmentationWithoutPreprocessingAndSaving();
152 virtual int
153 StartSegmentationWithoutPreprocessing(vtkSlicerApplicationLogic *appLogic);
154
155 //
156 // actions
157 //
158 virtual bool SaveIntermediateResults(vtkSlicerApplicationLogic *appLogic);
159
160 // copy all nodes relating to the EMSegmenter into newScene
161 // and write to file
162 virtual bool
163 PackageAndWriteData(vtkSlicerApplicationLogic *appLogic, const char* packageDirectoryName);
164
165 //BTX
166 std::string GetTemporaryTaskDirectory();
167 //ETX
168
169 int UpdateTasks();
170
171 //
172 // SLICER COMMON INTERFACE STARTS HERE
173 //
174
175 vtkSlicerCommonInterface* GetSlicerCommonInterface();
176 virtual int SourceTclFile(const char *tclFile);
177
178 const char* GetPluginWithFullPath(const char* pluginName);
179
180 //
181 // SLICER COMMON INTERFACE ENDS HERE
182 //
183 virtual int SourceTaskFiles();
184
185 virtual int SourcePreprocessingTclFiles();
186 int ComputeIntensityDistributionsFromSpatialPrior();
187
188 const char* DefineTclTaskFileFromMRML();
189 const char* DefineTclFullPathName(const char* TclFileName);
190
191
192 //BTX
193 std::string GetTclTaskDirectory();
194 void CreateDefaultTasksList(std::vector<std::string> & DefaultTasksName,
195 std::vector<std::string> & DefaultTasksFile,
196 std::vector<std::string> & DefinePreprocessingTasksName,
197 std::vector<std::string> & DefinePreprocessingTasksFile);
198 //ETX
199
200 void UpdateIntensityDistributionAuto(vtkIdType nodeID);
201
202 #ifdef Slicer3_USE_KWWIDGETS
203 void RunAtlasCreator(vtkMRMLAtlasCreatorNode *node);
204 #endif
205
206 void WriteImage(vtkImageData* file, const char* filename);
207
208
209 #ifdef Slicer3_USE_KWWIDGETS
210 // we do not want to wrap this function in Slicer3
211 // it is only used in Slicer4
212
213 //BTX
214 #endif
215 std::string GetTasks();
216 std::string GetPreprocessingTasks();
217
218 #ifdef Slicer3_USE_KWWIDGETS
219 //ETX
220 #endif
221
222 int GetSlicerVersion();
223 int GetVTKVersion();
224
225 // Remove all temporary files and directories generated by the logic
226 void RemoveTaskAndTempFiles();
227 void RemoveTempFilesAndDirs();
228
229 // Preprocessing: Bias Field Correction
230 // set testFlag to 1 if you want to run it fast just for testing
231 vtkMRMLScalarVolumeNode* PreprocessingBiasFieldCorrection(vtkMRMLScalarVolumeNode *inputNode, int testFlag=0);
232
233 protected:
234
235 //BTX
236 template<class T>
237 static T GuessRegistrationBackgroundLevel(vtkImageData* imageData);
238 //ETX
239
240 static void
241 ComposeGridTransform(vtkGridTransform* inGrid, vtkMatrix4x4* preMultiply, vtkMatrix4x4* postMultiply, vtkGridTransform* outGrid);
242
243 // Just provide tcl file name and correct directory will be added
244 virtual int SourceFileInTaskDirectory(const char *tclFile);
245
246 // Description:
247 // Convenience method for determining if two volumes have same geometry
248 static bool
249 IsVolumeGeometryEqual(vtkMRMLVolumeNode* lhs, vtkMRMLVolumeNode* rhs);
250
251 static void PrintImageInfo(vtkMRMLVolumeNode* volumeNode);
252 static void PrintImageInfo(vtkImageData* image);
253
254 // copy data from MRML to algorithm
255 virtual void CopyAtlasDataToSegmenter(vtkImageEMLocalSegmenter* segmenter);
256 virtual void CopyTargetDataToSegmenter(vtkImageEMLocalSegmenter* segmenter);
257 virtual void CopyGlobalDataToSegmenter(vtkImageEMLocalSegmenter* segmenter);
258 virtual void
259 CopyTreeDataToSegmenter(vtkImageEMLocalSuperClass* node, vtkIdType nodeID);
260 virtual void
261 CopyTreeGenericDataToSegmenter(vtkImageEMLocalGenericClass* node, vtkIdType nodeID);
262 virtual void
263 CopyTreeParentDataToSegmenter(vtkImageEMLocalSuperClass* node, vtkIdType nodeID);
264 virtual void
265 CopyTreeLeafDataToSegmenter(vtkImageEMLocalClass* node, vtkIdType nodeID);
266
267 //
268 // convenience methods for translating enums between algorithm and
269 // this module
270 virtual int
271 ConvertGUIEnumToAlgorithmEnumStoppingConditionType(int guiEnumValue);
272 virtual int
273 ConvertGUIEnumToAlgorithmEnumInterpolationType(int guiEnumValue);
274
275 // not currently used
276 vtkSetStringMacro(ProgressCurrentAction)
277 ;
278 vtkSetMacro(ProgressGlobalFractionCompleted, double)
279 ;
280 vtkSetMacro(ProgressCurrentFractionCompleted, double)
281 ;
282
283 const char* GetTemporaryDirectory();
284
285 bool CreateIntermediateDirectory();
286
287 int
288 ActiveMeanField(vtkImageEMLocalSegmenter* segmenter, vtkImageData* result);
289 void
290 InitializeLevelSet(vtkImageLevelSets* levelset, vtkImageData* initVolume);
291
292 //
293 // because the mrml nodes are very complicated for this module, we
294 // delegate the handeling of them to a MRML manager
295 vtkEMSegmentMRMLManager* MRMLManager;
296
297 char *ModuleName;
298 char *CurrentTmpFileName;
299
300 //
301 // information related to progress bars: this mechanism is not
302 // currently implemented and might me best implemented elsewhere
303 char* ProgressCurrentAction;
304 double ProgressGlobalFractionCompleted;
305 double ProgressCurrentFractionCompleted;
306 //BTX
307 std::string ErrorMsg;
308 //ETX
309 vtkEMSegmentLogic();
310 ~vtkEMSegmentLogic();
311
312 std::vector<double> IntensityRangeWithinMask(vtkImageData* image, vtkImageData* mask);
313
314 private:
315 vtkEMSegmentLogic(const vtkEMSegmentLogic&);
316 void operator=(const vtkEMSegmentLogic&);
317
318 vtkSlicerCommonInterface *SlicerCommonInterface;
319
320 //BTX
321 std::string StringHolder;
322
323 std::vector<std::string> tempFileList;
324 std::vector<std::string> tempDirList;
325 //ETX
326
327
328
329 };
330
331 #endif

  ViewVC Help
Powered by ViewVC 1.1.22