ITK  4.8.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 >
49 {};
50 
56 template< typename TInputPixel, typename TLevelSet >
57 class VTKVisualizeImageLevelSetIsoValues< Image< TInputPixel, 2 >, TLevelSet >
59  Image< TInputPixel, 2 >,
60  ImageToVTKImageFilter< Image< TInputPixel, 2 > > >
61 {
62 public:
68 
70  itkNewMacro(Self);
71 
74 
76 
77  typedef TLevelSet LevelSetType;
78 
79  void SetLevelSet( LevelSetType * levelSet );
80 
82  void SetNumberOfLevels( const SizeValueType numLevels );
83  SizeValueType GetNumberOfLevels() const;
85 
88  void SetLevelLimit( double iLimit );
89  double GetLevelLimit() const;
91 
92 #ifdef ITK_USE_CONCEPT_CHECKING
93  itkConceptMacro( Is2Dimensional,
95 #endif
96 
97 protected:
100 
102  virtual void PrepareVTKPipeline();
103 
104 private:
105  VTKVisualizeImageLevelSetIsoValues( const Self& ); // purposely not implemented
106  void operator= ( const Self& ); // purposely not implemented
107 
109  typedef typename LevelSetConverterType::Pointer LevelSetConverterPointer;
110 
112 
113  vtkSmartPointer< vtkMarchingSquares > m_MarchingSquare;
114  vtkSmartPointer< vtkPolyDataMapper > m_ContourMapper;
115  vtkSmartPointer< vtkActor > m_ContourActor;
116  vtkSmartPointer< vtkScalarBarActor > m_ScalarBar;
117  vtkSmartPointer< vtkLookupTable > m_Lut;
118 
121  double m_LevelLimit;
122 };
123 
124 
130 template< typename TInputPixel, typename TLevelSet >
131 class VTKVisualizeImageLevelSetIsoValues< Image< TInputPixel, 3 >, TLevelSet >
132  : public VTKVisualizeImageLevelSet<
133  Image< TInputPixel, 3 >,
134  ImageToVTKImageFilter< Image< TInputPixel, 3 > > >
135 {
136 public:
142 
144  itkNewMacro(Self);
145 
148 
150 
151  typedef TLevelSet LevelSetType;
152 
153  virtual void SetInputImage( const InputImageType * iImage );
154  void SetLevelSet( LevelSetType * levelSet );
155 
157  void SetNumberOfLevels( const SizeValueType numLevels );
158  SizeValueType GetNumberOfLevels() const;
160 
163  void SetLevelLimit( double iLimit );
164  double GetLevelLimit() const;
166 
167 #ifdef ITK_USE_CONCEPT_CHECKING
168  itkConceptMacro( Is3Dimensional,
170 #endif
171 
172 protected:
175 
177  virtual void PrepareVTKPipeline();
178 
179 private:
180  VTKVisualizeImageLevelSetIsoValues( const Self& ); // purposely not implemented
181  void operator= ( const Self& ); // purposely not implemented
182 
184  typedef typename LevelSetConverterType::Pointer LevelSetConverterPointer;
185 
187 
188  vtkSmartPointer< vtkMarchingCubes > m_MarchingCubes;
189  vtkSmartPointer< vtkPolyDataMapper > m_ContourMapper;
190  vtkSmartPointer< vtkActor > m_ContourActor;
191  vtkSmartPointer< vtkScalarBarActor > m_ScalarBar;
192  vtkSmartPointer< vtkLookupTable > m_Lut;
193 
196  double m_LevelLimit;
197 };
198 } // end namespace itk
199 
200 #ifndef ITK_MANUAL_INSTANTIATION
201 #include "itkVTKVisualizeImageLevelSetIsoValues.hxx"
202 #endif
203 
204 #endif
Light weight base class for most itk classes.
VTKVisualizeImageLevelSet< Image< TInputPixel, 3 >, ImageToVTKImageFilter< Image< TInputPixel, 3 > > > Superclass
unsigned long SizeValueType
Definition: itkIntTypes.h:143
SizeValueType IdentifierType
Definition: itkIntTypes.h:147
Converts an ITK image into a VTK image and plugs a itk data pipeline to a VTK datapipeline.
VTKVisualizeImageLevelSet< Image< TInputPixel, 2 >, ImageToVTKImageFilter< Image< TInputPixel, 2 > > > Superclass
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