29 #include <type_traits>
47 class PimpleImageBase;
120 Image(
const std::vector< unsigned int > &size,
PixelIDValueEnum valueEnum,
unsigned int numberOfComponents = 0 );
140 template <
typename TImageType>
142 :
Image( image.GetPointer() )
145 template <
typename TImageType>
150 const unsigned int dimension = TImageType::ImageDimension;
152 static_assert(type !=
sitkUnknown,
"invalid pixel type");
153 static_assert(dimension >= 2 && dimension <=
SITK_MAX_DIMENSION,
"Unsupported image dimension.");
155 this->InternalInitialization(type, dimension, image);
187 std::string GetPixelIDTypeAsString( )
const;
196 unsigned int GetDimension( )
const;
204 unsigned int GetNumberOfComponentsPerPixel( )
const;
214 uint64_t GetNumberOfPixels( )
const;
220 unsigned int GetSizeOfPixelComponent( )
const;
225 std::vector< double > GetOrigin( )
const;
226 void SetOrigin(
const std::vector< double > &origin );
235 std::vector< double > GetSpacing( )
const;
236 void SetSpacing(
const std::vector< double > &spacing );
246 std::vector< double > GetDirection()
const;
247 void SetDirection (
const std::vector< double > &direction );
251 std::vector< double > TransformIndexToPhysicalPoint(
const std::vector< int64_t > &index )
const;
254 std::vector< int64_t > TransformPhysicalPointToIndex(
const std::vector< double >&
point )
const;
257 std::vector< double > TransformPhysicalPointToContinuousIndex(
const std::vector< double >&
point )
const;
260 std::vector< double > TransformContinuousIndexToPhysicalPoint(
const std::vector< double > &index)
const;
291 std::vector< unsigned int > GetSize( )
const;
294 unsigned int GetWidth( )
const;
297 unsigned int GetHeight( )
const;
301 unsigned int GetDepth( )
const;
314 void CopyInformation(
const Image &srcImage );
322 std::vector<std::string> GetMetaDataKeys( )
const;
326 bool HasMetaDataKey(
const std::string &key )
const;
336 std::string GetMetaData(
const std::string &key )
const;
342 void SetMetaData(
const std::string &key,
const std::string &value);
349 bool EraseMetaData(
const std::string &key );
351 std::string ToString( )
const;
368 int8_t GetPixelAsInt8(
const std::vector<uint32_t> &idx)
const;
369 uint8_t GetPixelAsUInt8(
const std::vector<uint32_t> &idx)
const;
370 int16_t GetPixelAsInt16(
const std::vector<uint32_t> &idx )
const;
371 uint16_t GetPixelAsUInt16(
const std::vector<uint32_t> &idx )
const;
372 int32_t GetPixelAsInt32(
const std::vector<uint32_t> &idx )
const;
373 uint32_t GetPixelAsUInt32(
const std::vector<uint32_t> &idx )
const;
374 int64_t GetPixelAsInt64(
const std::vector<uint32_t> &idx )
const;
375 uint64_t GetPixelAsUInt64(
const std::vector<uint32_t> &idx )
const;
376 float GetPixelAsFloat(
const std::vector<uint32_t> &idx )
const;
377 double GetPixelAsDouble(
const std::vector<uint32_t> &idx )
const;
379 std::vector<int8_t> GetPixelAsVectorInt8(
const std::vector<uint32_t> &idx)
const;
380 std::vector<uint8_t> GetPixelAsVectorUInt8(
const std::vector<uint32_t> &idx)
const;
381 std::vector<int16_t> GetPixelAsVectorInt16(
const std::vector<uint32_t> &idx )
const;
382 std::vector<uint16_t> GetPixelAsVectorUInt16(
const std::vector<uint32_t> &idx )
const;
383 std::vector<int32_t> GetPixelAsVectorInt32(
const std::vector<uint32_t> &idx )
const;
384 std::vector<uint32_t> GetPixelAsVectorUInt32(
const std::vector<uint32_t> &idx )
const;
385 std::vector<int64_t> GetPixelAsVectorInt64(
const std::vector<uint32_t> &idx )
const;
386 std::vector<uint64_t> GetPixelAsVectorUInt64(
const std::vector<uint32_t> &idx )
const;
387 std::vector<float> GetPixelAsVectorFloat32(
const std::vector<uint32_t> &idx )
const;
388 std::vector<double> GetPixelAsVectorFloat64(
const std::vector<uint32_t> &idx )
const;
390 std::complex<float> GetPixelAsComplexFloat32(
const std::vector<uint32_t> &idx )
const;
391 std::complex<double> GetPixelAsComplexFloat64(
const std::vector<uint32_t> &idx )
const;
410 void SetPixelAsInt8(
const std::vector<uint32_t> &idx, int8_t v );
411 void SetPixelAsUInt8(
const std::vector<uint32_t> &idx, uint8_t v );
412 void SetPixelAsInt16(
const std::vector<uint32_t> &idx, int16_t v );
413 void SetPixelAsUInt16(
const std::vector<uint32_t> &idx, uint16_t v );
414 void SetPixelAsInt32(
const std::vector<uint32_t> &idx, int32_t v );
415 void SetPixelAsUInt32(
const std::vector<uint32_t> &idx, uint32_t v );
416 void SetPixelAsInt64(
const std::vector<uint32_t> &idx, int64_t v );
417 void SetPixelAsUInt64(
const std::vector<uint32_t> &idx, uint64_t v );
418 void SetPixelAsFloat(
const std::vector<uint32_t> &idx,
float v );
419 void SetPixelAsDouble(
const std::vector<uint32_t> &idx,
double v );
421 void SetPixelAsVectorInt8(
const std::vector<uint32_t> &idx,
const std::vector<int8_t> &v );
422 void SetPixelAsVectorUInt8(
const std::vector<uint32_t> &idx,
const std::vector<uint8_t> &v );
423 void SetPixelAsVectorInt16(
const std::vector<uint32_t> &idx,
const std::vector<int16_t> &v );
424 void SetPixelAsVectorUInt16(
const std::vector<uint32_t> &idx,
const std::vector<uint16_t> &v );
425 void SetPixelAsVectorInt32(
const std::vector<uint32_t> &idx,
const std::vector<int32_t> &v );
426 void SetPixelAsVectorUInt32(
const std::vector<uint32_t> &idx,
const std::vector<uint32_t> &v );
427 void SetPixelAsVectorInt64(
const std::vector<uint32_t> &idx,
const std::vector<int64_t> &v );
428 void SetPixelAsVectorUInt64(
const std::vector<uint32_t> &idx,
const std::vector<uint64_t> &v );
429 void SetPixelAsVectorFloat32(
const std::vector<uint32_t> &idx,
const std::vector<float> &v );
430 void SetPixelAsVectorFloat64(
const std::vector<uint32_t> &idx,
const std::vector<double> &v );
432 void SetPixelAsComplexFloat32(
const std::vector<uint32_t> &idx,
const std::complex<float> v );
433 void SetPixelAsComplexFloat64(
const std::vector<uint32_t> &idx,
const std::complex<double> v );
463 int8_t *GetBufferAsInt8( );
464 uint8_t *GetBufferAsUInt8( );
465 int16_t *GetBufferAsInt16( );
466 uint16_t *GetBufferAsUInt16( );
467 int32_t *GetBufferAsInt32( );
468 uint32_t *GetBufferAsUInt32( );
469 int64_t *GetBufferAsInt64( );
470 uint64_t *GetBufferAsUInt64( );
471 float *GetBufferAsFloat( );
472 double *GetBufferAsDouble( );
473 void *GetBufferAsVoid();
475 const int8_t *GetBufferAsInt8( )
const;
476 const uint8_t *GetBufferAsUInt8( )
const;
477 const int16_t *GetBufferAsInt16( )
const;
478 const uint16_t *GetBufferAsUInt16( )
const;
479 const int32_t *GetBufferAsInt32( )
const;
480 const uint32_t *GetBufferAsUInt32( )
const;
481 const int64_t *GetBufferAsInt64( )
const;
482 const uint64_t *GetBufferAsUInt64( )
const;
483 const float *GetBufferAsFloat( )
const;
484 const double *GetBufferAsDouble( )
const;
485 const void *GetBufferAsVoid()
const;
499 bool IsUnique( )
const;
509 void Allocate (
const std::vector<unsigned int > &size,
PixelIDValueEnum valueEnum,
unsigned int numberOfComponents );
518 template<
class TImageType>
519 typename std::enable_if<IsBasic<TImageType>::Value>::type
520 AllocateInternal (
const std::vector<unsigned int > &size,
unsigned int numberOfComponents );
522 template<
class TImageType>
523 typename std::enable_if<IsVector<TImageType>::Value>::type
524 AllocateInternal (
const std::vector<unsigned int > &size,
unsigned int numberOfComponents );
526 template<
class TImageType>
527 typename std::enable_if<IsLabel<TImageType>::Value>::type
528 AllocateInternal (
const std::vector<unsigned int > &size,
unsigned int numberOfComponents );
544 template <
typename TImageType>
548 friend struct DispatchedInternalInitialiationAddressor;
549 friend struct AllocateMemberFunctionAddressor;