ITK  5.2.0
Insight Toolkit
itkDTITubeSpatialObjectPoint.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 itkDTITubeSpatialObjectPoint_h
19 #define itkDTITubeSpatialObjectPoint_h
20 
22 #include "itkDiffusionTensor3D.h"
23 #include "vnl/vnl_vector_fixed.h"
24 
25 namespace itk
26 {
32 {
33 public:
40  {
41  FA = 0,
42  ADC = 1,
43  GA = 2
44  };
45 };
46 // Define how to print enumeration
47 extern ITKSpatialObjects_EXPORT std::ostream &
49 
60 template <unsigned int TPointDimension = 3>
61 class ITK_TEMPLATE_EXPORT DTITubeSpatialObjectPoint : public TubeSpatialObjectPoint<TPointDimension>
62 {
63 public:
69  using FieldType = std::pair<std::string, float>;
70  using FieldListType = std::vector<FieldType>;
71 
73 #if !defined(ITK_LEGACY_REMOVE)
74 
75  using FieldEnumType = DTITubeSpatialObjectPointFieldEnum;
76  // We need to expose the enum values at the class level
77  // for backwards compatibility
78  static constexpr DTITubeSpatialObjectPointFieldEnum FA = DTITubeSpatialObjectPointFieldEnum::FA;
79  static constexpr DTITubeSpatialObjectPointFieldEnum ADC = DTITubeSpatialObjectPointFieldEnum::ADC;
80  static constexpr DTITubeSpatialObjectPointFieldEnum GA = DTITubeSpatialObjectPointFieldEnum::GA;
81 #endif
82 
86 
89 
91  ~DTITubeSpatialObjectPoint() override = default;
92 
94  void
96  {
97  std::copy(matrix.Begin(), matrix.End(), m_TensorMatrix);
98  }
99 
100  void
102  {
103  std::copy(matrix.Begin(), matrix.End(), m_TensorMatrix);
104  }
105 
106  void
107  SetTensorMatrix(const float * matrix)
108  {
109  for (unsigned int i = 0; i < 6; i++)
110  {
111  m_TensorMatrix[i] = matrix[i];
112  }
113  }
114 
115  const float *
117  {
118  return m_TensorMatrix;
119  }
120 
122  Self &
123  operator=(const DTITubeSpatialObjectPoint & rhs);
124 
126  void
127  AddField(const char * name, float value);
128 
130  void
131  AddField(DTITubeSpatialObjectPointFieldEnum name, float value);
132 
134  void
135  SetField(DTITubeSpatialObjectPointFieldEnum name, float value);
136 
137  void
138  SetField(const char * name, float value);
139 
141  const FieldListType &
142  GetFields() const
143  {
144  return m_Fields;
145  }
146 
148  float
149  GetField(const char * name) const;
150 
151  float
152  GetField(DTITubeSpatialObjectPointFieldEnum name) const;
153 
154 protected:
155  float m_TensorMatrix[6];
157 
159  void
160  PrintSelf(std::ostream & os, Indent indent) const override;
161 
163  std::string
164  TranslateEnumToChar(DTITubeSpatialObjectPointFieldEnum name) const;
165 };
166 } // end of namespace itk
167 
168 #ifndef ITK_MANUAL_INSTANTIATION
169 # include "itkDTITubeSpatialObjectPoint.hxx"
170 #endif
171 
172 #endif // itkDTITubeSpatialObjectPoint_h
itk::DTITubeSpatialObjectPoint
Point used for a tube definition.
Definition: itkDTITubeSpatialObjectPoint.h:61
itk::uint8_t
::uint8_t uint8_t
Definition: itkIntTypes.h:29
itk::DTITubeSpatialObjectPoint::GetFields
const FieldListType & GetFields() const
Definition: itkDTITubeSpatialObjectPoint.h:142
itk::operator<<
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
Definition: itkArray.h:218
itk::DTITubeSpatialObjectPoint::FieldType
std::pair< std::string, float > FieldType
Definition: itkDTITubeSpatialObjectPoint.h:69
itk::FixedArray< TComponent, NDimension *(NDimension+1)/2 >::Begin
Iterator Begin()
itkDiffusionTensor3D.h
itk::Vector< double, TPointDimension >
itk::DTITubeSpatialObjectPoint::m_Fields
FieldListType m_Fields
Definition: itkDTITubeSpatialObjectPoint.h:156
itk::DiffusionTensor3D
Represent a diffusion tensor as used in DTI images.
Definition: itkDiffusionTensor3D.h:79
itk::DTITubeSpatialObjectPointEnums::DTITubeSpatialObjectPointField::FA
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::DTITubeSpatialObjectPointEnums::DTITubeSpatialObjectPointField::ADC
itk::CovariantVector< double, TPointDimension >
DTITubeSpatialObjectPointField
itk::FixedArray< TComponent, NDimension *(NDimension+1)/2 >::End
Iterator End()
itk::DTITubeSpatialObjectPointEnums::DTITubeSpatialObjectPointField
DTITubeSpatialObjectPointField
Definition: itkDTITubeSpatialObjectPoint.h:39
itk::DTITubeSpatialObjectPointEnums
Contains all enum classes used by DTITubeSpatialObjectPoint class.
Definition: itkDTITubeSpatialObjectPoint.h:31
itk::DTITubeSpatialObjectPoint::SetTensorMatrix
void SetTensorMatrix(const DiffusionTensor3D< double > &matrix)
Definition: itkDTITubeSpatialObjectPoint.h:95
itk::DTITubeSpatialObjectPoint::GetTensorMatrix
const float * GetTensorMatrix() const
Definition: itkDTITubeSpatialObjectPoint.h:116
itk::DTITubeSpatialObjectPointEnums::DTITubeSpatialObjectPointField::GA
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::DTITubeSpatialObjectPoint::SetTensorMatrix
void SetTensorMatrix(const DiffusionTensor3D< float > &matrix)
Definition: itkDTITubeSpatialObjectPoint.h:101
itkTubeSpatialObjectPoint.h
itk::Point< double, TPointDimension >
itk::TubeSpatialObjectPoint
Point used for a tube definition.
Definition: itkTubeSpatialObjectPoint.h:39
itk::DTITubeSpatialObjectPoint::FieldListType
std::vector< FieldType > FieldListType
Definition: itkDTITubeSpatialObjectPoint.h:70
itk::DTITubeSpatialObjectPoint::SetTensorMatrix
void SetTensorMatrix(const float *matrix)
Definition: itkDTITubeSpatialObjectPoint.h:107