DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
itkMeshFromPeaksImageFilter.h
Go to the documentation of this file.
1 
11 #ifndef __itkMeshFromPeaksImageFilter_h
12 #define __itkMeshFromPeaksImageFilter_h
13 
14 
15 #include "itkPoint.h"
16 #include "itkPointSet.h"
17 
18 #include "vtkPoints.h"
19 #include "vtkPolyData.h"
20 #include "vtkCellArray.h"
21 #include "vtkPolyDataWriter.h"
22 #include "vtkDoubleArray.h"
23 #include "vtkUnsignedCharArray.h"
24 #include "vtkPointData.h"
25 #include "vtkCellData.h"
26 #include "vtkTypeTraits.h"
27 #include "vtkType.h"
28 
29 #include "utlITKMacro.h"
30 #include "utlCoreMacro.h"
32 #include "itkPeakContainerHelper.h"
33 
34 namespace itk
35 {
36 
44 template < class TInputImage, class TOutputMesh=vtkPolyData >
45 class ITK_EXPORT MeshFromPeaksImageFilter :
46  public MeshFromImageImageFilter<TInputImage, TOutputMesh>
47 {
48 public:
51  typedef SmartPointer<Self> Pointer;
52  typedef SmartPointer<const Self> ConstPointer;
53 
55  itkNewMacro(Self);
56 
58  itkTypeMacro( MeshFromPeaksImageFilter, MeshSource );
59 
60  //** Convenient typedefs */
61  typedef TInputImage InputImageType;
62  typedef typename InputImageType::Pointer InputImagePointer;
63  typedef typename InputImageType::ConstPointer InputImageConstPointer;
64  typedef typename InputImageType::IndexType InputImageIndexType;
65  typedef typename InputImageType::SizeType InputImageSizeType;
66  typedef typename InputImageType::SizeValueType InputImageSizeValueType;
67  typedef typename InputImageType::SpacingType InputImageSpacingType;
68  typedef typename InputImageType::PixelType InputImagePixelType;
69  typedef typename InputImageType::RegionType InputImageRegionType;
70  typedef typename InputImageType::PointType InputImagePointType;
71 
72 
73  typedef TOutputMesh OutputMeshPolyDataType;
74 
75  typedef typename Superclass::OutputMeshPointsType OutputMeshPointsType;
76  typedef typename Superclass::OutputMeshCellArrayType OutputMeshCellArrayType;
77  typedef typename Superclass::OutputMeshPolyDataPointer OutputMeshPolyDataPointer;
78  typedef typename Superclass::OutputMeshScalarType OutputMeshScalarType;
79  typedef typename Superclass::OutputMeshRGBType OutputMeshRGBType;
80 
84  typedef utl_shared_ptr<MatrixType> MatrixPointer;
85  typedef utl_shared_ptr<VectorType> VectorPointer;
86  typedef std::vector<double> STDVectorType;
87  typedef utl_shared_ptr<STDVectorType > STDVectorPointer;
88 
90  itkSetGetMacro(TubeRadius, double);
91  itkSetGetMacro(MaxNumberOfPeaks, int);
92 
93  void SetColorPeak(double r, double g, double b)
94  {
95  m_ColorPeak[0]=r, m_ColorPeak[1]=g, m_ColorPeak[2]=b;
96  }
97 
98 
99 protected:
102  { };
103 
105  {
106  utlSAException(this->m_ColorScheme!=Superclass::FIXED && this->m_ColorScheme!=Superclass::DIRECTION)
107  (this->m_ColorScheme).msg("wrong m_ColorScheme");
108  }
109 
110  typename LightObject::Pointer InternalClone() const ITK_OVERRIDE;
111 
112  void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE
113  {
114  std::string peaktypeStr = PeakContainerHelper::GetString(m_PeakType);
115  PrintVar(true, os<<indent, peaktypeStr, m_TubeRadius, m_MaxNumberOfPeaks);
116  PrintVar(true, os<<indent, m_ColorPeak[0], m_ColorPeak[1], m_ColorPeak[2]);
117  }
118 
119  virtual void GenerateData() ITK_OVERRIDE;
120 
122 
124  double m_TubeRadius;
125 
126  double m_ColorPeak[3];
127 
130 
131 private:
132  MeshFromPeaksImageFilter(const Self&); //purposely not implemented
133  void operator=(const Self&);//purposely not implemented
134 
135 };
136 
137 } // end namespace itk
138 
139 // Define instantiation macro for this template.
140 #define ITK_TEMPLATE_MeshFromPeaksImageFilter(_, EXPORT, x, y) namespace itk { \
141  _(2(class EXPORT MeshFromPeaksImageFilter< ITK_TEMPLATE_2 x >)) \
142  namespace Templates { typedef MeshFromPeaksImageFilter< ITK_TEMPLATE_2 x > MeshFromPeaksImageFilter##y; } \
143  }
144 
145 #if ITK_TEMPLATE_EXPLICIT
146 # include "Templates/itkMeshFromPeaksImageFilter+-.h"
147 #endif
148 
149 #if !defined(ITK_MANUAL_INSTANTIATION) && !defined(__itkMeshFromPeaksImageFilter_hxx)
151 #endif
152 
153 #endif
InputImageType::IndexType InputImageIndexType
Superclass::OutputMeshScalarType OutputMeshScalarType
InputImageType::SizeType InputImageSizeType
utl_shared_ptr< VectorType > VectorPointer
InputImageType::PointType InputImagePointType
Superclass::OutputMeshPointsType OutputMeshPointsType
Superclass::OutputMeshRGBType OutputMeshRGBType
MeshFromImageImageFilter< TInputImage, TOutputMesh > Superclass
Generate a mesh from given peaks.
InputImageType::SpacingType InputImageSpacingType
void SetColorPeak(double r, double g, double b)
Superclass::OutputMeshPolyDataPointer OutputMeshPolyDataPointer
#define ITK_OVERRIDE
Definition: utlITKMacro.h:46
Compute mesh from SH coefficients.
Superclass::OutputMeshCellArrayType OutputMeshCellArrayType
InputImageType::ConstPointer InputImageConstPointer
static std::string GetString(const PeakType peakType)
InputImageType::SizeValueType InputImageSizeValueType
utl_shared_ptr< STDVectorType > STDVectorPointer
#define PrintVar(cond, os,...)
Definition: utlCoreMacro.h:242
InputImageType::PixelType InputImagePixelType
#define utlSAException(expr)
Definition: utlCoreMacro.h:543
void VerifyInputParameters() const ITK_OVERRIDE
#define itkSetGetMacro(name, type)
Definition: utlITKMacro.h:134
SmartPointer< const Self > ConstPointer
void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
utl_shared_ptr< MatrixType > MatrixPointer
Created "08-26-2016.
macros for utlCore
InputImageType::RegionType InputImageRegionType