ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkVTKVisualize2DLevelSetAsElevationMap.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 
19 #ifndef itkVTKVisualize2DLevelSetAsElevationMap_h
20 #define itkVTKVisualize2DLevelSetAsElevationMap_h
21 
23 
25 #include "itkConceptChecking.h"
26 
27 #include "vtkPolyData.h"
28 #include "vtkPolyDataMapper.h"
29 #include "vtkActor.h"
30 #include "vtkScalarBarActor.h"
31 
32 namespace itk
33 {
34 
35 template< typename TInputImage, typename TLevelSet >
36 class ITK_TEMPLATE_EXPORT VTKVisualize2DLevelSetAsElevationMap :
37  public VTKVisualizeImageLevelSet< TInputImage, ImageToVTKImageFilter< TInputImage > >
38 {
39 public:
40  ITK_DISALLOW_COPY_AND_ASSIGN(VTKVisualize2DLevelSetAsElevationMap);
41 
46 
47  itkNewMacro( Self );
48 
50  itkTypeMacro(itkVTKVisualize2DLevelSetAsElevationMap, VTKVisualizeImageLevelSet);
51 
55 
56  using LevelSetType = TLevelSet;
57  using LevelSetPointer = typename LevelSetType::Pointer;
58 
59  void SetLevelSet( LevelSetType * levelSet );
60 
61 #ifdef ITK_USE_CONCEPT_CHECKING
62  itkConceptMacro( Is2Dimensional,
64 #endif
65 
66  /* Set the height scaling for visualization */
67  void SetHeightScaling( const double c )
68  {
69  m_HeightScaling = c;
70  }
71 
72  /* Get the height scaling for visualization */
73  double GetHeightScaling() const
74  {
75  return m_HeightScaling;
76  }
77 
78  /* Get the surface mesh*/
79  vtkPolyData* GetElevationMapMesh() const
80  {
81  return m_Mesh;
82  }
83 
84 protected:
87 
88  void PrepareVTKPipeline() override;
89 
90  void GenerateElevationMap();
91 
92 private:
94 
95  vtkSmartPointer< vtkPolyData > m_Mesh;
96  vtkSmartPointer< vtkScalarBarActor > m_ScalarBarActor;
97  vtkSmartPointer< vtkPolyDataMapper > m_MeshMapper;
98  vtkSmartPointer< vtkActor > m_SurfaceActor;
99 
101 
103  double m_MinValue;
104  double m_MaxValue;
105 
107 
108 };
109 
110 } // end namespace itk
111 
112 #ifndef ITK_MANUAL_INSTANTIATION
113 #include "itkVTKVisualize2DLevelSetAsElevationMap.hxx"
114 #endif
115 
116 #endif // itkVTKVisualize2DLevelSetAsElevationMap_H
Light weight base class for most itk classes.
unsigned long SizeValueType
Definition: itkIntTypes.h:83
typename InputImageType::SizeValueType InputImageSizeValueType
Base class for visualizing level sets defined on an image with VTK.
#define itkConceptMacro(name, concept)