Loading...
Searching...
No Matches
itkNDImageBase.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 itkNDImageBase_h
#define itkNDImageBase_h
#include "itkImage.h"
#include "itkArray.h"
#include <string>
#include "itkImageFileWriter.h"
namespace itk
{
template <class TPixel>
class ITK_TEMPLATE_EXPORT NDImageBase : public Object
{
public:
ITK_DISALLOW_COPY_AND_MOVE(NDImageBase);
using Self = NDImageBase;
using Superclass = Object;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;
// itkNewMacro( Self );
// not declared, because instantiating an object of this
// (abstract) type makes no sense.
itkTypeMacro(NDImageBase, Object);
using DataObjectPointer = DataObject::Pointer;
using PixelType = typename Image<TPixel, 2>::PixelType;
using ValueType = typename Image<TPixel, 2>::ValueType;
using InternalPixelType = typename Image<TPixel, 2>::InternalPixelType;
using AccessorType = typename Image<TPixel, 2>::AccessorType;
using PixelContainer = typename Image<TPixel, 2>::PixelContainer;
using PixelContainerPointer = typename Image<TPixel, 2>::PixelContainerPointer;
using PixelContainerConstPointer = typename Image<TPixel, 2>::PixelContainerConstPointer;
using Spacing2DType = typename ImageBase<2>::SpacingType;
using Point2DType = typename ImageBase<2>::PointType;
using SpacingValueType = typename Spacing2DType::ValueType;
using PointValueType = typename Point2DType::ValueType;
using OffsetValueType = typename ImageBase<2>::OffsetValueType;
using IndexType = Array<IndexValueType>;
using SizeType = Array<SizeValueType>;
using SpacingType = Array<SpacingValueType>;
using PointType = Array<PointValueType>;
using OffsetType = Array<OffsetValueType>;
// using typename Superclass::RegionType;
// void SetRegions(RegionType region) = 0;
virtual void
SetRegions(SizeType size) = 0;
virtual void
SetRequestedRegion(DataObject * data) = 0;
virtual void
Allocate() = 0;
virtual void
Initialize() = 0;
virtual void
FillBuffer(const TPixel & value) = 0;
virtual void
SetPixel(const IndexType & index, const TPixel & value) = 0;
virtual const TPixel &
GetPixel(const IndexType & index) const = 0;
virtual TPixel &
GetPixel(const IndexType & index) = 0;
TPixel & operator[](const IndexType & index) { return this->GetPixel(index); }
const TPixel & operator[](const IndexType & index) const { return this->GetPixel(index); }
virtual TPixel *
GetBufferPointer() = 0;
virtual const TPixel *
GetBufferPointer() const = 0;
virtual PixelContainer *
GetPixelContainer() = 0;
virtual const PixelContainer *
GetPixelContainer() const = 0;
virtual void
SetPixelContainer(PixelContainer * container) = 0;
virtual AccessorType
GetPixelAccessor() = 0;
virtual const AccessorType
GetPixelAccessor() const = 0;
virtual void
SetSpacing(const SpacingType & spacing) = 0;
virtual void
SetOrigin(const PointType & origin) = 0;
/* Get Spacing/Origin return copies; not a const &, like
* itkImage; necessary because of the conversion to arrays */
virtual SpacingType
GetSpacing() = 0;
virtual PointType
GetOrigin() = 0;
virtual void
CopyInformation(const DataObject * data) = 0;
virtual const OffsetValueType *
GetOffsetTable() const = 0;
virtual OffsetValueType
ComputeOffset(const IndexType & ind) const = 0;
virtual IndexType
ComputeIndex(OffsetValueType offset) const = 0;
virtual unsigned int
ImageDimension() = 0;
virtual unsigned int
GetImageDimension() = 0;
virtual void
SetImageIOWriter(ImageIOBase * _arg) = 0;
virtual ImageIOBase *
GetImageIOWriter() = 0;
virtual void
SetImageIOReader(ImageIOBase * _arg) = 0;
virtual ImageIOBase *
GetImageIOReader() = 0;
virtual void
Write() = 0;
virtual void
Read() = 0;
virtual void
CreateNewImage() = 0;
virtual void
SetOutputFileName(const char *) = 0;
virtual void
SetInputFileName(const char *) = 0;
virtual const char *
GetOutputFileName() = 0;
virtual const char *
GetInputFileName() = 0;
static Pointer
NewNDImage(unsigned int dim);
protected:
NDImageBase() = default;
~NDImageBase() override = default;
// virtual void PrintSelf(std::ostream& os, Indent indent) const = 0;
};
} // end namespace itk
#include "itkNDImageTemplate.h"
namespace itk
{
template <class TPixel>
auto
NDImageBase<TPixel>::NewNDImage(unsigned int dim) -> Pointer
{
switch (dim)
{
case 1:
return dynamic_cast<NDImageBase<TPixel> *>(NDImageTemplate<TPixel, 1>::New().GetPointer());
case 2:
return dynamic_cast<NDImageBase<TPixel> *>(NDImageTemplate<TPixel, 2>::New().GetPointer());
case 3:
return dynamic_cast<NDImageBase<TPixel> *>(NDImageTemplate<TPixel, 3>::New().GetPointer());
case 4:
return dynamic_cast<NDImageBase<TPixel> *>(NDImageTemplate<TPixel, 4>::New().GetPointer());
case 5:
return dynamic_cast<NDImageBase<TPixel> *>(NDImageTemplate<TPixel, 5>::New().GetPointer());
// add here more dimensions if needed...
// we could do this also with a recursive
// template and a #define MAXDIM,
// or something like that....
default:
// Return a default-constructed SmartPointer (null).
return typename NDImageBase<TPixel>::Pointer();
}
}
} // end namespace itk
#endif // end #ifndef itkNDImageBase_h
ImageIOBase
itk::NDImageBase::Initialize
virtual void Initialize()=0
itk::NDImageBase::SpacingValueType
typename Spacing2DType::ValueType SpacingValueType
Definition itkNDImageBase.h:91
itk::NDImageBase::Allocate
virtual void Allocate()=0
itk::NDImageBase::GetBufferPointer
virtual const TPixel * GetBufferPointer() const =0
itk::NDImageBase::IndexType
Array< IndexValueType > IndexType
Definition itkNDImageBase.h:100
itk::NDImageBase::SizeType
Array< SizeValueType > SizeType
Definition itkNDImageBase.h:101
itk::NDImageBase::SetSpacing
virtual void SetSpacing(const SpacingType &spacing)=0
itk::NDImageBase::operator[]
const TPixel & operator[](const IndexType &index) const
Definition itkNDImageBase.h:145
itk::NDImageBase::NewNDImage
static Pointer NewNDImage(unsigned int dim)
Definition itkNDImageBase.h:261
itk::NDImageBase::CreateNewImage
virtual void CreateNewImage()=0
itk::NDImageBase::FillBuffer
virtual void FillBuffer(const TPixel &value)=0
itk::NDImageBase::Read
virtual void Read()=0
itk::NDImageBase::OffsetValueType
typename ImageBase< 2 >::OffsetValueType OffsetValueType
Definition itkNDImageBase.h:93
itk::NDImageBase::SetImageIOWriter
virtual void SetImageIOWriter(ImageIOBase *_arg)=0
itk::NDImageBase::PixelContainer
typename Image< TPixel, 2 >::PixelContainer PixelContainer
Definition itkNDImageBase.h:84
itk::NDImageBase::GetPixel
virtual TPixel & GetPixel(const IndexType &index)=0
itk::NDImageBase::CopyInformation
virtual void CopyInformation(const DataObject *data)=0
itk::NDImageBase::GetPixel
virtual const TPixel & GetPixel(const IndexType &index) const =0
itk::NDImageBase::ConstPointer
SmartPointer< const Self > ConstPointer
Definition itkNDImageBase.h:67
itk::NDImageBase::~NDImageBase
~NDImageBase() override=default
itk::NDImageBase::Superclass
Object Superclass
Definition itkNDImageBase.h:65
itk::NDImageBase::ImageDimension
virtual unsigned int ImageDimension()=0
itk::NDImageBase::ComputeOffset
virtual OffsetValueType ComputeOffset(const IndexType &ind) const =0
itk::NDImageBase::Point2DType
typename ImageBase< 2 >::PointType Point2DType
Definition itkNDImageBase.h:89
itk::NDImageBase::OffsetType
Array< OffsetValueType > OffsetType
Definition itkNDImageBase.h:104
itk::NDImageBase::SetInputFileName
virtual void SetInputFileName(const char *)=0
itk::NDImageBase::SetRequestedRegion
virtual void SetRequestedRegion(DataObject *data)=0
itk::NDImageBase::GetOffsetTable
virtual const OffsetValueType * GetOffsetTable() const =0
itk::NDImageBase::PointType
Array< PointValueType > PointType
Definition itkNDImageBase.h:103
itk::NDImageBase::SetPixelContainer
virtual void SetPixelContainer(PixelContainer *container)=0
itk::NDImageBase::Self
NDImageBase Self
Definition itkNDImageBase.h:64
itk::NDImageBase::ComputeIndex
virtual IndexType ComputeIndex(OffsetValueType offset) const =0
itk::NDImageBase::PixelContainerConstPointer
typename Image< TPixel, 2 >::PixelContainerConstPointer PixelContainerConstPointer
Definition itkNDImageBase.h:86
itk::NDImageBase::GetOrigin
virtual PointType GetOrigin()=0
itk::NDImageBase::GetPixelAccessor
virtual const AccessorType GetPixelAccessor() const =0
itk::NDImageBase::GetSpacing
virtual SpacingType GetSpacing()=0
itk::NDImageBase::SetImageIOReader
virtual void SetImageIOReader(ImageIOBase *_arg)=0
itk::NDImageBase::GetPixelContainer
virtual PixelContainer * GetPixelContainer()=0
itk::NDImageBase::GetImageDimension
virtual unsigned int GetImageDimension()=0
itk::NDImageBase::GetOutputFileName
virtual const char * GetOutputFileName()=0
itk::NDImageBase::Spacing2DType
typename ImageBase< 2 >::SpacingType Spacing2DType
Definition itkNDImageBase.h:88
itk::NDImageBase::SpacingType
Array< SpacingValueType > SpacingType
Definition itkNDImageBase.h:102
itk::NDImageBase::AccessorType
typename Image< TPixel, 2 >::AccessorType AccessorType
Definition itkNDImageBase.h:83
itk::NDImageBase::GetBufferPointer
virtual TPixel * GetBufferPointer()=0
itk::NDImageBase::SetOutputFileName
virtual void SetOutputFileName(const char *)=0
itk::NDImageBase::ITK_DISALLOW_COPY_AND_MOVE
ITK_DISALLOW_COPY_AND_MOVE(NDImageBase)
itk::NDImageBase::GetImageIOReader
virtual ImageIOBase * GetImageIOReader()=0
itk::NDImageBase::NDImageBase
NDImageBase()=default
itk::NDImageBase::InternalPixelType
typename Image< TPixel, 2 >::InternalPixelType InternalPixelType
Definition itkNDImageBase.h:82
itk::NDImageBase::PointValueType
typename Point2DType::ValueType PointValueType
Definition itkNDImageBase.h:92
itk::NDImageBase::Pointer
SmartPointer< Self > Pointer
Definition itkNDImageBase.h:66
itk::NDImageBase::SetPixel
virtual void SetPixel(const IndexType &index, const TPixel &value)=0
itk::NDImageBase::GetImageIOWriter
virtual ImageIOBase * GetImageIOWriter()=0
itk::NDImageBase::GetPixelAccessor
virtual AccessorType GetPixelAccessor()=0
itk::NDImageBase::operator[]
TPixel & operator[](const IndexType &index)
Definition itkNDImageBase.h:144
itk::NDImageBase::GetPixelContainer
virtual const PixelContainer * GetPixelContainer() const =0
itk::NDImageBase::ValueType
typename Image< TPixel, 2 >::ValueType ValueType
Definition itkNDImageBase.h:81
itk::NDImageBase::DataObjectPointer
DataObject::Pointer DataObjectPointer
Definition itkNDImageBase.h:77
itk::NDImageBase::SetRegions
virtual void SetRegions(SizeType size)=0
itk::NDImageBase::SetOrigin
virtual void SetOrigin(const PointType &origin)=0
itk::NDImageBase::GetInputFileName
virtual const char * GetInputFileName()=0
itk::NDImageBase::Write
virtual void Write()=0
itk::NDImageBase::PixelContainerPointer
typename Image< TPixel, 2 >::PixelContainerPointer PixelContainerPointer
Definition itkNDImageBase.h:85
itk::NDImageTemplate::New
static Pointer New()
itkNDImageTemplate.h
itk
Definition itkAdvancedImageToImageMetric.h:43

Generated on 1768596610 for elastix by 1.15.0 |