NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkGeneralSegmentorController.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef niftkGeneralSegmentorController_h
16 #define niftkGeneralSegmentorController_h
17 
18 #include <niftkMIDASGuiExports.h>
19 
20 #include <mitkOperationActor.h>
21 
25 
27 
28 namespace mitk
29 {
30 class PointSet;
31 }
32 
33 namespace niftk
34 {
35 
36 class GeneralSegmentorControllerPrivate;
37 class GeneralSegmentorGUI;
38 
39 
130 class NIFTKMIDASGUI_EXPORT GeneralSegmentorController
131  : public BaseSegmentorController,
132  public mitk::OperationActor,
133  public ToolKeyPressResponder
134 {
135  Q_OBJECT
136 
137 public:
138 
140  virtual ~GeneralSegmentorController();
141 
144  virtual void SetupGUI(QWidget* parent) override;
145 
146  virtual bool SelectSeedTool() override;
147 
148  virtual bool SelectDrawTool() override;
149 
150  virtual bool UnselectTools() override;
151 
152  virtual bool SelectPolyTool() override;
153 
154  virtual bool SelectViewMode() override;
155 
156  virtual bool CleanSlice() override;
157 
159  virtual void ExecuteOperation(mitk::Operation* operation) override;
160 
161 protected:
162 
165  virtual bool IsASegmentationImage(const mitk::DataNode::Pointer node) override;
166 
169  virtual std::vector<mitk::DataNode*> GetWorkingDataFromSegmentationNode(const mitk::DataNode::Pointer node) override;
170 
174  virtual bool CanStartSegmentationForBinaryNode(const mitk::DataNode::Pointer node) override;
175 
177  virtual BaseGUI* CreateGUI(QWidget* parent) override;
178 
179  virtual void OnNodeVisibilityChanged(const mitk::DataNode* node, const mitk::BaseRenderer* renderer) override;
180 
194  virtual void OnSelectedSliceChanged(ImageOrientation orientation, int sliceIndex) override;
195 
196 protected slots:
197 
201  virtual void OnNewSegmentationButtonClicked() override;
202 
204  void OnSeePriorCheckBoxToggled(bool checked);
205 
207  void OnSeeNextCheckBoxToggled(bool checked);
208 
212  void OnCleanButtonClicked();
213 
216  void OnWipeButtonClicked();
217 
220  void OnWipePlusButtonClicked();
221 
224  void OnWipeMinusButtonClicked();
225 
228  void OnPropagateUpButtonClicked();
229 
232  void OnPropagateDownButtonClicked();
233 
236  void OnPropagate3DButtonClicked();
237 
241  void OnThresholdApplyButtonClicked();
242 
245  void OnThresholdingCheckBoxToggled(bool checked);
246 
249  void OnThresholdValueChanged();
250 
254  void OnAnyButtonClicked();
255 
259  void OnOKButtonClicked();
260 
264  void OnResetButtonClicked();
265 
269  void OnCancelButtonClicked();
270 
273  void OnRestartButtonClicked();
274 
275 private:
276 
277  virtual void OnViewGetsVisible() override;
278 
279  virtual void OnViewGetsHidden() override;
280 
283  void OnViewGetsClosed();
284 
289  virtual void OnNodeChanged(const mitk::DataNode* node) override;
290 
294  virtual void OnNodeRemoved(const mitk::DataNode* node) override;
295 
297  virtual void OnContoursChanged();
298 
300  mitk::DataNode::Pointer CreateHelperImage(const mitk::Image* referenceImage, const mitk::Color& colour, const std::string& name, bool visible, int layer);
301 
303  mitk::DataNode::Pointer CreateContourSet(const mitk::Color& colour, const std::string& name, bool visible, int layer);
304 
306  void StoreInitialSegmentation();
307 
309  mitk::PointSet* GetSeeds();
310 
314  void InitialiseSeedsForSlice(int sliceAxis, int sliceIndex);
315 
318  void RecalculateMinAndMaxOfImage();
319 
323  void RecalculateMinAndMaxOfSeedValues();
324 
326  bool DoesSliceHaveUnenclosedSeeds(bool thresholdOn, int sliceAxis, int sliceIndex);
327 
329  bool DoesSliceHaveUnenclosedSeeds(bool thresholdOn, int sliceAxis, int sliceIndex, const mitk::PointSet* seeds);
330 
332  void FilterSeedsToCurrentSlice(
333  const mitk::PointSet* inputPoints,
334  int sliceAxis,
335  int sliceIndex,
336  mitk::PointSet* outputPoints
337  );
338 
340  void FilterSeedsToEnclosedSeedsOnSlice(
341  const mitk::PointSet* inputPoints,
342  bool thresholdOn,
343  int sliceAxis,
344  int sliceIndex,
345  mitk::PointSet* outputPoints
346  );
347 
349  void UpdateRegionGrowing(bool updateRendering = true);
350 
353  void UpdateRegionGrowing(bool isVisible, int sliceAxis, int sliceIndex, double lowerThreshold, double upperThreshold, bool skipUpdate);
354 
356  void UpdateCurrentSliceContours(bool updateRendering = true);
357 
359  void UpdatePriorAndNext(bool updateRendering = true);
360 
362  void DoPropagate(bool isUp, bool is3D);
363 
366  bool DoWipe(int direction);
367 
371  bool DoThresholdApply(bool optimiseSeeds, bool newSliceEmpty, bool newCheckboxStatus);
372 
374  void ToggleTool(int toolId);
375 
377  void DestroyPipeline();
378 
380  void RemoveWorkingData();
381 
383  void RestoreInitialSegmentation();
384 
388  void DiscardSegmentation();
389 
391  void ClearWorkingData();
392 
393  QScopedPointer<GeneralSegmentorControllerPrivate> d_ptr;
394 
395  Q_DECLARE_PRIVATE(GeneralSegmentorController);
396 
397 };
398 
399 }
400 
401 #endif
GLenum GLenum GLuint GLint GLint layer
Definition: glew.h:3758
Provides the MIDAS general purpose, Irregular Volume Editor functionality originally developed at the...
Definition: niftkGeneralSegmentorController.h:130
ImageOrientation
Describes the different types of orientation, axial, sagittal, coronal, that can be achieved in the D...
Definition: niftkImageOrientation.h:26
Definition: ReceptorMemberCommandTest.cxx:25
Pure Virtual Interface to be implemented by classes that want to respond to MIDAS key events relevant...
Definition: niftkToolKeyPressResponder.h:34
Public interface to QmitkBaseView.
Definition: niftkIBaseView.h:39
Base class for GUI controls on BlueBerry views.
Definition: niftkBaseGUI.h:29
Definition: niftkBaseSegmentorController.h:39
GLuint const GLchar * name
Definition: glew.h:1798
Definition: niftkExceptionObject.h:21
GLsizei const GLcharARB ** string
Definition: glew.h:5194