28 #include <type_traits>
46 class PimpleImageBase;
119 Image(
const std::vector< unsigned int > &size,
PixelIDValueEnum valueEnum,
unsigned int numberOfComponents = 0 );
139 template <
typename TImageType>
141 :
Image( image.GetPointer() )
144 template <
typename TImageType>
146 : m_PimpleImage( nullptr )
149 "invalid pixel type" );
150 this->InternalInitialization<ImageTypeToPixelIDValue<TImageType>::Result, TImageType::ImageDimension>( image );
182 std::string GetPixelIDTypeAsString( )
const;
191 unsigned int GetDimension( )
const;
198 unsigned int GetNumberOfComponentsPerPixel( )
const;
208 uint64_t GetNumberOfPixels( )
const;
213 std::vector< double > GetOrigin( )
const;
214 void SetOrigin(
const std::vector< double > &origin );
223 std::vector< double > GetSpacing( )
const;
224 void SetSpacing(
const std::vector< double > &spacing );
234 std::vector< double > GetDirection()
const;
235 void SetDirection (
const std::vector< double > &direction );
239 std::vector< double > TransformIndexToPhysicalPoint(
const std::vector< int64_t > &index )
const;
242 std::vector< int64_t > TransformPhysicalPointToIndex(
const std::vector< double >& point )
const;
245 std::vector< double > TransformPhysicalPointToContinuousIndex(
const std::vector< double >& point )
const;
248 std::vector< double > TransformContinuousIndexToPhysicalPoint(
const std::vector< double > &index)
const;
253 std::vector< unsigned int > GetSize( )
const;
256 unsigned int GetWidth( )
const;
259 unsigned int GetHeight( )
const;
263 unsigned int GetDepth( )
const;
276 void CopyInformation(
const Image &srcImage );
284 std::vector<std::string> GetMetaDataKeys( )
const;
288 bool HasMetaDataKey(
const std::string &key )
const;
298 std::string GetMetaData(
const std::string &key )
const;
304 void SetMetaData(
const std::string &key,
const std::string &value);
311 bool EraseMetaData(
const std::string &key );
313 std::string ToString( )
const;
330 int8_t GetPixelAsInt8(
const std::vector<uint32_t> &idx)
const;
331 uint8_t GetPixelAsUInt8(
const std::vector<uint32_t> &idx)
const;
332 int16_t GetPixelAsInt16(
const std::vector<uint32_t> &idx )
const;
333 uint16_t GetPixelAsUInt16(
const std::vector<uint32_t> &idx )
const;
334 int32_t GetPixelAsInt32(
const std::vector<uint32_t> &idx )
const;
335 uint32_t GetPixelAsUInt32(
const std::vector<uint32_t> &idx )
const;
336 int64_t GetPixelAsInt64(
const std::vector<uint32_t> &idx )
const;
337 uint64_t GetPixelAsUInt64(
const std::vector<uint32_t> &idx )
const;
338 float GetPixelAsFloat(
const std::vector<uint32_t> &idx )
const;
339 double GetPixelAsDouble(
const std::vector<uint32_t> &idx )
const;
341 std::vector<int8_t> GetPixelAsVectorInt8(
const std::vector<uint32_t> &idx)
const;
342 std::vector<uint8_t> GetPixelAsVectorUInt8(
const std::vector<uint32_t> &idx)
const;
343 std::vector<int16_t> GetPixelAsVectorInt16(
const std::vector<uint32_t> &idx )
const;
344 std::vector<uint16_t> GetPixelAsVectorUInt16(
const std::vector<uint32_t> &idx )
const;
345 std::vector<int32_t> GetPixelAsVectorInt32(
const std::vector<uint32_t> &idx )
const;
346 std::vector<uint32_t> GetPixelAsVectorUInt32(
const std::vector<uint32_t> &idx )
const;
347 std::vector<int64_t> GetPixelAsVectorInt64(
const std::vector<uint32_t> &idx )
const;
348 std::vector<uint64_t> GetPixelAsVectorUInt64(
const std::vector<uint32_t> &idx )
const;
349 std::vector<float> GetPixelAsVectorFloat32(
const std::vector<uint32_t> &idx )
const;
350 std::vector<double> GetPixelAsVectorFloat64(
const std::vector<uint32_t> &idx )
const;
352 std::complex<float> GetPixelAsComplexFloat32(
const std::vector<uint32_t> &idx )
const;
353 std::complex<double> GetPixelAsComplexFloat64(
const std::vector<uint32_t> &idx )
const;
372 void SetPixelAsInt8(
const std::vector<uint32_t> &idx,
int8_t v );
373 void SetPixelAsUInt8(
const std::vector<uint32_t> &idx,
uint8_t v );
374 void SetPixelAsInt16(
const std::vector<uint32_t> &idx,
int16_t v );
375 void SetPixelAsUInt16(
const std::vector<uint32_t> &idx,
uint16_t v );
376 void SetPixelAsInt32(
const std::vector<uint32_t> &idx,
int32_t v );
377 void SetPixelAsUInt32(
const std::vector<uint32_t> &idx,
uint32_t v );
378 void SetPixelAsInt64(
const std::vector<uint32_t> &idx,
int64_t v );
379 void SetPixelAsUInt64(
const std::vector<uint32_t> &idx,
uint64_t v );
380 void SetPixelAsFloat(
const std::vector<uint32_t> &idx,
float v );
381 void SetPixelAsDouble(
const std::vector<uint32_t> &idx,
double v );
383 void SetPixelAsVectorInt8(
const std::vector<uint32_t> &idx,
const std::vector<int8_t> &v );
384 void SetPixelAsVectorUInt8(
const std::vector<uint32_t> &idx,
const std::vector<uint8_t> &v );
385 void SetPixelAsVectorInt16(
const std::vector<uint32_t> &idx,
const std::vector<int16_t> &v );
386 void SetPixelAsVectorUInt16(
const std::vector<uint32_t> &idx,
const std::vector<uint16_t> &v );
387 void SetPixelAsVectorInt32(
const std::vector<uint32_t> &idx,
const std::vector<int32_t> &v );
388 void SetPixelAsVectorUInt32(
const std::vector<uint32_t> &idx,
const std::vector<uint32_t> &v );
389 void SetPixelAsVectorInt64(
const std::vector<uint32_t> &idx,
const std::vector<int64_t> &v );
390 void SetPixelAsVectorUInt64(
const std::vector<uint32_t> &idx,
const std::vector<uint64_t> &v );
391 void SetPixelAsVectorFloat32(
const std::vector<uint32_t> &idx,
const std::vector<float> &v );
392 void SetPixelAsVectorFloat64(
const std::vector<uint32_t> &idx,
const std::vector<double> &v );
394 void SetPixelAsComplexFloat32(
const std::vector<uint32_t> &idx,
const std::complex<float> v );
395 void SetPixelAsComplexFloat64(
const std::vector<uint32_t> &idx,
const std::complex<double> v );
425 int8_t *GetBufferAsInt8( );
433 float *GetBufferAsFloat( );
434 double *GetBufferAsDouble( );
435 void *GetBufferAsVoid();
437 const int8_t *GetBufferAsInt8( )
const;
438 const uint8_t *GetBufferAsUInt8( )
const;
439 const int16_t *GetBufferAsInt16( )
const;
440 const uint16_t *GetBufferAsUInt16( )
const;
441 const int32_t *GetBufferAsInt32( )
const;
442 const uint32_t *GetBufferAsUInt32( )
const;
443 const int64_t *GetBufferAsInt64( )
const;
444 const uint64_t *GetBufferAsUInt64( )
const;
445 const float *GetBufferAsFloat( )
const;
446 const double *GetBufferAsDouble( )
const;
447 const void *GetBufferAsVoid()
const;
461 bool IsUnique( )
const;
471 void Allocate (
const std::vector<unsigned int > &size,
PixelIDValueEnum valueEnum,
unsigned int numberOfComponents );
480 template<
class TImageType>
481 typename std::enable_if<IsBasic<TImageType>::Value>::type
482 AllocateInternal (
const std::vector<unsigned int > &size,
unsigned int numberOfComponents );
484 template<
class TImageType>
485 typename std::enable_if<IsVector<TImageType>::Value>::type
486 AllocateInternal (
const std::vector<unsigned int > &size,
unsigned int numberOfComponents );
488 template<
class TImageType>
489 typename std::enable_if<IsLabel<TImageType>::Value>::type
490 AllocateInternal (
const std::vector<unsigned int > &size,
unsigned int numberOfComponents );
504 template <
int VPixelIDValue,
unsigned int VImageDimension>
506 VPixelIDValue>::Result,
507 VImageDimension>::ImageType *i );
516 template<
int VPixelIDValue,
typename TImageType>
517 typename std::enable_if<!std::is_same<TImageType, void>::value>::type
518 ConditionalInternalInitialization( TImageType *i);
520 template<
int VPixelIDValue,
typename TImageType>
521 typename std::enable_if<std::is_same<TImageType, void>::value>::type
528 template <
class TMemberFunctionPo
inter >
531 using ObjectType = typename ::detail::FunctionTraits<TMemberFunctionPointer>::ClassType;
533 template<
typename TImageType >
534 TMemberFunctionPointer operator() ( )
const
536 return &ObjectType::template AllocateInternal< TImageType >;