go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elxResamplerBase.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
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 elxResamplerBase_h
19#define elxResamplerBase_h
20
22#include "elxMacro.h"
23
24#include "elxBaseComponentSE.h"
25#include "itkResampleImageFilter.h"
26#include "itkCastImageFilter.h"
27#include "elxProgressCommand.h"
28
29namespace elastix
30{
76template <class TElastix>
77class ITK_TEMPLATE_EXPORT ResamplerBase : public BaseComponentSE<TElastix>
78{
79public:
81
85
88
90 using typename Superclass::ElastixType;
91 using typename Superclass::RegistrationType;
92
95 using InputImageType = typename ElastixType::MovingImageType;
96 using OutputImageType = typename ElastixType::MovingImageType;
97 // typedef typename ElastixType::FixedImageType OutputImageType;
99
101 using ITKBaseType = itk::ResampleImageFilter<InputImageType, OutputImageType, CoordRepType>;
102
104 using TransformType = typename ITKBaseType::TransformType;
105 using InterpolatorType = typename ITKBaseType::InterpolatorType;
106 using SizeType = typename ITKBaseType::SizeType;
107 using IndexType = typename ITKBaseType::IndexType;
108 using SpacingType = typename ITKBaseType::SpacingType;
109 using DirectionType = typename ITKBaseType::DirectionType;
110 using OriginPointType = typename ITKBaseType::OriginPointType;
111 using OutputPixelType = typename ITKBaseType::PixelType;
112
114 using ParameterMapType = typename ElastixType::ParameterMapType;
115
117 itkStaticConstMacro(ImageDimension, unsigned int, OutputImageType::ImageDimension);
118
122 {
123 return &(this->GetSelf());
124 }
125
126
128 const ITKBaseType *
130 {
131 return &(this->GetSelf());
132 }
133
134
138 virtual int
140 {
141 return 0;
142 }
143
150 void
152
156 void
158
162 void
164
168 void
170
172 virtual void
174
176 void
177 WriteToFile(std::ostream & transformationParameterInfo) const;
178
180 void
182
184 void
185 ResampleAndWriteResultImage(const std::string & filename, const bool showProgress);
186
188 virtual void
190
191protected:
193 ResamplerBase() = default;
195 ~ResamplerBase() override = default;
196
198 virtual void
200
201private:
203
204 virtual ParameterMapType
206 {
207 return {};
208 }
209
211 void
212 WriteResultImage(OutputImageType * imageimage, const std::string & filename, const bool showProgress);
213
215 void
217
219 template <typename TResultPixel>
220 itk::SmartPointer<itk::ImageBase<ImageDimension>>
221 CastImage(const InputImageType * const inputImage) const
222 {
223 const auto castFilter =
224 itk::CastImageFilter<InputImageType, itk::Image<TResultPixel, InputImageType::ImageDimension>>::New();
225 castFilter->SetInput(inputImage);
226 castFilter->Update();
227 return castFilter->GetOutput();
228 }
229};
230
231} // end namespace elastix
232
233#ifndef ITK_MANUAL_INSTANTIATION
234# include "elxResamplerBase.hxx"
235#endif
236
237#endif // end #ifndef elxResamplerBase_h
The BaseComponentSE class is a base class for elastix components that provides some basic functionali...
typename ElastixType::RegistrationBaseType RegistrationType
void WriteResultImage(OutputImageType *imageimage, const std::string &filename, const bool showProgress)
typename ITKBaseType::IndexType IndexType
void CreateTransformParameterMap(ParameterMapType &parameterMap) const
typename ITKBaseType::SpacingType SpacingType
~ResamplerBase() override=default
void AfterRegistrationBase() override
typename ElastixType::MovingImageType OutputImageType
void WriteToFile(std::ostream &transformationParameterInfo) const
elxDeclarePureVirtualGetSelfMacro(ITKBaseType)
const ITKBaseType * GetAsITKBaseType() const
typename ElastixType::ParameterMapType ParameterMapType
typename ITKBaseType::TransformType TransformType
typename ITKBaseType::SizeType SizeType
ITKBaseType * GetAsITKBaseType()
void BeforeRegistrationBase() override
typename ITKBaseType::InterpolatorType InterpolatorType
virtual void CreateItkResultImage()
void AfterEachIterationBase() override
itkStaticConstMacro(ImageDimension, unsigned int, OutputImageType::ImageDimension)
virtual ParameterMapType CreateDerivedTransformParameterMap() const
typename ITKBaseType::OriginPointType OriginPointType
typename ITKBaseType::DirectionType DirectionType
ITK_DISALLOW_COPY_AND_MOVE(ResamplerBase)
virtual void SetComponents()
virtual int BeforeAllTransformix()
typename ITKBaseType::PixelType OutputPixelType
void ResampleAndWriteResultImage(const std::string &filename, const bool showProgress)
typename ElastixType::MovingImageType InputImageType
void AfterEachResolutionBase() override
virtual void ReadFromFile()
itk::SmartPointer< itk::ImageBase< ImageDimension > > CastImage(const InputImageType *const inputImage) const
itk::ResampleImageFilter< InputImageType, OutputImageType, CoordRepType > ITKBaseType


Generated on 2024-07-17 for elastix by doxygen 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) elastix logo