ddt 1.1.0
Loading...
Searching...
No Matches
Protected Attributes | List of all members
ddt::DataFile Class Reference

#include <dataFile.hpp>

Protected Attributes

ddt::DdtLoggerlogger
 
 DataFile ()
 
virtual ~DataFile ()
 
void set_logger (ddt::DdtLogger *logger)
 
bool OpenFile (const std::string &filename, const int position=0)
 
cpl_vector * OpenAndLoadVector (const std::string &file_name, const int position=0)
 
cpl_image * OpenAndLoadImage (const std::string &file_name, const int position=0)
 
cpl_image * OpenAndLoadCube (const std::string &file_name, const int plane_number=0, const int position=0)
 
cpl_vector * LoadVector ()
 
cpl_image * LoadImage (const int plane_number=0)
 
cpl_table * LoadBinaryTable (const int extension_number)
 
cpl_propertylist * LoadPropertyList ()
 
cpl_wcs * LoadWCS ()
 
cpl_image * LoadImageExtensionsAsOne (const int plane_number=0)
 
int get_FilePosition () const
 
std::string get_FileName () const
 
int get_NumberAxis () const
 
int get_NumberPlanes () const
 
int get_NumberExtensions () const
 
int get_ImageWidth () const
 
int get_ImageHeight () const
 
bool get_IsVector () const
 
bool get_IsImage () const
 
bool get_IsCube () const
 
bool get_IsBintable () const
 
FitsExtensionget_FitsExtensionInfo (const int extension_number)
 
FitsExtension get_PrimaryHDUInfo () const
 
std::vector< int > get_invalid_image_hdus () const
 

Detailed Description

Class to wrap the usage of FITS file functions.

This class offers access to FITS files, using functions from the CPL library. The files are opened and the properties are read. According to the contained data (number of axis), various functions are available to load the 1D, 2D or 3D data.

Constructor & Destructor Documentation

◆ DataFile()

DataFile::DataFile ( )

Constructor

◆ ~DataFile()

DataFile::~DataFile ( )
virtualdefault

Destructor

Member Function Documentation

◆ get_FileName()

std::string DataFile::get_FileName ( ) const

Get the current file name

Returns
the current file name

◆ get_FilePosition()

int DataFile::get_FilePosition ( ) const

Get the current file position (extension; number of HDU opened (0: first))

Returns
the current file position

◆ get_FitsExtensionInfo()

FitsExtension * DataFile::get_FitsExtensionInfo ( const int  extension_number)

Get the information about one file extension

Parameters
extension_numberthe extension number
Returns
the FitsExtension object corresponding to the extension number, or nullptr if no such object is available

◆ get_ImageHeight()

int DataFile::get_ImageHeight ( ) const

Get the image height (number of y pixels)

Returns
the image height

◆ get_ImageWidth()

int DataFile::get_ImageWidth ( ) const

Get the image width (number of x pixels)

Returns
the image width

◆ get_invalid_image_hdus()

std::vector< int > DataFile::get_invalid_image_hdus ( ) const

Get the information about invalid image HDUs

Returns
Vector of invalid HDUs

◆ get_IsBintable()

bool DataFile::get_IsBintable ( ) const

Get the flag indicating if the image contains a binary table

Returns
the bintable flag

Get the flag indicating if the image contains a binary table

Returns
the binary table flag

◆ get_IsCube()

bool DataFile::get_IsCube ( ) const

Get the flag indicating if the image contains cube data

Returns
the cube flag

◆ get_IsImage()

bool DataFile::get_IsImage ( ) const

Get the flag indicating if the image contains image data

Returns
the image flag

◆ get_IsVector()

bool DataFile::get_IsVector ( ) const

Get the flag indicating if the image contains vector data

Returns
the vector flag

◆ get_NumberAxis()

int DataFile::get_NumberAxis ( ) const

Get the number of axis (vector data: 1, image data: 2, cube data: 3)

Returns
the number of axis

◆ get_NumberExtensions()

int DataFile::get_NumberExtensions ( ) const

Get the number of extensions contained in the image

Returns
the number of extensions

Get the number of extensions

Returns
the number of extensions

◆ get_NumberPlanes()

int DataFile::get_NumberPlanes ( ) const

Get the number of planes (relevant only for a 3D image)

Returns
the number of planes

◆ get_PrimaryHDUInfo()

FitsExtension DataFile::get_PrimaryHDUInfo ( ) const

Get the information about the primary HDU

Returns
the FitsExtension object corresponding to the primary HDU

◆ LoadBinaryTable()

cpl_table * DataFile::LoadBinaryTable ( const int  extension_number)

Load a binary table as cpl_table from one of the image extensions. Note that the file has to be opened before using OpenFile() function, but not necessarily with the desired extension.

Parameters
extension_numberthe extension number
Returns
a cpl_table object, or NULL on error

◆ LoadImage()

cpl_image * DataFile::LoadImage ( const int  plane_number = 0)

Load image data. Note that the file has to be opened before using OpenFile() function.

Parameters
plane_numbernumber of plane to load. This defaults to 0 (the only option for 2D images), which means the first plane.
Returns
a cpl_image object, or NULL on error

◆ LoadImageExtensionsAsOne()

cpl_image * DataFile::LoadImageExtensionsAsOne ( const int  plane_number = 0)

Load image data extensions into one cpl_image. Note that the file has to be opened before using OpenFile() function.

Parameters
plane_numbernumber of plane to load. This defaults to 0 (the only option for 2D images), which means the first plane.
Returns
a cpl_image object, or NULL on error

◆ LoadPropertyList()

cpl_propertylist * DataFile::LoadPropertyList ( )

Load the CPL property list from the file. The returned object must be destroyed using cpl_propertylist_delete().

Returns
the cpl_propertylist object, or NULL on error

◆ LoadVector()

cpl_vector * DataFile::LoadVector ( )

Load vector data. Note that the file has to be opened before using OpenFile() function.

Returns
a cpl_vector object, or NULL on error

◆ LoadWCS()

cpl_wcs * DataFile::LoadWCS ( )

Load the CPL WCS object from the file's property list. The returned object must be destroyed using cpl_wcs_delete().

Returns
the cpl_wcs object, or NULL on error

◆ OpenAndLoadCube()

cpl_image * DataFile::OpenAndLoadCube ( const std::string &  file_name,
const int  plane_number = 0,
const int  position = 0 
)

Open file and load image data. This function takes a CPL file (FITS) name and a position. The position indicates the HDU to use. The default HDU is the first (position 0). The function first opens the file and checks the image properties. If the file contains cube data (number of axis = 3), the image data of the specified plane is loaded.

Parameters
file_name
plane_numbernumber of plane to load. This defaults to 0, meaning the first plane.
positionthe position indicating the HDU to use. This defaults to 0 (the first HDU).
Returns
a cpl image object, or NULL on error (file not existing, no image data)

◆ OpenAndLoadImage()

cpl_image * DataFile::OpenAndLoadImage ( const std::string &  file_name,
const int  position = 0 
)

Open file and load image data. This function takes a CPL file (FITS) name and a position. The position indicates the HDU to use. The default HDU is the first (position 0). The function first opens the file and checks the image properties. If the file contains image data (number of axis = 2), the image data is loaded.

Parameters
file_name
positionthe position indicating the HDU to use. This defaults to 0 (the first HDU).
Returns
a cpl image object, or NULL on error (file not existing, no image data)

◆ OpenAndLoadVector()

cpl_vector * DataFile::OpenAndLoadVector ( const std::string &  file_name,
const int  position = 0 
)

Open file and load vector data. This function takes a CPL file (FITS) name and a position. The position indicates the HDU to use. The default HDU is the first (position 0). The function first opens the file and checks the image properties. If the file contains vector data (number of axis = 1), the vector data is loaded.

Parameters
file_name
positionthe position indicating the HDU to use. This defaults to 0 (the first HDU).
Returns
a cpl vector object, or NULL on error (file not existing, no vector data)

◆ OpenFile()

bool DataFile::OpenFile ( const std::string &  filename,
const int  position = 0 
)

Open file. This function takes a CPL file (FITS) name and a position. The position indicates the HDU to use. The default HDU is the first (position 0). The function reads the property list of the file and checks the number of axis in the file and the image dimensions. This information can be retrieved by the corresponding functions in order to load the image rsp. vector data.

Parameters
filenamethe FITS file name to load
positionthe position indicating the HDU to use. This defaults to 0 (the first HDU).
Returns
true if opening was successful, false otherwise

◆ set_logger()

void DataFile::set_logger ( ddt::DdtLogger logger)

Set logger

Parameters
loggerA DDT logger object (no transfer of ownership).

Member Data Documentation

◆ logger

ddt::DdtLogger* ddt::DataFile::logger
protected

The logger object


The documentation for this class was generated from the following files: