Medical Imaging Interaction Toolkit  2018.4.99-c670e289
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 
69  static bool DetermineAffectedImageSlice(const Image *image,
70  const PlaneGeometry *plane,
71  int &affectedDimension,
72  int &affectedSlice);
73 
83  static void UpdateSurfaceInterpolation(const Image *slice,
84  const Image *workingImage,
85  const PlaneGeometry *plane,
86  bool detectIntersection);
87 
88  void SetShowMarkerNodes(bool);
89 
94  void SetEnable3DInterpolation(bool);
95 
96  protected:
97  SegTool2D(); // purposely hidden
98  SegTool2D(const char *, const us::Module *interactorModule = nullptr); // purposely hidden
99  ~SegTool2D() override;
100 
102  {
105  unsigned int timestep;
106 
108  SliceInformation(mitk::Image *slice, mitk::PlaneGeometry *plane, unsigned int timestep)
109  {
110  this->slice = slice;
111  this->plane = plane;
112  this->timestep = timestep;
113  }
114  };
115 
122  bool FilterEvents(InteractionEvent *interactionEvent, DataNode *dataNode) override;
123 
134  Image::Pointer GetAffectedImageSliceAs2DImage(const InteractionPositionEvent *positionEvent, const Image *image, unsigned int component = 0);
135 
147  Image::Pointer GetAffectedImageSliceAs2DImage(const PlaneGeometry *planeGeometry,
148  const Image *image,
149  unsigned int timeStep,
150  unsigned int component = 0);
151 
158  Image::Pointer GetAffectedWorkingSlice(const InteractionPositionEvent *);
159 
166  Image::Pointer GetAffectedReferenceSlice(const InteractionPositionEvent *);
167 
168  void WriteBackSegmentationResult(const InteractionPositionEvent *, Image *);
169 
170  void WriteBackSegmentationResult(const PlaneGeometry *planeGeometry, Image *, unsigned int timeStep);
171 
172  void WriteBackSegmentationResult(const std::vector<SliceInformation> &sliceList, bool writeSliceToVolume = true);
173 
174  void WritePreviewOnWorkingImage(
175  Image *targetSlice, Image *sourceSlice, Image *workingImage, int paintingPixelValue, int timestep);
176 
177  void WriteSliceToVolume(const SliceInformation &sliceInfo);
182  int AddContourmarker();
183 
184  void InteractiveSegmentationBugMessage(const std::string &message);
185 
187  unsigned int m_LastEventSlice;
188 
189  private:
190  // The prefix of the contourmarkername. Suffix is a consecutive number
191  const std::string m_Contourmarkername;
192 
193  bool m_ShowMarkerNodes;
194  static bool m_SurfaceInterpolationEnabled;
195  };
196 
197 } // namespace
198 
199 #endif
unsigned int m_LastEventSlice
Base class of all tools used by mitk::ToolManager.
Definition: mitkTool.h:86
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:73
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:57