![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Base/Image.h>
Base class and interface for images. More...
Inheritance diagram for Image:Base class and interface for images.
This class is merely a wrapper around an ImageDescriptor that offers a couple of convenience functions for the user. It does not store any image data, which is only done by the derived classes.
Older iterations of the SDK did not yet have the dedicated ImageDescriptor class and were therefore using the Image class as descriptor. New code should refrain from this and use ImageDescriptor directly to avoid confusing semantics of function signatures.
Public Types | |
| enum | Type { BYTE = static_cast<int>(PixelType::Byte) , UBYTE = static_cast<int>(PixelType::UByte) , SHORT = static_cast<int>(PixelType::Short) , USHORT = static_cast<int>(PixelType::UShort) , INT = static_cast<int>(PixelType::Int) , UINT = static_cast<int>(PixelType::UInt) , FLOAT = static_cast<int>(PixelType::Float) , DOUBLE = static_cast<int>(PixelType::Double) , HFLOAT = static_cast<int>(PixelType::HFloat) } |
| Pixel/voxel data type, equivalent to OpenGL defines. More... | |
| enum | Location { NONE = 0 , MEMORY = 1 , OPENGL = 2 , OPENCL = 3 , CUSTOM = 6 } |
| Location where the data resides. More... | |
Public Member Functions | |
| Image (const ImageDescriptor &desc) | |
| Create a new Image with the given descriptor. | |
| Image (const Image &other)=default | |
| Image & | operator= (const Image &other)=default |
| Image (Image &&other) noexcept=default | |
| Image & | operator= (Image &&other) noexcept=default |
| const ImageDescriptor & | descriptor () const |
| Return the image descriptor. | |
| void | configure (const Properties *p) override |
| Configure the image descriptor from properties. | |
| void | configuration (Properties *p) const override |
| Store image descriptor into properties. | |
| void | setShift (double val) |
| Sets the intensity shift value. | |
| void | setScale (double val) |
| Sets the intensity scale value. | |
| void | setSpacing (double sx, double sy, double sz=1.0) |
| Specify pixel/voxel spacing with two or three scalar values. | |
| void | setSpacing (double sx, double sy, double sz, bool isMetric) |
| Convenience function for specifying spacing and metric flag at the same time. | |
| void | setSpacing (const vec3 &s) |
| Specify pixel/voxel spacing using a 3-vector. | |
| void | setSpacing (const vec3 &s, bool metric) |
| Convenience function for specifying spacing and metric flag at the same time. | |
| void | setMetric (bool val) |
| Set data to be metric. | |
| double | storageToOriginal (double value) const |
| Applies the image's shift and scale in order to convert value from storage pixel value domain to original pixel value domain. | |
| double | originalToStorage (double value) const |
| Applies the image's shift and scale in order to convert value from original pixel value domain to storage pixel value domain. | |
Public Member Functions inherited from Configurable | |
| virtual void | configureDefaults () |
| Retrieve the properties of this object, replaces values with their defaults and sets it again. | |
| void | registerParameter (ParameterBase *param) |
| Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration(). | |
| void | unregisterParameter (const ParameterBase *param) |
| Remove the given Parameter or SubProperty from the list of registered parameters. | |
| Configurable (const Configurable &rhs) | |
| Configurable (Configurable &&rhs) noexcept | |
| Configurable & | operator= (const Configurable &) |
| Configurable & | operator= (Configurable &&) noexcept |
Protected Member Functions | |
| template<typename T> | |
| bool | typeCompatible () const |
Protected Attributes | |
| ImageDescriptor | m_descriptor |
Protected Attributes inherited from Configurable | |
| std::vector< Param > | m_params |
| List of all registered Parameter and SubProperty instances. | |
Access to the image information | |
| PixelType | pixelType () const |
| Returns the data type of the image. | |
| Type | type () const |
| Returns the data type of the image. | |
| virtual Location | location () const |
| Returns the location of the image (e.g. none, host memory or a GPU device) | |
| int | width () const |
| Returns the width of the image. | |
| int | height () const |
| Returns the height of the image. | |
| int | slices () const |
| Returns the number of 3D slices of the image. | |
| int | channels () const |
| Returns the number of channels of the image. | |
| double | shift () const |
| Returns the intensity shift. | |
| double | scale () const |
| Returns the intensity scale. | |
| vec3 | spacing () const |
| Returns pointer to the pixel/voxel spacing values. | |
| bool | isMetric () const |
| Returns true if data is metric. | |
| vec3 | extent () const |
| Returns the physical size of the image as a vector. | |
| vec3i | dimensions () const |
| Returns the dimensions of the image in pixels as a vector. | |
| vec3 | pixelToImage (const vec3 &pixel) const |
| Convert a 3D pixel/voxel position to image coordinates. | |
| vec3 | imageToPixel (const vec3 &world) const |
| Convert 3D image coordinates to pixel/voxel position. | |
| mat4 | pixelToImageMatrix () const |
| Returns a 4x4 matrix to transform from image pixel space to image space. | |
| mat4 | imageToPixelMatrix () const |
| Returns a 4x4 matrix to transform from image space to image pixel space. | |
| size_t | index (int x, int y, int z=0, int c=0) const |
| Returns a linear memory index for a pixel or voxel. | |
| bool | hasIndex (int x, int y, int z=0, int c=0) const |
| Returns true if the pixel at (x,y,z) exists, false otherwise. | |
| vec4i | coord (size_t index) const |
| Returns the pixel/voxel coordinate (x,y,z,c) for a given index. | |
| size_t | size () const |
| Returns the size (number of elements) of the image. | |
| int | typeSize () const |
| Return the nominal size in bytes of standard data types, zero if unknown. | |
| bool | isInteger () const |
| Returns whether the image is of an integer data type. | |
| bool | isSigned () const |
| Returns whether the image type supports negative values. | |
| size_t | byteSize () const |
| Returns the size of the image in bytes. | |
| int | alignment () const |
| Returns the byte alignment of an image line (up to 8) | |
| int | dimension () const |
| Returns the spatial dimension of the image. | |
| bool | compatible (const Image &other, bool ignoreType=false, bool ignore3D=false, bool ignoreChannels=false) const |
| Tells if this image is compatible to another one. | |
Additional Inherited Members | |
Public Attributes inherited from Configurable | |
| Signal | signalParametersChanged |
Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted. | |
| enum Type |
| enum Location |
Location where the data resides.
| Enumerator | |
|---|---|
| NONE | Actual data is not available. |
| MEMORY | CPU main memory. |
| OPENGL | OpenGL texture. |
| OPENCL | OpenCL image or buffer. |
| CUSTOM | Custom image location. |
|
overridevirtual |
Configure the image descriptor from properties.
Reimplemented from Configurable.
|
overridevirtual |
Store image descriptor into properties.
Reimplemented from Configurable.
|
inlinevirtual |
Returns the location of the image (e.g. none, host memory or a GPU device)
Reimplemented in ClImage, CustomImage, GlImage, and MemImage.
|
inline |
Applies the image's shift and scale in order to convert value from storage pixel value domain to original pixel value domain.
|
inline |
Applies the image's shift and scale in order to convert value from original pixel value domain to storage pixel value domain.