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
118
120 itkStaticConstMacro(ImageDimension, unsigned int, OutputImageType::ImageDimension);
121
125 {
126 return &(this->GetSelf());
127 }
128
129
131 const ITKBaseType *
133 {
134 return &(this->GetSelf());
135 }
136
137
141 virtual int
143 {
144 return 0;
145 }
146
153 void
155
159 void
161
165 void
167
171 void
173
175 virtual void
177
179 void
180 WriteToFile(xl::xoutsimple & transformationParameterInfo) const;
181
183 void
185
187 void
188 ResampleAndWriteResultImage(const char * filename, const bool showProgress = true);
189
191 void
192 WriteResultImage(OutputImageType * imageimage, const char * filename, const bool showProgress = true);
193
195 virtual void
197
198protected:
200 ResamplerBase() = default;
202 ~ResamplerBase() override = default;
203
205 virtual void
207
209 bool m_ShowProgress{ true };
210
211private:
213
214 virtual ParameterMapType
216 {
217 return {};
218 }
219
221 void
223
225 template <typename TResultPixel>
226 itk::SmartPointer<itk::ImageBase<ImageDimension>>
227 CastImage(const InputImageType * const inputImage) const
228 {
229 const auto castFilter =
230 itk::CastImageFilter<InputImageType, itk::Image<TResultPixel, InputImageType::ImageDimension>>::New();
231 castFilter->SetInput(inputImage);
232 castFilter->Update();
233 return castFilter->GetOutput();
234 }
235};
236
237} // end namespace elastix
238
239#ifndef ITK_MANUAL_INSTANTIATION
240# include "elxResamplerBase.hxx"
241#endif
242
243#endif // end #ifndef elxResamplerBase_h
The BaseComponentSE class is a base class for elastix components that provides some basic functionali...
typename ElastixType::RegistrationBaseType RegistrationType
A specialized Command object for updating the progress of a filter.
void WriteResultImage(OutputImageType *imageimage, const char *filename, const bool showProgress=true)
typename ITKBaseType::IndexType IndexType
typename ITKBaseType::SpacingType SpacingType
~ResamplerBase() override=default
void AfterRegistrationBase() override
typename ElastixType::MovingImageType OutputImageType
virtual ParameterMapType CreateDerivedTransformParametersMap() const
elxDeclarePureVirtualGetSelfMacro(ITKBaseType)
const ITKBaseType * GetAsITKBaseType() const
typename ElastixType::ParameterMapType ParameterMapType
typename ITKBaseType::TransformType TransformType
typename ITKBaseType::SizeType SizeType
ITKBaseType * GetAsITKBaseType()
void BeforeRegistrationBase() override
void CreateTransformParametersMap(ParameterMapType &parameterMap) const
typename ITKBaseType::InterpolatorType InterpolatorType
virtual void CreateItkResultImage()
void AfterEachIterationBase() override
itkStaticConstMacro(ImageDimension, unsigned int, OutputImageType::ImageDimension)
typename ITKBaseType::OriginPointType OriginPointType
typename ITKBaseType::DirectionType DirectionType
ITK_DISALLOW_COPY_AND_MOVE(ResamplerBase)
virtual void SetComponents()
virtual int BeforeAllTransformix()
void WriteToFile(xl::xoutsimple &transformationParameterInfo) const
void ResampleAndWriteResultImage(const char *filename, const bool showProgress=true)
typename ITKBaseType::PixelType OutputPixelType
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
xout class with only basic functionality.
Definition: xoutsimple.h:36


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