IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Friends | List of all members
ipsdk::python::PythonImage Class Reference

Base class for IPSDK image used through python. More...

#include <PythonImage.h>

Inheritance diagram for ipsdk::python::PythonImage:
ipsdk::image::BaseCompleteImage ipsdk::image::BaseImage ipsdk::BaseObjectWithSkeleton ipsdk::BaseSerializationObject ipsdk::BaseDynamicObject

Public Types

typedef boost::python::numpy::ndarray PythonArray
 underlying python array type
 

Public Member Functions

 ~PythonImage ()
 destructor
 
image::eImageType getImageType () const
 retrieve image type
 
virtual BoolResult init (const image::BaseImageGeometry &geometry)
 image initialization with own allocation More...
 
BoolResult init (const image::BaseImageGeometry &geometry, const boost::python::numpy::ndarray &pythonArray)
 image initialization from python array More...
 
BoolResult init (const PythonImageAccessorPtr &pImageAccessor)
 image initialization with own allocation and using an image accessor More...
 
BoolResult init (const PythonImageAccessorPtr &pImageAccessor, const boost::python::numpy::ndarray &pythonArray)
 image initialization from python array and using an image accessor More...
 
image::eImageAccessMode getAccessMode () const
 retrieve image access mode More...
 
BoolResult resize (const image::BaseImageGeometry &geometry)
 resize of image given a new geometry More...
 
bool isBufferOwn () const
 check whether buffer is own by object More...
 
boost::python::numpy::ndarray getArray () const
 retrieve array associated to python image More...
 
ipBool isGpuImage () const
 returns true if the image is loaded on GPU
 
ipBool isDiskImage () const
 returns true if the image is a disk one
 
void toGPU (PythonCudaImagePtr pOutImg) const
 transfers the data to GPU in a PythonGpuImagePtr, specified by the input GPU image
 
PythonCudaImagePtr toGPU () const
 transfers the data to GPU in a PythonGpuImagePtr
 
- Public Member Functions inherited from ipsdk::image::BaseCompleteImage
virtual ~BaseCompleteImage ()=0
 destructor
 
eImageBaseType getImageBaseType () const
 retrieve image type
 
void setName (const std::string &imageName)
 access to image name More...
 
BaseDataItemgetHeaderItem (const std::string &key)
 retrieve a header item given associated key More...
 
void addHeaderItem (const std::string &key, const DataItemPtr &pItem)
 add data item to header given associated key More...
 
void removeHeaderItem (const std::string &key)
 remove item from header given associated key More...
 
void clearHeader ()
 remove all items from header More...
 
- Public Member Functions inherited from ipsdk::image::BaseImage
virtual ~BaseImage ()=0
 destructor
 
bool isInit () const
 retrieve object initialisation flag
 
void setScaleGeometricCalibration (const ipReal32 scale, const std::string &unitStr="")
 set geometric calibration associated to image by changing only the scale and the unit More...
 
void setScaleGeometricCalibration (const ipReal32 xScale, const ipReal32 yScale, const std::string &unitStr="")
 
void setScaleGeometricCalibration (const ipReal32 xScale, const ipReal32 yScale, const ipReal32 zScale, const std::string &unitStr="")
 
void setOrigin (const ipReal32 xOrigin, const ipReal32 yOrigin)
 set geometric calibration associated to image More...
 
void setOrigin (const ipReal32 xOrigin, const ipReal32 yOrigin, const ipReal32 zOrigin)
 
virtual bool hasRemoteStorage () const
 method allowing to check whether image is associated to remote data (data with remote storage) More...
 
bool hasBinary8BitsStorage () const
 method allowing to check whether image underlying storage stores binary data with a 8 bit alignment More...
 
bool hasByPlanDataAccess () const
 check whether all plans have contiguous access to full plan data More...
 
PlanStorageConstPtr getPlanStorage (const PlanIndex &planIndex) const
 
PlanStoragePtr getPlanStorage (const PlanIndex &planIndex)
 
const PlanStorageColl3dgetPlanStorageColl () const
 
std::string getUserPropertiesStr () const
 
void setUserPropertiesStr (const std::string &newStrUserProperties)
 
std::string getChannelName (const ipUInt64 c) const
 
void setChannelName (const std::string &strName, const ipUInt64 c)
 
bool minIsBlack () const
 Returns true if the minimum image value is assigned to black. More...
 
void clear ()
 clear of object data
 
const DataIdentifiergetIdentifier () const
 retrieve identifier associated to image More...
 
const DataIdentifierConstPtr getIdentifierPtr () const
 retrieve pointer to identifier associated to image More...
 
const GuidgetGuid () const
 access to image guid More...
 
const std::string & getName () const
 access to image name More...
 
bool existsHeaderKey (const std::string &key) const
 check whether a given key exists into header More...
 
ItemNames getHeaderKeys () const
 retrieve header key list More...
 
const BaseDataItemgetHeaderItem (const std::string &key) const
 retrieve a header item given associated key More...
 
DataItemConstPtr getHeaderItemPtr (const std::string &key) const
 retrieve a header item given associated key More...
 
DataItemMapConstPtr getHeaderPtr () const
 retrieve the header item map More...
 
bool hasGeometricCalibration () const
 check whether image is associated to a geometric calibration More...
 
const GeometricCalibrationgetGeometricCalibration () const
 retrieve geometric calibration associated to image More...
 
const GeometricCalibrationConstPtrgetGeometricCalibrationConstPtr () const
 retrieve geometric calibration associated to image More...
 
void setGeometricCalibration (const GeometricCalibrationConstPtr &pGeometricCalibration)
 set geometric calibration associated to image More...
 
const BaseImageGeometrygetGeometry () const
 retrieve image geometry More...
 
ImageGeometryConstPtr getGeometryPtr () const
 retrieve image geometry More...
 
ipUInt64 getSizeX () const
 retrieve geometry plan x size More...
 
ipUInt64 getSizeY () const
 retrieve geometry plan y size More...
 
const VolumeGeometrygetVolumeGeometry () const
 retrieve volume geometry (z) size and type More...
 
const eVolumeGeometryTypegetVolumeGeometryType () const
 retrieve volume geometry (z) type More...
 
ipUInt64 getSizeZ () const
 retrieve volume geometry (z) size More...
 
const ColorGeometrygetColorGeometry () const
 retrieve color geometry (c) size and type More...
 
const eColorGeometryTypegetColorGeometryType () const
 retrieve color geometry (c) type More...
 
ipUInt64 getSizeC () const
 retrieve color geometry (c) size More...
 
const TemporalGeometrygetTemporalGeometry () const
 retrieve temporal geometry (t) size and type More...
 
const eTemporalGeometryTypegetTemporalGeometryType () const
 retrieve temporal geometry (t) type More...
 
ipUInt64 getSizeT () const
 retrieve temporal geometry (t) size More...
 
ipUInt64 getNbTotPlans () const
 retrieve total number of plans for geometry More...
 
bool isValidPlanIdx (const ipUInt64 zPlanIdx, const ipUInt64 cPlanIdx, const ipUInt64 tPlanIdx) const
 check whether a given plan index is valid More...
 
bool isValidPlanIdx (const PlanIndex &planIdx) const
 check whether a given plan index is valid More...
 
const eImageBufferTypegetBufferType () const
 retrieve image data type More...
 
const eImageBufferTypegetBufferType (const ipUInt64 tPlanIdx) const
 retrieve image data type for a given temporal component More...
 
void toGPU (CudaImagePtr pCudaImg) const
 Returns a copy of the image instance stored on NVidia device(s), specified by the input Cuda image.
 
CudaImagePtr toGPU () const
 Returns a copy of the image instance stored on NVidia device(s)
 
ipBool containSameData (const BaseImage &otherImage) const
 
void setVolumeGeometryType (const eVolumeGeometryType &vType)
 Setters of geometry types : More...
 
void setColorGeometryType (const eColorGeometryType &cType)
 Returns a copy of the image instance stored on NVidia device(s), specified by the input Cuda image.
 
void setTemporalGeometryType (const eTemporalGeometryType &tType)
 Returns a copy of the image instance stored on NVidia device(s), specified by the input Cuda image.
 
void setBufferType (const eImageBufferType &type)
 Returns a copy of the image instance stored on NVidia device(s), specified by the input Cuda image.
 
- Public Member Functions inherited from ipsdk::BaseObjectWithSkeleton
const eSklSrzModegetSerializationMode () const
 retrieve serialization flag for object More...
 
void setSerializationMode (const eSklSrzMode &sklSrzMode) const
 set serialization flag for object
 
 BaseObjectWithSkeleton ()
 
 ~BaseObjectWithSkeleton ()
 
- Public Member Functions inherited from ipsdk::BaseSerializationObject
 BaseSerializationObject ()
 Default constructor.
 
virtual ~BaseSerializationObject ()=0
 destructor
 
- Public Member Functions inherited from ipsdk::BaseDynamicObject
virtual const std::string & getClassName () const
 method allowing to retrieve object class name
 
virtual BaseDynamicObjectcreateNew () const =0
 method allowing to create new instance of current object type
 
virtual DynamicObjectPtr createShared () const =0
 method allowing to create new shared instance of current object type
 
virtual bool hasCopySupport () const =0
 check whether objet has copy support
 
virtual BaseDynamicObjectduplicate () const =0
 method allowing to duplicate current object More...
 
virtual DynamicObjectPtr duplicateShared () const =0
 method allowing shared duplication of current object More...
 
 BaseDynamicObject ()
 
virtual ~BaseDynamicObject ()=0
 

Static Public Member Functions

static void setContiguousStyle (const bool bCContiguous)
 
- Static Public Member Functions inherited from ipsdk::BaseSerializationObject
static ipUInt32 getVersion ()
 method allowing to retrieve class version information for serialization
 
- Static Public Member Functions inherited from ipsdk::BaseDynamicObject
static const std::string & getTypeName ()
 method allowing to retrieve name associated to class
 

Public Attributes

HybridBufferPtr _pBuffer
 buffer associated to image
 
boost::shared_ptr< PythonArray_pArray
 underlying python array
 
PythonImageAccessorPtr _pImageAccessor
 

Static Public Attributes

static const image::eImageType::domain g_imageType = image::eImageType::eIT_Custom
 type associated to attribute
 
static bool g_bCContiguous
 
- Static Public Attributes inherited from ipsdk::image::BaseCompleteImage
static const eImageBaseType::domain g_imageBaseType = eImageBaseType::eIBT_Complete
 type associated to attribute
 

Protected Member Functions

 PythonImage ()
 constructor
 
void createImagePlans (const image::BaseImageGeometry &geometry, image::PlanStorageColl3d &imagePlans)
 method allowing to create image plan collection from a geometry
 
void updateInternalArray (const image::BaseImageGeometry &geometry, void *pData) const
 method allowing to update python internal array associated to image More...
 
void clearDerived ()
 clear data in derived class
 
- Protected Member Functions inherited from ipsdk::image::BaseCompleteImage
 BaseCompleteImage ()
 constructor
 
BoolResult initBase (const ImageGeometryPtr &pGeometry, const PlanStorageColl3d &imagePlans)
 base class initialization method More...
 
DataIdentifierConstPtr getIdentifier () const
 method allowing to access to image identifier
 
- Protected Member Functions inherited from ipsdk::image::BaseImage
 BaseImage ()
 constructor
 
BoolResult initBase (const DataIdentifierConstPtr &pIdentifier, const DataItemMapConstPtr &pHeader, const ImageGeometryPtr &pGeometry, const PlanStorageColl3d &imagePlans)
 base class initialization method More...
 
void resizeBase (const ImageGeometryPtr &pGeometry, const PlanStorageColl3d &imagePlans)
 resize of image given a new geometry and a new image plan collection More...
 
bool checkForRemoteStorage () const
 method allowing to check whether some plan storage are associated to remote storage More...
 
const PlanStorageColl3daccessImagePlans () const
 access to plan storage collection in derived class
 
PlanStorageColl3daccessImagePlans ()
 access to plan storage collection in derived class
 
- Protected Member Functions inherited from ipsdk::BaseSerializationObject
virtual BoolResult write (BaseOArchive &ar) const
 method allowing to ensure serialization write part for object
 
virtual BoolResult read (BaseIArchive &ar)
 method allowing to ensure serialization read part for object
 
- Protected Member Functions inherited from ipsdk::BaseDynamicObject
virtual void initCtorCopy (const BaseDynamicObject &object)
 
virtual void copy (const BaseDynamicObject &object)
 method allowing to copy data from another object
 

Friends

boost::shared_ptr< PythonImageboost::make_shared ()
 

Additional Inherited Members

- Protected Attributes inherited from ipsdk::image::BaseCompleteImage
DataIdentifierPtr _pIdentifier
 image identifier
 
DataItemMapPtr _pHeader
 image header
 
- Protected Attributes inherited from ipsdk::BaseObjectWithSkeleton
eSklSrzMode _sklSrzMode
 serialization flag for object More...
 

Detailed Description

Base class for IPSDK image used through python.

Author
E.Noirfalise
Date
2016/06/23

These images are based on a numpy array

Member Function Documentation

◆ setContiguousStyle()

static void ipsdk::python::PythonImage::setContiguousStyle ( const bool  bCContiguous)
static

function allowing to specify whether we should expect C or Fortran style contiguous segment of data (default : true)

◆ init() [1/4]

virtual BoolResult ipsdk::python::PythonImage::init ( const image::BaseImageGeometry geometry)
virtual

image initialization with own allocation

Warning
mixed buffer type are not supported by this kind of images
Returns
false in case of failure

Implements ipsdk::image::BaseImage.

◆ init() [2/4]

BoolResult ipsdk::python::PythonImage::init ( const image::BaseImageGeometry geometry,
const boost::python::numpy::ndarray &  pythonArray 
)

image initialization from python array

Exceptions
ipsdk::image::IPSDKImageExceptionif geometry and pythonArray data mismatch
Returns
false in case of failure

◆ init() [3/4]

BoolResult ipsdk::python::PythonImage::init ( const PythonImageAccessorPtr &  pImageAccessor)

image initialization with own allocation and using an image accessor

Warning
mixed buffer type are not supported by this kind of images
Returns
false in case of failure

◆ init() [4/4]

BoolResult ipsdk::python::PythonImage::init ( const PythonImageAccessorPtr &  pImageAccessor,
const boost::python::numpy::ndarray &  pythonArray 
)

image initialization from python array and using an image accessor

Exceptions
ipsdk::image::IPSDKImageExceptionif geometry and pythonArray data mismatch
Returns
false in case of failure

◆ getAccessMode()

image::eImageAccessMode ipsdk::python::PythonImage::getAccessMode ( ) const
virtual

retrieve image access mode

Exceptions
ipsdk::image::IPSDKImageExceptionif isInit() == false

Implements ipsdk::image::BaseImage.

◆ resize()

BoolResult ipsdk::python::PythonImage::resize ( const image::BaseImageGeometry geometry)
virtual

resize of image given a new geometry

Exceptions
ipsdk::image::IPSDKImageExceptionif getAccessMode() != eImageAccessMode::eIAM_Resize
Returns
false in case of failure

Implements ipsdk::image::BaseCompleteImage.

◆ isBufferOwn()

bool ipsdk::python::PythonImage::isBufferOwn ( ) const

check whether buffer is own by object

Exceptions
ipsdk::image::IPSDKImageExceptionif isInit() == false

◆ getArray()

boost::python::numpy::ndarray ipsdk::python::PythonImage::getArray ( ) const

retrieve array associated to python image

Exceptions
ipsdk::image::IPSDKImageExceptionif isInit() == false
ipsdk::image::IPSDKImageExceptionon failure

◆ updateInternalArray()

void ipsdk::python::PythonImage::updateInternalArray ( const image::BaseImageGeometry geometry,
void *  pData 
) const
protected

method allowing to update python internal array associated to image

Exceptions
ipsdk::image::IPSDKImageExceptionon failure

Member Data Documentation

◆ g_bCContiguous

bool ipsdk::python::PythonImage::g_bCContiguous
static

flag indicating whether we should expect C or Fortran style contiguous segment of data

◆ _pImageAccessor

PythonImageAccessorPtr ipsdk::python::PythonImage::_pImageAccessor

Optional image accessor allowing to manage buffers with alignment data at the end of each line (x direction)


The documentation for this class was generated from the following file: