ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkVTKVisualizeImageLevelSetIsoValues.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 #ifndef itkVTKVisualizeImageLevelSetIsoValues_h
19 #define itkVTKVisualizeImageLevelSetIsoValues_h
20 
22 
23 #include "itkConceptChecking.h"
26 
27 #include "vtkImageData.h"
28 #include "vtkLookupTable.h"
29 #include "vtkMarchingSquares.h"
30 #include "vtkMarchingCubes.h"
31 #include "vtkPolyDataMapper.h"
32 #include "vtkActor.h"
33 #include "vtkScalarBarActor.h"
34 #include "vtkProperty.h"
35 #include "vtkRenderWindowInteractor.h"
36 
37 namespace itk
38 {
47 template< typename TImage, typename TLevelSet >
48 class ITK_TEMPLATE_EXPORT VTKVisualizeImageLevelSetIsoValues
49 {};
50 
56 template< typename TInputPixel, typename TLevelSet >
57 class ITK_TEMPLATE_EXPORT VTKVisualizeImageLevelSetIsoValues< Image< TInputPixel, 2 >, TLevelSet >
59  Image< TInputPixel, 2 >,
60  ImageToVTKImageFilter< Image< TInputPixel, 2 > > >
61 {
62 public:
63  ITK_DISALLOW_COPY_AND_ASSIGN(VTKVisualizeImageLevelSetIsoValues);
64 
70 
72  itkNewMacro(Self);
73 
76 
78 
79  using LevelSetType = TLevelSet;
80 
81  void SetLevelSet( LevelSetType * levelSet );
82 
84  void SetNumberOfLevels( const SizeValueType numLevels );
85  SizeValueType GetNumberOfLevels() const;
87 
90  void SetLevelLimit( double iLimit );
91  double GetLevelLimit() const;
93 
94 #ifdef ITK_USE_CONCEPT_CHECKING
95  itkConceptMacro( Is2Dimensional,
97 #endif
98 
99 protected:
102 
104  void PrepareVTKPipeline() override;
105 
106 private:
108  using LevelSetConverterPointer = typename LevelSetConverterType::Pointer;
109 
111 
112  vtkSmartPointer< vtkMarchingSquares > m_MarchingSquare;
113  vtkSmartPointer< vtkPolyDataMapper > m_ContourMapper;
114  vtkSmartPointer< vtkActor > m_ContourActor;
115  vtkSmartPointer< vtkScalarBarActor > m_ScalarBar;
116  vtkSmartPointer< vtkLookupTable > m_Lut;
117 
120  double m_LevelLimit;
121 };
122 
123 
129 template< typename TInputPixel, typename TLevelSet >
130 class ITK_TEMPLATE_EXPORT VTKVisualizeImageLevelSetIsoValues< Image< TInputPixel, 3 >, TLevelSet >
131  : public VTKVisualizeImageLevelSet<
132  Image< TInputPixel, 3 >,
133  ImageToVTKImageFilter< Image< TInputPixel, 3 > > >
134 {
135 public:
136  ITK_DISALLOW_COPY_AND_ASSIGN(VTKVisualizeImageLevelSetIsoValues);
137 
143 
145  itkNewMacro(Self);
146 
149 
151 
152  using LevelSetType = TLevelSet;
153 
154  void SetInputImage( const InputImageType * iImage ) override;
155  void SetLevelSet( LevelSetType * levelSet );
156 
158  void SetNumberOfLevels( const SizeValueType numLevels );
159  SizeValueType GetNumberOfLevels() const;
161 
164  void SetLevelLimit( double iLimit );
165  double GetLevelLimit() const;
167 
168 #ifdef ITK_USE_CONCEPT_CHECKING
169  itkConceptMacro( Is3Dimensional,
171 #endif
172 
173 protected:
176 
178  void PrepareVTKPipeline() override;
179 
180 private:
182  using LevelSetConverterPointer = typename LevelSetConverterType::Pointer;
183 
185 
186  vtkSmartPointer< vtkMarchingCubes > m_MarchingCubes;
187  vtkSmartPointer< vtkPolyDataMapper > m_ContourMapper;
188  vtkSmartPointer< vtkActor > m_ContourActor;
189  vtkSmartPointer< vtkScalarBarActor > m_ScalarBar;
190  vtkSmartPointer< vtkLookupTable > m_Lut;
191 
194  double m_LevelLimit;
195 };
196 } // end namespace itk
197 
198 #ifndef ITK_MANUAL_INSTANTIATION
199 #include "itkVTKVisualizeImageLevelSetIsoValues.hxx"
200 #endif
201 
202 #endif
Light weight base class for most itk classes.
unsigned long SizeValueType
Definition: itkIntTypes.h:83
SizeValueType IdentifierType
Definition: itkIntTypes.h:87
Converts an ITK image into a VTK image and plugs a itk data pipeline to a VTK datapipeline.
Base class for visualizing level sets defined on an image with VTK.
#define itkConceptMacro(name, concept)
Templated n-dimensional image class.
Definition: itkImage.h:75