Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
mitkSegTool2D.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkSegTool2D_h_Included
14 #define mitkSegTool2D_h_Included
15 
16 #include "mitkCommon.h"
17 #include "mitkImage.h"
18 #include "mitkTool.h"
20 
22 
23 #include "mitkInteractionConst.h"
26 
27 #include <mitkDiffSliceOperation.h>
28 
29 namespace mitk
30 {
31  class BaseRenderer;
32 
55  {
56  public:
58 
67  static bool DetermineAffectedImageSlice(const Image *image,
68  const PlaneGeometry *plane,
69  int &affectedDimension,
70  int &affectedSlice);
71 
81  static void UpdateSurfaceInterpolation(const Image *slice,
82  const Image *workingImage,
83  const PlaneGeometry *plane,
84  bool detectIntersection);
85 
86  void SetShowMarkerNodes(bool);
87 
92  void SetEnable3DInterpolation(bool);
93 
94  protected:
95  SegTool2D(); // purposely hidden
96  SegTool2D(const char *, const us::Module *interactorModule = nullptr); // purposely hidden
97  ~SegTool2D() override;
98 
100  {
103  unsigned int timestep;
104 
106  SliceInformation(mitk::Image *slice, mitk::PlaneGeometry *plane, unsigned int timestep)
107  {
108  this->slice = slice;
109  this->plane = plane;
110  this->timestep = timestep;
111  }
112  };
113 
120  bool FilterEvents(InteractionEvent *interactionEvent, DataNode *dataNode) override;
121 
130  Image::Pointer GetAffectedImageSliceAs2DImage(const InteractionPositionEvent *positionEvent, const Image *image, unsigned int component = 0);
131 
140  Image::Pointer GetAffectedImageSliceAs2DImage(const PlaneGeometry *planeGeometry,
141  const Image *image,
142  unsigned int timeStep,
143  unsigned int component = 0);
144 
151  Image::Pointer GetAffectedWorkingSlice(const InteractionPositionEvent *);
152 
159  Image::Pointer GetAffectedReferenceSlice(const InteractionPositionEvent *);
160 
161  void WriteBackSegmentationResult(const InteractionPositionEvent *, Image *);
162 
163  void WriteBackSegmentationResult(const PlaneGeometry *planeGeometry, Image *, unsigned int timeStep);
164 
165  void WriteBackSegmentationResult(const std::vector<SliceInformation> &sliceList, bool writeSliceToVolume = true);
166 
167  void WritePreviewOnWorkingImage(
168  Image *targetSlice, Image *sourceSlice, Image *workingImage, int paintingPixelValue, int timestep);
169 
170  void WriteSliceToVolume(const SliceInformation &sliceInfo);
175  int AddContourmarker();
176 
177  void InteractiveSegmentationBugMessage(const std::string &message);
178 
180  unsigned int m_LastEventSlice;
181 
182  private:
183  // The prefix of the contourmarkername. Suffix is a consecutive number
184  const std::string m_Contourmarkername;
185 
186  bool m_ShowMarkerNodes;
187  static bool m_SurfaceInterpolationEnabled;
188  };
189 
190 } // namespace
191 
192 #endif
unsigned int m_LastEventSlice
Base class of all tools used by mitk::ToolManager.
Definition: mitkTool.h:88
Super class for all position events.
Organizes the rendering process.
#define MITKSEGMENTATION_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
SliceInformation(mitk::Image *slice, mitk::PlaneGeometry *plane, unsigned int timestep)
Constants for most interaction classes, due to the generic StateMachines.
BaseRenderer * m_LastEventSender
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
Image class for storing images.
Definition: mitkImage.h:72
mitk::Image::Pointer image
Abstract base class for segmentation tools.
Definition: mitkSegTool2D.h:54
Describes a two-dimensional, rectangular plane.
Class for nodes of the DataTree.
Definition: mitkDataNode.h:64