ImFusion SDK 4.3
GlColormap Class Reference

#include <ImFusion/GL/GlColormap.h>

Wrapper around GlImage to create 1D look-up tables that provides presets for common used colormaps. More...

+ Inheritance diagram for GlColormap:

Detailed Description

Wrapper around GlImage to create 1D look-up tables that provides presets for common used colormaps.

Public Types

enum  Preset {
  Grayscale , Jet , HotIron , PET ,
  HotMetalBlue , PET20Step , DopplerCFM , Viridis ,
  Inferno , CoolWarmDivergent
}
 
- 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 Member Functions

 GlColormap (Preset preset, int width=256, int specialFormat=0)
 
Preset preset () const
 
- Public Member Functions inherited from GlImage
 GlImage (const ImageDescriptor &desc, int internalFormat=0, const void *data=nullptr)
 Creates a new OpenGL image.
 
 GlImage (PixelType type, int width, int height, int slices=1, int channels=1, int internalFormat=0, const void *data=nullptr)
 Creates a new OpenGL texture.
 
 GlImage (Image::Type type, int width, int height, int slices=1, int channels=1, int internalFormat=0, const void *data=nullptr)
 Creates a new OpenGL texture.
 
 GlImage (std::unique_ptr< GL::Texture > texture)
 Creates a GlImage object from an existing OpenGL texture.
 
 GlImage (const MemImage &image)
 Creates an OpenGL texture from another image in memory, uploading the image data to the generated texture.
 
 GlImage (const GlImage &image)
 Creates a deep copy of the GlImage, with a whole new texture containing the same image data as the original.
 
GlImageoperator= (const GlImage &other)
 The assignment operator will copy all aspects of the other image.
 
 GlImage (GlImage &&other) noexcept
 
GlImageoperator= (GlImage &&other) noexcept
 
 ~GlImage () override
 Releases the OpenGL image resource.
 
 operator GL::Texture & ()
 
 operator const GL::Texture & () const
 
void bind (int unit=0) const
 Binds the image to a texture unit.
 
void unbind () const
 Unbinds the image.
 
bool resize (int width, int height, int slices)
 Resize image but keep format and target.
 
bool update (const MemImage &image)
 Updates the image content from memory.
 
template<typename T>
bool update (const std::vector< T > &data)
 Updates the image content from a non-image buffer. Passed buffer has to be at least as large as this image.
 
template<typename T>
bool update (const T *data)
 More generic, less secure version of the buffer update method above.
 
bool update (const GlImage &image, GL::Framebuffer *fbo=0)
 Updates the image content from another GlImage.
 
bool update (const GL::Texture &tex, GL::Framebuffer *fbo=0)
 Updates the image content from another texture.
 
bool swapTexID (GlImage &other)
 Swap the texture ID with another image that has the exact same properties, e.g.
 
GL::Texturetexture ()
 
const GL::Texturetexture () const
 
unsigned int texID () const
 Access to the OpenGL texture ID.
 
unsigned int target () const
 Returns the OpenGL texture target.
 
int format () const
 Returns the pixel format.
 
int internalFormat () const
 Returns the internal OpenGL texture format.
 
MemImagedownload (unsigned int type=0) const
 Downloads the image into memory.
 
void download (MemImage &img) const
 Downloads the image into memory.
 
Location location () const override
 Specifies that the image is an OpenGL texture object.
 
bool makeCompatible (GlImage **other, unsigned int type=0, bool use2D=false, int channels=-1) const
 Creates or updates another image instance to be compatible to this one.
 
bool makeCompatible (SharedImage **other, unsigned int type=0, bool use2D=false) const
 Same as above for a shared image instance.
 
- Public Member Functions inherited from Image
 Image (const ImageDescriptor &desc)
 Create a new Image with the given descriptor.
 
 Image (const Image &other)=default
 
Imageoperator= (const Image &other)=default
 
 Image (Image &&other) noexcept=default
 
Imageoperator= (Image &&other) noexcept=default
 
const ImageDescriptordescriptor () 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
 
Configurableoperator= (const Configurable &)
 
Configurableoperator= (Configurable &&) noexcept
 

Static Public Member Functions

static std::string presetToString (Preset p)
 Converts the given preset to a string representation, e.g. used during serialization.
 
static Preset stringToPreset (const std::string &s)
 Converts a string representation of a preset from presetToString() back to a Preset, e.g. used during deserialization.
 

Additional Inherited Members

- 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 GlImage
void init (int internalFormat, const void *data)
 Internal initialization of OpenGL texture.
 
bool update (const void *data, size_t N, int format, int type)
 Internal function to upload pixel data to the texture.
 
- Protected Member Functions inherited from Image
template<typename T>
bool typeCompatible () const
 
- Protected Attributes inherited from GlImage
std::unique_ptr< GL::Texturem_texture
 
int m_unit = 0
 Remembers the texture unit between bind and unbind.
 
int m_format = 0
 Original ImFusion image format (might be != OpenGL texture format)
 
- Protected Attributes inherited from Image
ImageDescriptor m_descriptor
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close