Slicer  5.2
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkCurveMeasurementsCalculator.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Portions (c) Copyright Brigham and Women's Hospital (BWH) All Rights Reserved.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16 ==============================================================================*/
17 
18 #ifndef __vtkCurveMeasurementsCalculator_h
19 #define __vtkCurveMeasurementsCalculator_h
20 
21 // VTK includes
22 #include <vtkCollection.h>
23 #include <vtkPolyData.h>
24 #include <vtkPolyDataAlgorithm.h>
25 #include <vtkSetGet.h>
26 #include <vtkWeakPointer.h>
27 
28 // Export
29 #include "vtkSlicerMarkupsModuleMRMLExport.h"
30 
31 class vtkCallbackCommand;
32 
34 class VTK_SLICER_MARKUPS_MODULE_MRML_EXPORT vtkCurveMeasurementsCalculator : public vtkPolyDataAlgorithm
35 {
36 public:
37  vtkTypeMacro(vtkCurveMeasurementsCalculator, vtkPolyDataAlgorithm);
38  static vtkCurveMeasurementsCalculator* New();
39 
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
43  void SetMeasurements(vtkCollection* measurements);
46  vtkCollection* GetMeasurements();
48 
50  vtkSetMacro(CurveIsClosed, bool);
53  vtkGetMacro(CurveIsClosed, bool);
54  vtkBooleanMacro(CurveIsClosed, bool);
56 
58  vtkSetMacro(CalculateCurvature, bool);
60  vtkGetMacro(CalculateCurvature, bool);
61  vtkBooleanMacro(CalculateCurvature, bool);
63 
65  static const char* GetMeanCurvatureName() { return "curvature mean"; };
67  static const char* GetMaxCurvatureName() { return "curvature max"; };
68 
69  vtkMTimeType GetMTime() override;
70 
71  vtkGetMacro(CurvatureUnits, std::string);
72  vtkSetMacro(CurvatureUnits, std::string);
73 
78  static bool InterpolateArray(vtkDoubleArray* inputValues, vtkDoubleArray* interpolatedValues,
79  vtkDoubleArray* pedigreeIdsArray, double pedigreeIdsValueScale=1.0);
80 
81 protected:
82  bool CalculatePolyDataCurvature(vtkPolyData* polyData);
83  bool InterpolateControlPointMeasurementToPolyData(vtkPolyData* outputPolyData);
84 
87  static void OnControlPointArrayModified(vtkObject* caller, unsigned long eid, void* clientData, void* callData);
88 
89 protected:
91  vtkWeakPointer<vtkCollection> Measurements;
92 
94  bool CurveIsClosed{false};
95 
97  bool CalculateCurvature{false};
98 
103 
104  std::string CurvatureUnits;
105 
106 protected:
107  int FillInputPortInformation(int port, vtkInformation* info) override;
108  int RequestData(vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector) override;
109 
110 protected:
112  ~vtkCurveMeasurementsCalculator() override;
114  void operator=(const vtkCurveMeasurementsCalculator&) = delete;
115 };
116 
117 #endif
static const char * GetMaxCurvatureName()
Get name of max curvature measurement.
Filter that generates curves between points of an input polydata.
static const char * GetMeanCurvatureName()
Get name of mean curvature measurement.
vtkCallbackCommand * ControlPointArrayModifiedCallbackCommand
Command handling data array modified events.
vtkWeakPointer< vtkCollection > Measurements
Measurement list from the markups node for derived measurements (such as interpolation) ...
vtkCollection * ObservedControlPointArrays
List of observed control point arrays (for removal of observations)