EleFits  5.3.1
A modern C++ API on top of CFITSIO
Loading...
Searching...
No Matches

◆ makeRaster() [2/2]

Raster< typename TContainer::value_type, sizeof...(Longs), DataContainerHolder< typename TContainer::value_type, TContainer > > makeRaster ( TContainer &&  data,
Longs...  shape 
)
related

Shortcut to create a raster from a shape and data without specifying the template parameters.

Template Parameters
TThe pixel type, should not be specified (automatically deduced)
LongsThe axes lengths, should not be specified (automatically deduced)
Parameters
dataThe raster values, which can be either a pointer (or C array) or a vector
shapeThe shape as a comma-separated list of longs
Example
Given:
- long width, height, depth: The axes lengths;
- float* ptr: The pixel values as a pointer;
- std::vector<float> vec: The pixel values as a vector;
auto ptrRaster2D = makeRaster(ptr, width, height);
auto ptrRaster3D = makeRaster(ptr, width, height, depth);
auto vecRaster2D = makeRaster(vec, width, height); // The vector is copied
auto vecRaster3D = makeRaster(std::move(vec), width, height, depth); // The vector is moved
Raster< typename TContainer::value_type, sizeof...(Longs), DataContainerHolder< typename TContainer::value_type, TContainer > > makeRaster(TContainer &&data, Longs... shape)
Shortcut to create a raster from a shape and data without specifying the template parameters.
Definition: Raster.h:382
T move(T... args)