EleFits  4.0.1
A modern C++ API on top of CFitsIO

◆ writeRegion()

template<typename T , long m, long n>
void Euclid::Fits::ImageRaster::writeRegion ( FileMemRegions< n >  regions,
const Raster< T, m > &  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.writeRegion<3>({ 10, 20, 30 }, raster);
// Write the whole HDU with a region of the raster starting at (10, 20, 30)
du.writeRegion<3>({ Region<3>::whole(), { 10, 20, 30 } }, raster);

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.writeRegion<3>({ { 0, 0, 4 } }, raster.section(2));
Euclid::Fits::Region::whole
static Region< n > whole()
Create an unlimited region.
Definition: Region.h:51