MeshLib C++ Docs
Loading...
Searching...
No Matches

Classes

struct  MR::RasterInfo
 everything about a raster except its values More...
struct  MR::Raster
 regular grid of values of any type: an image if it has one layer, otherwise a volume More...
struct  MR::RasterLoadSettings
 settings for loading rasters from external formats More...
struct  MR::RasterSaveSettings
 settings for saving rasters in external formats More...

Functions

Expected< Image > MR::convertRasterToImage (const Raster &raster)
Expected< void > MR::convertRasterToFloats (const Raster &raster, float *dst, size_t size)
Expected< void > MR::convertRasterToFloats (const Raster &raster, std::vector< float > &dst)

Detailed Description

Function Documentation

◆ convertRasterToFloats() [1/2]

Expected< void > MR::convertRasterToFloats ( const Raster & raster,
float * dst,
size_t size )

#include <MRMesh/MRRaster.h>

converts the values of a raster to floats in dst, which has room for size = dims.x * dims.y * dims.z values, in the order of the raster:

  • one channel is taken as is;
  • three or more channels give the luma 0.299 R + 0.587 G + 0.114 B of the first three; fails for two channels, an unknown type, negative dimensions, data whose size does not match the dimensions, or another size

◆ convertRasterToFloats() [2/2]

Expected< void > MR::convertRasterToFloats ( const Raster & raster,
std::vector< float > & dst )

#include <MRMesh/MRRaster.h>

converts the values of a raster to floats as above, dst is resized to dims.x * dims.y * dims.z values (memory is reallocated only if its capacity is too small)

◆ convertRasterToImage()

Expected< Image > MR::convertRasterToImage ( const Raster & raster)

#include <MRMesh/MRRaster.h>

converts a raster with one layer to an image (the rows are reordered from bottom to top):

  • the values of one channel are scaled from the range of finite values to gray colors, NaN and infinite values become black;
  • three or more channels are RGB or RGBA colors (the channels after the fourth are ignored): integer values keep their high byte and are taken as unsigned ones, floating-point values are clamped to [0, 1], NaN becomes 0