![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Base/CustomImage.h>
Base interface for custom Image types that can be converted from/to MemImages and are supported by SharedImage. More...
Inheritance diagram for CustomImage:Base interface for custom Image types that can be converted from/to MemImages and are supported by SharedImage.
Implementing the CustomImage interface enables you to put custom Image types into a SharedImage and make use of its automatic conversion between different image representations. In addition to the pure virtual convertToMem() function, you must implement the inverse conversion as a function with the following signature: static std::unique_ptr<YourImageType> convertFromMem(const MemImage*);.
Minimal example showcasing the compressed storage of pixel data:
Public Member Functions | |
| CustomImage (const ImageDescriptor &desc) | |
| Default constructor simply forwarding to Image(ImageDescriptor). | |
| virtual std::unique_ptr< MemImage > | convertToMem () const =0 |
| Converts the custom representation to a MemImage, returns nullptr on failure. | |
| virtual std::unique_ptr< GlImage > | convertToGl () const |
| Optional fast path for converting the custom representation to a GlImage, returns nullptr on failure. | |
| Location | location () const final |
| Returns the location of the image (e.g. none, host memory or a GPU device) | |
Public Member Functions inherited from Image | |
| 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. | |
| PixelType | pixelType () const |
| Returns the data type of the image. | |
| Type | type () const |
| Returns the data type of the image. | |
| 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. | |
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 |
Additional Inherited Members | |
Public Types inherited from Image | |
| 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 Attributes inherited from Configurable | |
| Signal | signalParametersChanged |
Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted. | |
Protected Member Functions inherited from Image | |
| template<typename T> | |
| bool | typeCompatible () const |
Protected Attributes inherited from Image | |
| ImageDescriptor | m_descriptor |
Protected Attributes inherited from Configurable | |
| std::vector< Param > | m_params |
| List of all registered Parameter and SubProperty instances. | |
|
virtual |
Optional fast path for converting the custom representation to a GlImage, returns nullptr on failure.
If you do not override this method, the default implementation will use convertToMem() to create a temporary MemImage and create the GlImage representation from there.
|
inlinefinalvirtual |
Returns the location of the image (e.g. none, host memory or a GPU device)
Reimplemented from Image.