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

◆ write_region()

void write_region ( FileMemRegions< N >  regions,
const TRaster &  raster 
) const

Write a Raster at a given position of the data unit.

Parameters
regionsThe in-file and in-memory regions
rasterThe raster to be written

In-file and in-memory (raster) regions are specified as the first parameter. Max bounds (-1) can be used in one, several, or all axes. Shortcuts offered by FileMemRegions and Region can be used to implement special cases:

// Write the whole raster at position (10, 20, 30)
du.write_region<3>({10, 20, 30}, raster);
// Write the whole HDU with a region of the raster starting at (10, 20, 30)
du.write_region<3>({Region<3>::whole(), {10, 20, 30}}, raster);
static Region< N > whole()
Create an unlimited region.
Definition: Region.h:36

Note that the raster dimension can be lower than the HDU dimension. For example, it is possible to write a 2D raster in a 3D HDU.

// Write the 3rd plane of raster into the 5th plane of the HDU
du.write_region<3>({{0, 0, 4}}, raster.section(2));