IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Functions
Basic image manipulation

Basic image manipulation with IPSDK. More...

Functions

IPSDKIMAGE_API BoolResult ipsdk::image::createImage (const BaseImage &originalImage, ImagePtr &pOutImg)
 function allowing to create an image from an existing other image More...
 
IPSDKIMAGE_API ImagePtr ipsdk::image::createImage (const BaseImage &originalImage)
 function allowing to create an image from an existing other image More...
 
IPSDKIMAGE_API BoolResult ipsdk::image::createImage (const BaseImage &originalImage, const eImageBufferType &outImageBufferType, ImagePtr &pOutImg)
 function allowing to create an image from an existing other image More...
 
IPSDKIMAGE_API ImagePtr ipsdk::image::createImage (const BaseImage &originalImage, const eImageBufferType &outImageBufferType)
 function allowing to create an image from an existing other image More...
 
PYIPSDKBASE_API PythonImagePtr ipsdk::python::createImage (const image::eImageBufferType &imageBufferType, const ipUInt64 sizeX, const ipUInt64 sizeY)
 function allowing to create a new python 2d image More...
 
PYIPSDKBASE_API PythonImagePtr ipsdk::python::createImageRgb (const image::eImageBufferType &imageBufferType, const ipUInt64 sizeX, const ipUInt64 sizeY)
 function allowing to create a new python rgb 2d image More...
 
PYIPSDKBASE_API PythonImagePtr ipsdk::python::createImageSeq (const image::eImageBufferType &imageBufferType, const ipUInt64 sizeX, const ipUInt64 sizeY, const ipUInt64 sizeT)
 function allowing to create a new python sequence 2d image More...
 
PYIPSDKBASE_API PythonImagePtr ipsdk::python::createImage (const image::eImageBufferType &imageBufferType, const ipUInt64 sizeX, const ipUInt64 sizeY, const ipUInt64 sizeZ)
 function allowing to create a new python 3d image More...
 
PYIPSDKBASE_API PythonImagePtr ipsdk::python::createImage (const image::BaseImageGeometry &geometry)
 function allowing to create a new python image from an existing geometry More...
 

Detailed Description

Basic image manipulation with IPSDK.

Image creation

Image creation in C++

The main image structure is ipsdk::image::BaseImage. The easiest way to create an IPSDK image is to define a geometry and initialize a ipsdk::image::MemoryImage, a class inheriting the ipsdk::image::BaseImage class, with this geometry.

Typically, it is possible to initialize a 2d RGB image, with float data type, in C++ with the following lines :

boost::shared_ptr<MemoryImage> pImg(boost::make_shared<MemoryImage>());
pImg->init(*pImageGeometry);

Where sizeX and sizeY are the image dimensions respectively along the x and y axis.

Image creation in Python

In Python, several wrappers allow to create an image, giving the image dimensions and the buffer type. Typically, the equivalent code in Python of the C++ sample above is :

img = PyIPSDK.createImageRgb(PyIPSDK.eImageBufferType.eIBT_Real32, sizeX, sizeY)

Wrappers are available so that images with simple and frequently used geometry can be directly created :

# Create a 2d grey level image with size 256x128 respectively along the x and y-axis, with type unsigned 8-bits integer
img = PyIPSDK.createImage(PyIPSDK.eImageBufferType.eIBT_UInt8, 256, 128)
# Create a 2d RGB image with size 256x128 respectively along the x and y-axis, with type unsigned 8-bits integer
img = PyIPSDK.createImageRgb(PyIPSDK.eImageBufferType.eIBT_UInt8, 256, 128)
# Create a 2d RGB image sequence of 20 frames with size 256x128 respectively along the x and y-axis, with type unsigned 8-bits integer
img = PyIPSDK.createImageSeq(PyIPSDK.eImageBufferType.eIBT_UInt8, 256, 128, 20)
# Create a 3d grey level image with size 256x128x64 respectively along the x, y and z-axis, with type unsigned 8-bits integer
img = PyIPSDK.createImage(PyIPSDK.eImageBufferType.eIBT_UInt8, 256, 128, 64)

Less usual geometries can be specified by passing it directly as input parameter of the function createImage. For instance, the example given in C++ can also be translated in Python by the command :

img = PyIPSDK.createImage(PyIPSDK.geometryRgb2d(PyIPSDK.eImageBufferType.eIBT_Real32, sizeX, sizeY))

Please, see Image geometry concepts in IPSDK for more details about the image geometry.

Note
The package PyIPSDK has to be imported.

Retrieve the image geometry information

It is possible to retrieve the geometry from an existing image. In this way, we can get the geometry component (color, temporal or volume geometry) or directly the geometry information : the size along the x, y or z axis, the number of channels, the number of frames and the image buffer type.

Here are two examples of information extraction in C++ :

const ipUInt32 sizeX = pImg->getSizeX();
const eImageBuffertype imageBufferType = pImg->getBufferType();

The equivalent in Python is :

sizeX = img.getSizeX()
imageBufferType = img.getBufferType()

Image geometric calibration

IPSDK images can be associated to a geometric calibration. This object allows to define :

The user can check whether an image has been associated to a geometric calibration using the method ipsdk::image::BaseImage::hasGeometricCalibration() const. Image geometric calibration can be retrieved using the method ipsdk::image::BaseImage::getGeometricCalibration() const and updated using the method ipsdk::image::BaseImage::setGeometricCalibration(). For more informations on geometric calibration please see Image calibration concepts in IPSDK.

Note
some file format contains an image geometric calibration. In this case, it will be automatically loaded with image data (see Tiff image files for example).

Function Documentation

◆ createImage() [1/7]

IPSDKIMAGE_API BoolResult ipsdk::image::createImage ( const BaseImage originalImage,
ImagePtr pOutImg 
)

function allowing to create an image from an existing other image

Returns
false on failure
Exceptions
ipsdk::image::IPSDKImageExceptionif originalImage.isInit() == false

◆ createImage() [2/7]

IPSDKIMAGE_API ImagePtr ipsdk::image::createImage ( const BaseImage originalImage)

function allowing to create an image from an existing other image

Exceptions
ipsdk::image::IPSDKImageExceptionif originalImage.isInit() == false
ipsdk::image::IPSDKImageExceptionif on failure

◆ createImage() [3/7]

IPSDKIMAGE_API BoolResult ipsdk::image::createImage ( const BaseImage originalImage,
const eImageBufferType outImageBufferType,
ImagePtr pOutImg 
)

function allowing to create an image from an existing other image

Returns
false on failure
Exceptions
ipsdk::image::IPSDKImageExceptionif originalImage.isInit() == false
ipsdk::image::IPSDKImageExceptionif outImageBufferType == eImageBufferType::eIBT_None

◆ createImage() [4/7]

IPSDKIMAGE_API ImagePtr ipsdk::image::createImage ( const BaseImage originalImage,
const eImageBufferType outImageBufferType 
)

function allowing to create an image from an existing other image

Exceptions
ipsdk::image::IPSDKImageExceptionif originalImage.isInit() == false
ipsdk::image::IPSDKImageExceptionif outImageBufferType == eImageBufferType::eIBT_None
ipsdk::image::IPSDKImageExceptionif on failure

◆ createImage() [5/7]

PYIPSDKBASE_API PythonImagePtr ipsdk::python::createImage ( const image::eImageBufferType imageBufferType,
const ipUInt64  sizeX,
const ipUInt64  sizeY 
)

function allowing to create a new python 2d image

Exceptions
ipsdk::python::PyIPSDKBaseExceptionon failure

◆ createImageRgb()

PYIPSDKBASE_API PythonImagePtr ipsdk::python::createImageRgb ( const image::eImageBufferType imageBufferType,
const ipUInt64  sizeX,
const ipUInt64  sizeY 
)

function allowing to create a new python rgb 2d image

Exceptions
ipsdk::python::PyIPSDKBaseExceptionon failure

◆ createImageSeq()

PYIPSDKBASE_API PythonImagePtr ipsdk::python::createImageSeq ( const image::eImageBufferType imageBufferType,
const ipUInt64  sizeX,
const ipUInt64  sizeY,
const ipUInt64  sizeT 
)

function allowing to create a new python sequence 2d image

Exceptions
ipsdk::python::PyIPSDKBaseExceptionon failure

◆ createImage() [6/7]

PYIPSDKBASE_API PythonImagePtr ipsdk::python::createImage ( const image::eImageBufferType imageBufferType,
const ipUInt64  sizeX,
const ipUInt64  sizeY,
const ipUInt64  sizeZ 
)

function allowing to create a new python 3d image

Exceptions
ipsdk::python::PyIPSDKBaseExceptionon failure

◆ createImage() [7/7]

PYIPSDKBASE_API PythonImagePtr ipsdk::python::createImage ( const image::BaseImageGeometry geometry)

function allowing to create a new python image from an existing geometry

Exceptions
ipsdk::python::PyIPSDKBaseExceptionon failure