Loading...
Searching...
No Matches
elxResamplerBase.h
Go to the documentation of this file.
/*=========================================================================
*
* Copyright UMC Utrecht and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef elxResamplerBase_h
#define elxResamplerBase_h
#include "elxMacro.h"
#include "elxBaseComponentSE.h"
#include "itkResampleImageFilter.h"
#include "itkCastImageFilter.h"
#include "elxProgressCommand.h"
namespace elastix
{
template <class TElastix>
class ITK_TEMPLATE_EXPORT ResamplerBase : public BaseComponentSE<TElastix>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(ResamplerBase);
using Self = ResamplerBase;
using Superclass = BaseComponentSE<TElastix>;
itkTypeMacro(ResamplerBase, BaseComponentSE);
using typename Superclass::ElastixType;
using typename Superclass::RegistrationType;
using InputImageType = typename ElastixType::MovingImageType;
using OutputImageType = typename ElastixType::MovingImageType;
// typedef typename ElastixType::FixedImageType OutputImageType;
using CoordRepType = ElastixBase::CoordRepType;
using ITKBaseType = itk::ResampleImageFilter<InputImageType, OutputImageType, CoordRepType>;
using TransformType = typename ITKBaseType::TransformType;
using InterpolatorType = typename ITKBaseType::InterpolatorType;
using SizeType = typename ITKBaseType::SizeType;
using IndexType = typename ITKBaseType::IndexType;
using SpacingType = typename ITKBaseType::SpacingType;
using DirectionType = typename ITKBaseType::DirectionType;
using OriginPointType = typename ITKBaseType::OriginPointType;
using OutputPixelType = typename ITKBaseType::PixelType;
using ParameterMapType = typename ElastixType::ParameterMapType;
itkStaticConstMacro(ImageDimension, unsigned int, OutputImageType::ImageDimension);
ITKBaseType *
GetAsITKBaseType()
{
return &(this->GetSelf());
}
const ITKBaseType *
GetAsITKBaseType() const
{
return &(this->GetSelf());
}
virtual int
BeforeAllTransformix()
{
return 0;
}
void
BeforeRegistrationBase() override;
void
AfterEachResolutionBase() override;
void
AfterEachIterationBase() override;
void
AfterRegistrationBase() override;
virtual void
ReadFromFile();
void
WriteToFile(std::ostream & transformationParameterInfo) const;
void
CreateTransformParameterMap(ParameterMapType & parameterMap) const;
void
ResampleAndWriteResultImage(const std::string & filename, const bool showProgress);
virtual void
CreateItkResultImage();
protected:
ResamplerBase() = default;
~ResamplerBase() override = default;
virtual void
SetComponents();
private:
elxDeclarePureVirtualGetSelfMacro(ITKBaseType);
virtual ParameterMapType
CreateDerivedTransformParameterMap() const
{
return {};
}
void
WriteResultImage(OutputImageType * imageimage, const std::string & filename, const bool showProgress);
void
ReleaseMemory();
template <typename TResultPixel>
itk::SmartPointer<itk::ImageBase<ImageDimension>>
CastImage(const InputImageType * const inputImage) const
{
const auto castFilter =
itk::CastImageFilter<InputImageType, itk::Image<TResultPixel, InputImageType::ImageDimension>>::New();
castFilter->SetInput(inputImage);
castFilter->Update();
return castFilter->GetOutput();
}
};
} // end namespace elastix
#ifndef ITK_MANUAL_INSTANTIATION
# include "elxResamplerBase.hxx"
#endif
#endif // end #ifndef elxResamplerBase_h
elastix::BaseComponentSE::BaseComponentSE
BaseComponentSE()=default
elastix::BaseComponentSE::RegistrationType
typename ElastixType::RegistrationBaseType RegistrationType
Definition elxBaseComponentSE.h:62
elastix::BaseComponentSE::ElastixType
TElastix ElastixType
Definition elxBaseComponentSE.h:57
elastix::BaseComponentSE::GetSelf
virtual const itk::Object & GetSelf() const =0
elastix::ElastixBase::CoordRepType
double CoordRepType
Definition elxElastixBase.h:173
elastix::ResamplerBase::WriteResultImage
void WriteResultImage(OutputImageType *imageimage, const std::string &filename, const bool showProgress)
elastix::ResamplerBase::IndexType
typename ITKBaseType::IndexType IndexType
Definition elxResamplerBase.h:107
elastix::ResamplerBase::CreateTransformParameterMap
void CreateTransformParameterMap(ParameterMapType &parameterMap) const
elastix::ResamplerBase::SpacingType
typename ITKBaseType::SpacingType SpacingType
Definition elxResamplerBase.h:108
elastix::ResamplerBase::~ResamplerBase
~ResamplerBase() override=default
elastix::ResamplerBase::AfterRegistrationBase
void AfterRegistrationBase() override
elastix::ResamplerBase::OutputImageType
typename ElastixType::MovingImageType OutputImageType
Definition elxResamplerBase.h:96
elastix::ResamplerBase::WriteToFile
void WriteToFile(std::ostream &transformationParameterInfo) const
elastix::ResamplerBase::Superclass
BaseComponentSE< TElastix > Superclass
Definition elxResamplerBase.h:84
elastix::ResamplerBase::elxDeclarePureVirtualGetSelfMacro
elxDeclarePureVirtualGetSelfMacro(ITKBaseType)
elastix::ResamplerBase::GetAsITKBaseType
const ITKBaseType * GetAsITKBaseType() const
Definition elxResamplerBase.h:129
elastix::ResamplerBase::ParameterMapType
typename ElastixType::ParameterMapType ParameterMapType
Definition elxResamplerBase.h:114
elastix::ResamplerBase::ResamplerBase
ResamplerBase()=default
elastix::ResamplerBase::TransformType
typename ITKBaseType::TransformType TransformType
Definition elxResamplerBase.h:104
elastix::ResamplerBase::Self
ResamplerBase Self
Definition elxResamplerBase.h:83
elastix::ResamplerBase::CoordRepType
ElastixBase::CoordRepType CoordRepType
Definition elxResamplerBase.h:98
elastix::ResamplerBase::SizeType
typename ITKBaseType::SizeType SizeType
Definition elxResamplerBase.h:106
elastix::ResamplerBase::GetAsITKBaseType
ITKBaseType * GetAsITKBaseType()
Definition elxResamplerBase.h:121
elastix::ResamplerBase::BeforeRegistrationBase
void BeforeRegistrationBase() override
elastix::ResamplerBase::InterpolatorType
typename ITKBaseType::InterpolatorType InterpolatorType
Definition elxResamplerBase.h:105
elastix::ResamplerBase::CreateItkResultImage
virtual void CreateItkResultImage()
elastix::ResamplerBase::AfterEachIterationBase
void AfterEachIterationBase() override
elastix::ResamplerBase::itkStaticConstMacro
itkStaticConstMacro(ImageDimension, unsigned int, OutputImageType::ImageDimension)
elastix::ResamplerBase::CreateDerivedTransformParameterMap
virtual ParameterMapType CreateDerivedTransformParameterMap() const
Definition elxResamplerBase.h:205
elastix::ResamplerBase::OriginPointType
typename ITKBaseType::OriginPointType OriginPointType
Definition elxResamplerBase.h:110
elastix::ResamplerBase::DirectionType
typename ITKBaseType::DirectionType DirectionType
Definition elxResamplerBase.h:109
elastix::ResamplerBase::ITK_DISALLOW_COPY_AND_MOVE
ITK_DISALLOW_COPY_AND_MOVE(ResamplerBase)
elastix::ResamplerBase::SetComponents
virtual void SetComponents()
elastix::ResamplerBase::BeforeAllTransformix
virtual int BeforeAllTransformix()
Definition elxResamplerBase.h:139
elastix::ResamplerBase::OutputPixelType
typename ITKBaseType::PixelType OutputPixelType
Definition elxResamplerBase.h:111
elastix::ResamplerBase::ResampleAndWriteResultImage
void ResampleAndWriteResultImage(const std::string &filename, const bool showProgress)
elastix::ResamplerBase::InputImageType
typename ElastixType::MovingImageType InputImageType
Definition elxResamplerBase.h:95
elastix::ResamplerBase::AfterEachResolutionBase
void AfterEachResolutionBase() override
elastix::ResamplerBase::ReadFromFile
virtual void ReadFromFile()
elastix::ResamplerBase::CastImage
itk::SmartPointer< itk::ImageBase< ImageDimension > > CastImage(const InputImageType *const inputImage) const
Definition elxResamplerBase.h:221
elastix::ResamplerBase::ITKBaseType
itk::ResampleImageFilter< InputImageType, OutputImageType, CoordRepType > ITKBaseType
Definition elxResamplerBase.h:101
elastix::ResamplerBase::ReleaseMemory
void ReleaseMemory()
elxBaseComponentSE.h
elxMacro.h
elxProgressCommand.h
elastix
Definition elxDefaultConstruct.h:25

Generated on 1768596610 for elastix by 1.15.0 |