164 template <
typename TImageType>
166 :
Image(image.GetPointer())
169 template <
typename TImageType>
174 const unsigned int dimension = TImageType::ImageDimension;
176 static_assert(type !=
sitkUnknown,
"invalid pixel type");
177 static_assert(dimension >= 2 && dimension <=
SITK_MAX_DIMENSION,
"Unsupported image dimension.");
364 std::vector<unsigned int>
400 std::vector<std::string>
520 std::vector<uint16_t>
524 std::vector<uint32_t>
528 std::vector<uint64_t>
711 template <
class TImageType>
719 template <
class TImageType>
724 template <
class TImageType>
743 Image(std::unique_ptr<PimpleImageBase> pimpleImage);
746 template <
typename TImageType>
void SetDirection(const std::vector< double > &direction)
Set/Get the Direction.
PimpleImageBase * DispatchedInternalInitialization(itk::DataObject *image)
unsigned int GetDepth() const
std::vector< int64_t > GetPixelAsVectorInt64(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
std::vector< int16_t > GetPixelAsVectorInt16(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
const double * GetBufferAsDouble() const
Get a pointer to the image buffer.
Image(std::unique_ptr< PimpleImageBase > pimpleImage)
Image(TImageType *image)
Construct an SimpleITK Image from an pointer to an ITK image.
Image(unsigned int width, unsigned int height, PixelIDValueEnum valueEnum)
Constructors for 2D, 3D an optionally 4D images where pixel type and number of components can be spec...
int64_t * GetBufferAsInt64()
Get a pointer to the image buffer.
void SetMetaData(const std::string &key, const std::string &value)
Set an entry in the meta-data dictionary.
std::complex< double > GetPixelAsComplexFloat64(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
Image ToScalarInternal(bool inPlace)
Internal methods for converting images between vectors and scalars.
Image(itk::SmartPointer< TImageType > image)
Construct an SimpleITK Image from an pointer to an ITK image.
void SetSpacing(const std::vector< double > &spacing)
uint32_t * GetBufferAsUInt32()
Get a pointer to the image buffer.
void SetPixelAsDouble(const std::vector< uint32_t > &idx, double v)
Set the value of a pixel.
void Allocate(const std::vector< unsigned int > &size, PixelIDValueEnum valueEnum, unsigned int numberOfComponents)
Methods called by the constructor to allocate and initialize an image.
void SetPixelAsVectorUInt8(const std::vector< uint32_t > &idx, const std::vector< uint8_t > &v)
Set the value of a pixel.
void SetPixelAsVectorInt16(const std::vector< uint32_t > &idx, const std::vector< int16_t > &v)
Set the value of a pixel.
std::vector< float > GetPixelAsVectorFloat32(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
const uint8_t * GetBufferAsUInt8() const
Get a pointer to the image buffer.
bool HasMetaDataKey(const std::string &key) const
Query the meta-data dictionary for the existence of a key.
std::vector< double > EvaluateAtContinuousIndex(const std::vector< double > &index, InterpolatorEnum interp=sitkLinear) const
Interpolate pixel value at a continuous index.
PixelIDValueType GetPixelIDValue() const
void SetPixelAsInt64(const std::vector< uint32_t > &idx, int64_t v)
Set the value of a pixel.
Image ProxyForInPlaceOperation()
Advanced method not commonly needed.
Image()
Default constructor, creates an image of size 0.
unsigned int GetDimension() const
std::string GetMetaData(const std::string &key) const
Get the value of a meta-data dictionary entry as a string.
std::string ToString() const
std::vector< std::string > GetMetaDataKeys() const
get a vector of keys in from the meta-data dictionary
void SetPixelAsUInt16(const std::vector< uint32_t > &idx, uint16_t v)
Set the value of a pixel.
bool IsSameImageGeometryAs(const Image &otherImage, double=DefaultImageCoordinateTolerance, double=DefaultImageDirectionTolerance) const
Image & operator=(const Image &img)
uint32_t GetPixelAsUInt32(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
const int64_t * GetBufferAsInt64() const
Get a pointer to the image buffer.
uint64_t GetNumberOfPixels() const
Get the number of pixels in the image.
void SetPixelAsUInt32(const std::vector< uint32_t > &idx, uint32_t v)
Set the value of a pixel.
std::unique_ptr< PimpleImageBase > m_PimpleImage
const itk::DataObject * GetITKBase() const
friend struct ToVectorAddressor
void SetPixelAsInt32(const std::vector< uint32_t > &idx, int32_t v)
Set the value of a pixel.
itk::DataObject * GetITKBase()
uint64_t * GetBufferAsUInt64()
Get a pointer to the image buffer.
void SetPixelAsUInt64(const std::vector< uint32_t > &idx, uint64_t v)
Set the value of a pixel.
Image(unsigned int width, unsigned int height, unsigned int depth, PixelIDValueEnum valueEnum)
Constructors for 2D, 3D an optionally 4D images where pixel type and number of components can be spec...
std::vector< double > GetOrigin() const
static constexpr double DefaultImageCoordinateTolerance
std::vector< double > TransformContinuousIndexToPhysicalPoint(const std::vector< double > &index) const
Image ToScalarImage(bool inPlace=true)
Convert a image of vector pixel type to a scalar image with N+1 dimensions.
std::vector< double > GetSpacing() const
bool IsCongruentImageGeometry(const Image &otherImage, double coordinateTolerance, double directionTolerance) const
const int8_t * GetBufferAsInt8() const
Get a pointer to the image buffer.
int16_t * GetBufferAsInt16()
Get a pointer to the image buffer.
float GetPixelAsFloat(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
std::vector< int32_t > GetPixelAsVectorInt32(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
void SetPixelAsInt16(const std::vector< uint32_t > &idx, int16_t v)
Set the value of a pixel.
PixelIDValueEnum GetPixelID() const
std::vector< double > GetDirection() const
Set/Get the Direction.
uint16_t GetPixelAsUInt16(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
int32_t * GetBufferAsInt32()
Get a pointer to the image buffer.
void SetPixelAsVectorUInt16(const std::vector< uint32_t > &idx, const std::vector< uint16_t > &v)
Set the value of a pixel.
void * GetBufferAsVoid()
Get a pointer to the image buffer.
void SetPixelAsVectorFloat32(const std::vector< uint32_t > &idx, const std::vector< float > &v)
Set the value of a pixel.
Image ToVectorInternal(bool inPlace)
Internal methods for converting images between vectors and scalars.
std::vector< double > TransformIndexToPhysicalPoint(const std::vector< int64_t > &index) const
unsigned int GetHeight() const
void SetPixelAsVectorInt8(const std::vector< uint32_t > &idx, const std::vector< int8_t > &v)
Set the value of a pixel.
void InternalInitialization(PixelIDValueType type, unsigned int dimension, itk::DataObject *image)
uint16_t * GetBufferAsUInt16()
Get a pointer to the image buffer.
void SetPixelAsInt8(const std::vector< uint32_t > &idx, int8_t v)
Set the value of a pixel.
void SetPixelAsVectorInt32(const std::vector< uint32_t > &idx, const std::vector< int32_t > &v)
Set the value of a pixel.
std::vector< int8_t > GetPixelAsVectorInt8(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
std::vector< int64_t > TransformPhysicalPointToIndex(const std::vector< double > &point) const
double GetPixelAsDouble(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
void SetOrigin(const std::vector< double > &origin)
uint8_t * GetBufferAsUInt8()
Get a pointer to the image buffer.
uint8_t GetPixelAsUInt8(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
void AllocateInternal(const std::vector< unsigned int > &size, unsigned int numberOfComponents)
Allocates images of different types.
friend struct ToScalarAddressor
static constexpr double DefaultImageDirectionTolerance
std::vector< double > EvaluateAtPhysicalPoint(const std::vector< double > &point, InterpolatorEnum interp=sitkLinear) const
int8_t * GetBufferAsInt8()
Get a pointer to the image buffer.
const int16_t * GetBufferAsInt16() const
Get a pointer to the image buffer.
friend struct DispatchedInternalInitialiationAddressor
std::vector< double > GetPixelAsVectorFloat64(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
const void * GetBufferAsVoid() const
Get a pointer to the image buffer.
std::vector< uint32_t > GetPixelAsVectorUInt32(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
const int32_t * GetBufferAsInt32() const
Get a pointer to the image buffer.
friend struct AllocateMemberFunctionAddressor
int16_t GetPixelAsInt16(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
void MakeUnique()
Performs actually coping if needed to make object unique.
void SetPixelAsVectorInt64(const std::vector< uint32_t > &idx, const std::vector< int64_t > &v)
Set the value of a pixel.
double * GetBufferAsDouble()
Get a pointer to the image buffer.
const float * GetBufferAsFloat() const
Get a pointer to the image buffer.
unsigned int GetNumberOfComponentsPerPixel() const
Get the number of components for each pixel.
int32_t GetPixelAsInt32(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
Image & operator=(Image &&img) noexcept
void SetPixelAsUInt8(const std::vector< uint32_t > &idx, uint8_t v)
Set the value of a pixel.
const uint64_t * GetBufferAsUInt64() const
Get a pointer to the image buffer.
std::vector< uint8_t > GetPixelAsVectorUInt8(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
int8_t GetPixelAsInt8(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
std::string GetPixelIDTypeAsString() const
const uint16_t * GetBufferAsUInt16() const
Get a pointer to the image buffer.
Image ToVectorImage(bool inPlace=true)
Convert the first dimension to the components for image with vector pixel type.
float * GetBufferAsFloat()
Get a pointer to the image buffer.
void SetPixelAsComplexFloat64(const std::vector< uint32_t > &idx, const std::complex< double > v)
Set the value of a pixel.
std::complex< float > GetPixelAsComplexFloat32(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
std::vector< unsigned int > GetSize() const
void SetPixelAsVectorFloat64(const std::vector< uint32_t > &idx, const std::vector< double > &v)
Set the value of a pixel.
int64_t GetPixelAsInt64(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
void SetPixelAsFloat(const std::vector< uint32_t > &idx, float v)
Set the value of a pixel.
std::vector< uint16_t > GetPixelAsVectorUInt16(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
void SetPixelAsVectorUInt32(const std::vector< uint32_t > &idx, const std::vector< uint32_t > &v)
Set the value of a pixel.
const uint32_t * GetBufferAsUInt32() const
Get a pointer to the image buffer.
bool IsUnique() const
Returns true if no other SimpleITK Image object refers to the same internal data structure.
void SetPixelAsVectorUInt64(const std::vector< uint32_t > &idx, const std::vector< uint64_t > &v)
Set the value of a pixel.
uint64_t GetPixelAsUInt64(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
std::vector< double > TransformPhysicalPointToContinuousIndex(const std::vector< double > &point) const
unsigned int GetSizeOfPixelComponent() const
Get the number of bytes per component of a pixel.
bool EraseMetaData(const std::string &key)
Remove an entry from the meta-data dictionary.
unsigned int GetWidth() const
Image(Image &&img) noexcept
Move constructor and assignment.
void CopyInformation(const Image &srcImage)
Copy common meta-data from an image to this one.
void SetPixelAsComplexFloat32(const std::vector< uint32_t > &idx, const std::complex< float > v)
Set the value of a pixel.
std::vector< uint64_t > GetPixelAsVectorUInt64(const std::vector< uint32_t > &idx) const
Get the value of a pixel.
Image(const std::vector< unsigned int > &size, PixelIDValueEnum valueEnum, unsigned int numberOfComponents=0)
Constructors for 2D, 3D an optionally 4D images where pixel type and number of components can be spec...
Private implementation idiom image base class.
@ sitkLinear
N-D linear interpolation.
PixelIDValueEnum
Enumerated values of pixelIDs.
*par Constraints *The filter image with at least two dimensions and a vector *length of at least The theory supports extension to scalar but *the implementation of the itk vector classes do not **The template parameter TRealType must be floating point(float or double) or *a user-defined "real" numerical type with arithmetic operations defined *sufficient to compute derivatives. **\par Performance *This filter will automatically multithread if run with *SetUsePrincipleComponents
#define SITKCommon_EXPORT