ITK  6.0.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  * https://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:
39  enum class DTITubeSpatialObjectPointField : uint8_t
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:
64  ITK_DEFAULT_COPY_AND_MOVE(DTITubeSpatialObjectPoint);
65 
71  using FieldType = std::pair<std::string, float>;
72  using FieldListType = std::vector<FieldType>;
73 
75 #if !defined(ITK_LEGACY_REMOVE)
76 
77  using FieldEnumType = DTITubeSpatialObjectPointFieldEnum;
78  // We need to expose the enum values at the class level
79  // for backwards compatibility
80  static constexpr DTITubeSpatialObjectPointFieldEnum FA = DTITubeSpatialObjectPointFieldEnum::FA;
81  static constexpr DTITubeSpatialObjectPointFieldEnum ADC = DTITubeSpatialObjectPointFieldEnum::ADC;
82  static constexpr DTITubeSpatialObjectPointFieldEnum GA = DTITubeSpatialObjectPointFieldEnum::GA;
83 #endif
84 
88 
90  ~DTITubeSpatialObjectPoint() override = default;
91 
93  void
95  {
96  std::copy(matrix.Begin(), matrix.End(), m_TensorMatrix);
97  }
98 
99  void
101  {
102  std::copy(matrix.Begin(), matrix.End(), m_TensorMatrix);
103  }
104 
105  void
106  SetTensorMatrix(const float * matrix)
107  {
108  for (unsigned int i = 0; i < 6; ++i)
109  {
110  m_TensorMatrix[i] = matrix[i];
111  }
112  }
113 
114  const float *
116  {
117  return m_TensorMatrix;
118  }
119 
121  void
122  AddField(const char * name, float value);
123 
125  void
126  AddField(DTITubeSpatialObjectPointFieldEnum name, float value);
127 
129  void
130  SetField(DTITubeSpatialObjectPointFieldEnum name, float value);
131 
132  void
133  SetField(const char * name, float value);
134 
136  const FieldListType &
137  GetFields() const
138  {
139  return m_Fields;
140  }
141 
143  float
144  GetField(const char * name) const;
145 
146  float
147  GetField(DTITubeSpatialObjectPointFieldEnum name) const;
148 
149 protected:
150  float m_TensorMatrix[6]{};
151  FieldListType m_Fields{};
152 
154  void
155  PrintSelf(std::ostream & os, Indent indent) const override;
156 
158  std::string
159  TranslateEnumToChar(DTITubeSpatialObjectPointFieldEnum name) const;
160 };
161 } // end of namespace itk
162 
163 #ifndef ITK_MANUAL_INSTANTIATION
164 # include "itkDTITubeSpatialObjectPoint.hxx"
165 #endif
166 
167 #endif // itkDTITubeSpatialObjectPoint_h
itk::DTITubeSpatialObjectPoint
Point used for a tube definition.
Definition: itkDTITubeSpatialObjectPoint.h:61
itk::DTITubeSpatialObjectPoint::GetFields
const FieldListType & GetFields() const
Definition: itkDTITubeSpatialObjectPoint.h:137
itk::DTITubeSpatialObjectPoint::FieldType
std::pair< std::string, float > FieldType
Definition: itkDTITubeSpatialObjectPoint.h:71
itk::FixedArray< TComponent, VDimension *(VDimension+1)/2 >::Begin
Iterator Begin()
itkDiffusionTensor3D.h
itk::Vector< double, TPointDimension >
itk::DiffusionTensor3D
Represent a diffusion tensor as used in DTI images.
Definition: itkDiffusionTensor3D.h:79
itk::operator<<
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::DTITubeSpatialObjectPointEnums::DTITubeSpatialObjectPointField::ADC
itk::DTITubeSpatialObjectPointEnums::DTITubeSpatialObjectPointField::GA
itk::CovariantVector< double, TPointDimension >
itk::FixedArray< TComponent, VDimension *(VDimension+1)/2 >::End
Iterator End()
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:94
itk::DTITubeSpatialObjectPoint::GetTensorMatrix
const float * GetTensorMatrix() const
Definition: itkDTITubeSpatialObjectPoint.h:115
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::DTITubeSpatialObjectPoint::SetTensorMatrix
void SetTensorMatrix(const DiffusionTensor3D< float > &matrix)
Definition: itkDTITubeSpatialObjectPoint.h:100
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:72
itk::DTITubeSpatialObjectPointEnums::DTITubeSpatialObjectPointField
DTITubeSpatialObjectPointField
Definition: itkDTITubeSpatialObjectPoint.h:39
itk::DTITubeSpatialObjectPointEnums::DTITubeSpatialObjectPointField::FA
itk::DTITubeSpatialObjectPoint::SetTensorMatrix
void SetTensorMatrix(const float *matrix)
Definition: itkDTITubeSpatialObjectPoint.h:106