go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkElastixRegistrationMethod.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/*=========================================================================
19 *
20 * Copyright UMC Utrecht and contributors
21 *
22 * Licensed under the Apache License, Version 2.0 (the "License");
23 * you may not use this file except in compliance with the License.
24 * You may obtain a copy of the License at
25 *
26 * http://www.apache.org/licenses/LICENSE-2.0.txt
27 *
28 * Unless required by applicable law or agreed to in writing, software
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
33 *
34 *=========================================================================*/
35#ifndef itkElastixRegistrationMethod_h
36#define itkElastixRegistrationMethod_h
37
38#include "itkImageSource.h"
39
40#include "elxElastixMain.h"
41#include "elxElastixTemplate.h"
42#include "elxTransformBase.h"
43#include "elxParameterObject.h"
44
52namespace itk
53{
54
55template <typename TFixedImage, typename TMovingImage>
56class ITK_TEMPLATE_EXPORT ElastixRegistrationMethod : public itk::ImageSource<TFixedImage>
57{
58public:
60
63 using Superclass = ImageSource<TFixedImage>;
64 using Pointer = SmartPointer<Self>;
65 using ConstPointer = SmartPointer<const Self>;
66
68 itkNewMacro(Self);
69
71 itkTypeMacro(ElastixRegistrationMethod, ImageSource);
72
76 using ElastixMainVectorType = std::vector<ElastixMainPointer>;
79 using ArgumentMapEntryType = ArgumentMapType::value_type;
81
84 using DataObjectContainerIterator = DataObjectContainerType::Iterator;
85 using DataObjectIdentifierType = ProcessObject::DataObjectIdentifierType;
86 using DataObjectPointerArraySizeType = ProcessObject::DataObjectPointerArraySizeType;
87 using NameArrayType = ProcessObject::NameArray;
88
95
96 static constexpr unsigned int FixedImageDimension = TFixedImage::ImageDimension;
97 static constexpr unsigned int MovingImageDimension = TMovingImage::ImageDimension;
98
101 using TransformType = Transform<double, FixedImageDimension, MovingImageDimension>;
102
103 using FixedImageType = TFixedImage;
104 using MovingImageType = TMovingImage;
106
108 virtual void
109 SetFixedImage(TFixedImage * fixedImage);
110 virtual void
111 AddFixedImage(TFixedImage * fixedImage);
112 const FixedImageType *
114 const FixedImageType *
115 GetFixedImage(const unsigned int index) const;
116 unsigned int
118
120 virtual void
121 SetMovingImage(TMovingImage * movingImages);
122 virtual void
123 AddMovingImage(TMovingImage * movingImage);
124 const MovingImageType *
126 const MovingImageType *
127 GetMovingImage(const unsigned int index) const;
128 unsigned int
130
132 virtual void
134 virtual void
136 const FixedMaskType *
138 const FixedMaskType *
139 GetFixedMask(const unsigned int index) const;
140 void
142 unsigned int
144
146 virtual void
148 virtual void
150 const MovingMaskType *
152 const MovingMaskType *
153 GetMovingMask(const unsigned int index) const;
154 virtual void
156 unsigned int
158
160 virtual void
164 const ParameterObjectType *
166
170 const ParameterObjectType *
172 using Superclass::GetOutput;
173 DataObject *
174 GetOutput(unsigned int idx);
175 const DataObject *
176 GetOutput(unsigned int idx) const;
179
180 /* \note When "WriteResultImage" is false, the output image will be empty. */
181 const ResultImageType *
182 GetOutput() const;
183
184 /* Standard filter indexed input / output methods */
185 void
187 const FixedImageType *
188 GetInput() const;
189 void
190 SetInput(DataObjectPointerArraySizeType index, DataObject * input);
191 const DataObject *
193
195 itkSetMacro(InitialTransformParameterFileName, std::string);
196 itkGetConstMacro(InitialTransformParameterFileName, std::string);
197 virtual void
199 {
200 this->SetInitialTransformParameterFileName("");
201 }
202
204 itkSetMacro(FixedPointSetFileName, std::string);
205 itkGetConstMacro(FixedPointSetFileName, std::string);
206 void
208 {
209 this->SetFixedPointSetFileName("");
210 }
211
213 itkSetMacro(MovingPointSetFileName, std::string);
214 itkGetConstMacro(MovingPointSetFileName, std::string);
215 void
217 {
218 this->SetMovingPointSetFileName("");
219 }
220
222 itkSetMacro(OutputDirectory, std::string);
223 itkGetConstMacro(OutputDirectory, std::string);
224 void
226 {
227 this->SetOutputDirectory("");
228 }
229
231 void
232 SetLogFileName(const std::string logFileName);
233
234 itkGetConstMacro(LogFileName, std::string);
235 void
237
239 itkSetMacro(LogToConsole, bool);
240 itkGetConstReferenceMacro(LogToConsole, bool);
241 itkBooleanMacro(LogToConsole);
242
244 itkSetMacro(LogToFile, bool);
245 itkGetConstReferenceMacro(LogToFile, bool);
246 itkBooleanMacro(LogToFile);
247
249 void
251 {
252 m_EnableOutput = false;
253 }
254
255 itkSetMacro(NumberOfThreads, int);
256 itkGetConstMacro(NumberOfThreads, int);
257
259 unsigned int
261
263 SmartPointer<TransformType>
264 GetNthTransform(const unsigned int n) const;
265
267 SmartPointer<TransformType>
269
272 static SmartPointer<TransformType>
274
275protected:
277
278 void
279 GenerateData() override;
280
281 using DataObjectPointer = ProcessObject::DataObjectPointer;
282 using Superclass::MakeOutput;
285
286private:
288 std::string
290
292 bool
293 IsInputOfType(const DataObjectIdentifierType & InputOfType, const DataObjectIdentifierType & inputName) const;
294
296 unsigned int
298
300 void
302
304 using Superclass::SetInput;
305
307
308 SmartPointer<const elx::ElastixMain> m_ElastixMain{ nullptr };
309
310 std::string m_InitialTransformParameterFileName{};
311 std::string m_FixedPointSetFileName{};
312 std::string m_MovingPointSetFileName{};
313
314 std::string m_OutputDirectory{};
315 std::string m_LogFileName{};
316
317 bool m_EnableOutput{ true };
318 bool m_LogToConsole{ false };
319 bool m_LogToFile{ false };
320
321 int m_NumberOfThreads{ 0 };
322
323 unsigned int m_InputUID{ 0 };
324};
325
326} // namespace itk
327
328#ifndef ITK_MANUAL_INSTANTIATION
329# include "itkElastixRegistrationMethod.hxx"
330#endif
331
332#endif // itkElastixRegistrationMethod_h
A class with all functionality to configure elastix.
ElastixBase::FlatDirectionCosinesType FlatDirectionCosinesType
itk::SmartPointer< Self > Pointer
Configuration::CommandLineArgumentMapType ArgumentMapType
ElastixBase::DataObjectContainerType DataObjectContainerType
ElastixBase::DataObjectContainerPointer DataObjectContainerPointer
itk::Object::Pointer ObjectPointer
itk::SmartPointer< Self > Pointer
std::map< ParameterKeyType, ParameterValueVectorType > ParameterMapType
itk::SmartPointer< const Self > ConstPointer
std::vector< ParameterValueType > ParameterValueVectorType
std::vector< ParameterMapType > ParameterMapVectorType
This class is the elastix base class for all Transforms.
virtual void AddFixedImage(TFixedImage *fixedImage)
unsigned int GetNumberOfFixedImages() const
unsigned int GetNumberOfMovingImages() const
Transform< double, FixedImageDimension, MovingImageDimension > TransformType
const ResultImageType * GetOutput() const
std::vector< ElastixMainPointer > ElastixMainVectorType
const FixedImageType * GetFixedImage() const
unsigned int GetNumberOfMovingMasks() const
ParameterObjectType::ParameterMapType ParameterMapType
void SetLogFileName(const std::string logFileName)
void SetInput(DataObjectPointerArraySizeType index, DataObject *input)
ParameterObjectType::ConstPointer ParameterObjectConstPointer
const MovingMaskType * GetMovingMask() const
virtual void SetFixedMask(FixedMaskType *fixedMask)
void RemoveInputsOfType(const DataObjectIdentifierType &inputName)
DataObjectContainerType::Iterator DataObjectContainerIterator
DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override
ParameterObjectType::Pointer ParameterObjectPointer
ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
ParameterObjectType::ParameterMapVectorType ParameterMapVectorType
ArgumentMapType::value_type ArgumentMapEntryType
ResultImageType * GetOutput()
ParameterObjectType::ParameterValueVectorType ParameterValueVectorType
const FixedMaskType * GetFixedMask() const
ElastixMainType::DataObjectContainerType DataObjectContainerType
unsigned int GetNumberOfFixedMasks() const
unsigned int GetNumberOfTransforms() const
virtual void AddMovingMask(MovingMaskType *movingMask)
ProcessObject::DataObjectIdentifierType DataObjectIdentifierType
SmartPointer< TransformType > GetNthTransform(const unsigned int n) const
virtual void SetParameterObject(ParameterObjectType *parameterObject)
virtual void SetMovingMask(MovingMaskType *movingMask)
const ParameterObjectType * GetTransformParameterObject() const
const MovingImageType * GetMovingImage() const
virtual void SetFixedImage(TFixedImage *fixedImage)
static SmartPointer< TransformType > ConvertToItkTransform(const TransformType &)
virtual void AddFixedMask(FixedMaskType *fixedMask)
void SetInput(FixedImageType *fixedImage)
std::string MakeUniqueName(const DataObjectIdentifierType &key)
virtual void AddMovingImage(TMovingImage *movingImage)
const DataObject * GetInput(DataObjectPointerArraySizeType index) const
const FixedImageType * GetFixedImage(const unsigned int index) const
bool IsInputOfType(const DataObjectIdentifierType &InputOfType, const DataObjectIdentifierType &inputName) const
const DataObject * GetOutput(unsigned int idx) const
virtual void SetMovingImage(TMovingImage *movingImages)
const MovingMaskType * GetMovingMask(const unsigned int index) const
const FixedImageType * GetInput() const
ProcessObject::DataObjectPointer DataObjectPointer
SmartPointer< TransformType > GetCombinationTransform() const
const FixedMaskType * GetFixedMask(const unsigned int index) const
ParameterObjectType * GetTransformParameterObject()
const ParameterObjectType * GetParameterObject() const
ElastixMainType::ObjectPointer ElastixMainObjectPointer
ElastixMainType::FlatDirectionCosinesType FlatDirectionCosinesType
ElastixMainType::DataObjectContainerPointer DataObjectContainerPointer
DataObject * GetOutput(unsigned int idx)
ParameterObjectType * GetParameterObject()
ElastixMainType::ArgumentMapType ArgumentMapType
const MovingImageType * GetMovingImage(const unsigned int index) const
ITK_DISALLOW_COPY_AND_MOVE(ElastixRegistrationMethod)
unsigned int GetNumberOfInputsOfType(const DataObjectIdentifierType &intputType) const


Generated on 2023-01-13 for elastix by doxygen 1.9.6 elastix logo