MeVisLab Toolbox Reference
SoCSOIsoEditor.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2015, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #pragma once
14 
16 #include <SoSFMLImage.h>
18 #include <CSOBase/CSODefines.h>
19 
21 
24 {
25  SO_NODE_HEADER(SoCSOIsoEditor);
26 
27 public:
28 
30  ~SoCSOIsoEditor() override;
31 
32  static void initClass();
33 
36  SoSFTypedEnum<ml::CSOSmoothingModes> smoothingMode;
37 
38  void createStartPressAt(const SoPointerPosition& pos) override;
39 
40  void createNewCSO(const SoPointerPosition& pos);
41 
42  void createDragMoveTo(const SoPointerPosition& pos) override;
43  bool createEndPress(int clickCount) override;
45 
46  void selectAndMoveStartPressAt(const SoPointerPosition& pos) override;
47  void selectAndMoveDragMoveTo(const SoPointerPosition& pos) override;
48  SoPointingAction* selectAndMoveEndPress(int clickCount) override;
49 
50  void cancel() override;
51 
52  void initMembers() override;
53 
54 protected:
55 
57 
58 private:
59 
60  void _initialize();
61 
62  void _getVoxelPosition(const SoPointerPosition& pos, int& voxelPosX, int& voxelPosY) const;
63  ml::Vector3 _getWorldPosition(float voxelX, float voxelY);
64 
65  void _setImageData(const SoPointerPosition& pos);
66  bool _areEqual(const XVImageSize& imageSize1, const XVImageSize& imageSize2) const;
67  float _getIsoValue(const SoPointerPosition& pos) const;
68 
69  void _setIsoContourToCSO(const SoPointerPosition& pos, ml::CSO* cso);
70  void _fillCSO(ml::CSO* cso, const ml::CSOMarchingSquaresCell::vecPoint2D& positions);
71 
72  void fieldChanged(SoField*);
73 
74  float* _imageData;
75  int _imageSizeX;
76  int _imageSizeY;
77 
78  ml::Matrix4 _imageVoxelToWorldMatrix;
79 
80  int _sliceZ;
81  int _sliceT;
82  unsigned int _lastImageSerialNumber;
83 
84  ml::CSOMarchingSquares _marchingSquares;
85 };
86 
#define SOCSO_EXPORT
Header file for system independent resolution.
Definition: SoCSOSystem.h:21
Base class for extensions that extend the editor with interaction and rendering for specific CSO type...
Extension for rendering, generating, and modifying an iso CSO.
void createDragMoveTo(const SoPointerPosition &pos) override
SoPointingAction * selectAndMoveEndPress(int clickCount) override
SoSFMLImage inputImage
void cancel() override
Cancels an action like generating a CSO. Depends on concrete editor.
void selectAndMoveDragMoveTo(const SoPointerPosition &pos) override
void selectAndMoveStartPressAt(const SoPointerPosition &pos) override
void pointerPositionIfAllowedAt(const SoPointerPosition &) override
Sets seed points while moving the mouse – but not while dragging.
ml::Vector3 getCurrentPositon(const SoPointerPosition &pos)
void initMembers() override
bool createEndPress(int clickCount) override
void createStartPressAt(const SoPointerPosition &pos) override
SoSFBool interpolateContour
void createNewCSO(const SoPointerPosition &pos)
static void initClass()
~SoCSOIsoEditor() override
SoSFTypedEnum< ml::CSOSmoothingModes > smoothingMode
SoPointerPosition manages the current position of the mouse cursor.
SoPointingAction is the base class for any mouse based interaction.
The SoSFMLImage field is the interface used by Inventor Nodes to access image data (in the current im...
Definition: SoSFMLImage.h:70
SoSFMLImage - field interface to ML images and related classes.
Definition: SoSFMLImage.h:32
std::vector< Vector2 > vecPoint2D
Defines a 2D point vector.
This class implements the Marching Squares algorithm to find isolines on 2D image slices.
The CSO represents a contour segmentation object.
Definition: CSO.h:44