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

◆ read_region_to()

void read_region_to ( FileMemRegions< TRaster::Dim >  regions,
TRaster &  raster 
) const

Read a region of the data unit into a region of an existing Raster.

Template Parameters
TThe desired raster type
MThe desired raster dimension, which can be smaller than the data dimension in file
NThe region dimension, which corresponds to the data dimension in file
Parameters
regionThe in-file region
regionsThe in-file and in-memory regions
rasterThe destination raster

There are several options to read a region of the data unit:

  • as a new VecRaster object;
  • by filling an existing Raster object;
  • by filling an existing Subraster object. In the last two cases, the in-file and in-memory regions are given as a FileMemRegions object.

For example, to read the HDU region from position (50, 80) to position (100, 120) into an existing raster at position (25, 40), do:

const FileMemRegions<2> regions({25, 40}, {{50, 80}, {100, 120}});
image.read_region_to(regions, raster);
Mapping between an in-file (FITS image data unit) region and an in-memory (raster) region for reading...
Definition: FileMemRegions.h:22

where image is the ImageRaster and raster is the Raster.

In simpler cases, where the in-file or in-memory front position is 0, factories can be used, e.g. to read into position 0 of the raster:

image.read_region_to<2>({{50, 80}, {100, 120}}, raster);