29 #include <type_traits>
47 class PimpleImageBase;
90 operator=(
const Image & img);
101 operator=(
Image && img) noexcept;
123 ProxyForInPlaceOperation();
144 Image(
const std::vector<unsigned int> & size,
PixelIDValueEnum valueEnum,
unsigned int numberOfComponents = 0);
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.");
179 this->InternalInitialization(type, dimension, image);
212 GetPixelIDValue()
const;
216 GetPixelIDTypeAsString()
const;
226 GetDimension()
const;
235 GetNumberOfComponentsPerPixel()
const;
246 GetNumberOfPixels()
const;
253 GetSizeOfPixelComponent()
const;
261 SetOrigin(
const std::vector<double> & origin);
273 SetSpacing(
const std::vector<double> & spacing);
284 GetDirection()
const;
286 SetDirection(
const std::vector<double> & direction);
291 TransformIndexToPhysicalPoint(
const std::vector<int64_t> & index)
const;
295 TransformPhysicalPointToIndex(
const std::vector<double> &
point)
const;
299 TransformPhysicalPointToContinuousIndex(
const std::vector<double> &
point)
const;
303 TransformContinuousIndexToPhysicalPoint(
const std::vector<double> & index)
const;
347 IsCongruentImageGeometry(
const Image & otherImage,
double coordinateTolerance,
double directionTolerance)
const;
357 IsSameImageGeometryAs(
const Image & otherImage,
364 std::vector<unsigned int>
392 CopyInformation(
const Image & srcImage);
400 std::vector<std::string>
401 GetMetaDataKeys()
const;
406 HasMetaDataKey(
const std::string & key)
const;
417 GetMetaData(
const std::string & key)
const;
424 SetMetaData(
const std::string & key,
const std::string & value);
432 EraseMetaData(
const std::string & key);
455 ToVectorImage(
bool inPlace =
true);
476 ToScalarImage(
bool inPlace =
true);
494 GetPixelAsInt8(
const std::vector<uint32_t> & idx)
const;
496 GetPixelAsUInt8(
const std::vector<uint32_t> & idx)
const;
498 GetPixelAsInt16(
const std::vector<uint32_t> & idx)
const;
500 GetPixelAsUInt16(
const std::vector<uint32_t> & idx)
const;
502 GetPixelAsInt32(
const std::vector<uint32_t> & idx)
const;
504 GetPixelAsUInt32(
const std::vector<uint32_t> & idx)
const;
506 GetPixelAsInt64(
const std::vector<uint32_t> & idx)
const;
508 GetPixelAsUInt64(
const std::vector<uint32_t> & idx)
const;
510 GetPixelAsFloat(
const std::vector<uint32_t> & idx)
const;
512 GetPixelAsDouble(
const std::vector<uint32_t> & idx)
const;
515 GetPixelAsVectorInt8(
const std::vector<uint32_t> & idx)
const;
517 GetPixelAsVectorUInt8(
const std::vector<uint32_t> & idx)
const;
519 GetPixelAsVectorInt16(
const std::vector<uint32_t> & idx)
const;
520 std::vector<uint16_t>
521 GetPixelAsVectorUInt16(
const std::vector<uint32_t> & idx)
const;
523 GetPixelAsVectorInt32(
const std::vector<uint32_t> & idx)
const;
524 std::vector<uint32_t>
525 GetPixelAsVectorUInt32(
const std::vector<uint32_t> & idx)
const;
527 GetPixelAsVectorInt64(
const std::vector<uint32_t> & idx)
const;
528 std::vector<uint64_t>
529 GetPixelAsVectorUInt64(
const std::vector<uint32_t> & idx)
const;
531 GetPixelAsVectorFloat32(
const std::vector<uint32_t> & idx)
const;
533 GetPixelAsVectorFloat64(
const std::vector<uint32_t> & idx)
const;
536 GetPixelAsComplexFloat32(
const std::vector<uint32_t> & idx)
const;
538 GetPixelAsComplexFloat64(
const std::vector<uint32_t> & idx)
const;
558 SetPixelAsInt8(
const std::vector<uint32_t> & idx, int8_t v);
560 SetPixelAsUInt8(
const std::vector<uint32_t> & idx, uint8_t v);
562 SetPixelAsInt16(
const std::vector<uint32_t> & idx, int16_t v);
564 SetPixelAsUInt16(
const std::vector<uint32_t> & idx, uint16_t v);
566 SetPixelAsInt32(
const std::vector<uint32_t> & idx, int32_t v);
568 SetPixelAsUInt32(
const std::vector<uint32_t> & idx, uint32_t v);
570 SetPixelAsInt64(
const std::vector<uint32_t> & idx, int64_t v);
572 SetPixelAsUInt64(
const std::vector<uint32_t> & idx, uint64_t v);
574 SetPixelAsFloat(
const std::vector<uint32_t> & idx,
float v);
576 SetPixelAsDouble(
const std::vector<uint32_t> & idx,
double v);
579 SetPixelAsVectorInt8(
const std::vector<uint32_t> & idx,
const std::vector<int8_t> & v);
581 SetPixelAsVectorUInt8(
const std::vector<uint32_t> & idx,
const std::vector<uint8_t> & v);
583 SetPixelAsVectorInt16(
const std::vector<uint32_t> & idx,
const std::vector<int16_t> & v);
585 SetPixelAsVectorUInt16(
const std::vector<uint32_t> & idx,
const std::vector<uint16_t> & v);
587 SetPixelAsVectorInt32(
const std::vector<uint32_t> & idx,
const std::vector<int32_t> & v);
589 SetPixelAsVectorUInt32(
const std::vector<uint32_t> & idx,
const std::vector<uint32_t> & v);
591 SetPixelAsVectorInt64(
const std::vector<uint32_t> & idx,
const std::vector<int64_t> & v);
593 SetPixelAsVectorUInt64(
const std::vector<uint32_t> & idx,
const std::vector<uint64_t> & v);
595 SetPixelAsVectorFloat32(
const std::vector<uint32_t> & idx,
const std::vector<float> & v);
597 SetPixelAsVectorFloat64(
const std::vector<uint32_t> & idx,
const std::vector<double> & v);
600 SetPixelAsComplexFloat32(
const std::vector<uint32_t> & idx,
const std::complex<float> v);
602 SetPixelAsComplexFloat64(
const std::vector<uint32_t> & idx,
const std::complex<double> v);
656 GetBufferAsInt8()
const;
658 GetBufferAsUInt8()
const;
660 GetBufferAsInt16()
const;
662 GetBufferAsUInt16()
const;
664 GetBufferAsInt32()
const;
666 GetBufferAsUInt32()
const;
668 GetBufferAsInt64()
const;
670 GetBufferAsUInt64()
const;
672 GetBufferAsFloat()
const;
674 GetBufferAsDouble()
const;
676 GetBufferAsVoid()
const;
705 Allocate(
const std::vector<unsigned int> & size,
PixelIDValueEnum valueEnum,
unsigned int numberOfComponents);
711 template <
class TImageType>
713 AllocateInternal(
const std::vector<unsigned int> & size,
unsigned int numberOfComponents);
719 template <
class TImageType>
721 ToVectorInternal(
bool inPlace);
724 template <
class TImageType>
726 ToScalarInternal(
bool inPlace);
743 Image(std::unique_ptr<PimpleImageBase> pimpleImage);
746 template <
typename TImageType>
751 friend struct DispatchedInternalInitialiationAddressor;
752 friend struct AllocateMemberFunctionAddressor;
753 friend struct ToVectorAddressor;
754 friend struct ToScalarAddressor;