Developer Application Interface (ARC API) v3.6.2
ARC, Inc. GenII/III Application Interface
arc::gen3::CArcFitsFile< T > Class Template Reference

#include <CArcFitsFile.h>

Inheritance diagram for arc::gen3::CArcFitsFile< T >:
arc::gen3::CArcBase

Public Member Functions

 CArcFitsFile (void)
 
virtual ~CArcFitsFile (void)
 
std::string getType (void) noexcept
 
void create (const std::filesystem::path &tFileName, const std::uint32_t uiCols, const std::uint32_t uiRows)
 
void create3D (const std::filesystem::path &tFileName, const std::uint32_t uiCols, const std::uint32_t uiRows)
 
void open (const std::filesystem::path &tFileName, arc::gen3::fits::e_ReadMode eMode=arc::gen3::fits::e_ReadMode::READMODE)
 
void close (void) noexcept
 
std::unique_ptr< arc::gen3::CArcStringListgetHeader (void)
 
const std::string getFileName (void)
 
arc::gen3::fits::keywordValue_t readKeyword (const std::string &sKey, arc::gen3::fits::e_Type eType)
 
void writeKeyword (const std::string &sKey, void *pValue, arc::gen3::fits::e_Type eType, const std::string &sComment="")
 
void updateKeyword (const std::string &sKey, void *pValue, arc::gen3::fits::e_Type eType, const std::string &sComment="")
 
std::unique_ptr< arc::gen3::fits::CParamgetParameters (void)
 
std::uint32_t getNumberOfFrames (void)
 
std::uint32_t getRows (void)
 
std::uint32_t getCols (void)
 
std::uint32_t getNAxis (void)
 
std::uint32_t getBitsPerPixel (void)
 
void generateTestData (void)
 
void reOpen (void)
 
void flush (void)
 
void compare (CArcFitsFile< T > &cFitsFile)
 
void reSize (const std::uint32_t uiCols, const std::uint32_t uiRows)
 
void write (T *pBuf)
 
void write (T *pBuf, const std::int64_t i64Bytes, const std::int64_t i64Pixel=1)
 
void writeSubImage (T *pBuf, const arc::gen3::fits::Point &lowerLeftPoint, const arc::gen3::fits::Point &upperRightPoint)
 
std::unique_ptr< T[], arc::gen3::fits::ArrayDeleter< T > > readSubImage (arc::gen3::fits::Point lowerLeftPoint, arc::gen3::fits::Point upperRightPoint)
 
std::unique_ptr< T[], arc::gen3::fits::ArrayDeleter< T > > read (void)
 
void read (T *pBuf, const std::uint32_t uiCols, const std::uint32_t uiRows)
 
void write3D (T *pBuf)
 
void reWrite3D (T *pBuf, const std::uint32_t uiImageNumber)
 
std::unique_ptr< T[], arc::gen3::fits::ArrayDeleter< T > > read3D (const std::uint32_t uiImageNumber)
 
fitsfilegetBaseFile (void)
 
std::uint32_t maxTVal (void)
 
- Public Member Functions inherited from arc::gen3::CArcBase
virtual ~CArcBase (void)
 

Static Public Member Functions

static const std::string version (void) noexcept
 
static const std::string cfitsioVersion (void) noexcept
 
- Static Public Member Functions inherited from arc::gen3::CArcBase
static const std::string version (void)
 
static void zeroMemory (void *pDest, const std::size_t uiSize)
 
static void copyMemory (void *pDest, void *pSrc, const std::size_t uiSize)
 
static void throwOutOfRange (const std::string &sMethodName, const std::int32_t iLine, const std::uint32_t uiElement, std::pair< std::uint32_t, std::uint32_t > range)
 
static void throwOutOfRange (const std::string &sMethodName, const std::int32_t iLine, const std::string &sElement, const std::size_t uiSize)
 
static void throwNoDeviceError (const std::string &sMethodName, const std::int32_t iLine, const std::string &sMsg="")
 
template<typename T = std::runtime_error>
static void throwException (const std::string &sMethodName, const std::int32_t iLine, const std::string &sMsg)
 
template<typename T = std::runtime_error>
static void throwException (const std::string &sMethodName, const std::int32_t iLine, const char *pszFmt,...)
 
template<typename ErrCode >
requires std::is_integral_v<ErrCode>
static const std::string getSystemMessage (ErrCode iCode)
 
static std::int32_t getSystemError (void) noexcept
 
static std::unique_ptr< CArcStringListsplitString (const std::string &sString, const char &zDelim=' ')
 
static std::string formatString (const char *pszFmt,...)
 
static std::string convertWideToAnsi (wchar_t wzString[]) noexcept
 
static std::string convertWideToAnsi (const std::wstring &wsString)
 
static std::wstring convertAnsiToWide (const char *pszString)
 
static std::string cmdToString (const std::uint32_t uiCmd)
 
static std::string cmdToString (const std::uint32_t uiReply, const std::initializer_list< std::uint32_t > &tCmdList)
 
static std::string setDots (std::string_view svText, const std::size_t uiMaxLength, const char szDot='.')
 
template<typename T >
static std::string iterToString (T *pBegin, T *pEnd, char zSeperator=' ')
 

Additional Inherited Members

- Protected Member Functions inherited from arc::gen3::CArcBase
 CArcBase (void)=default
 
 CArcBase (const CArcBase &)=delete
 
 CArcBase (CArcBase &&)=delete
 
CArcBaseoperator= (const CArcBase &)=delete
 
CArcBaseoperator= (CArcBase &&)=delete
 
- Static Protected Attributes inherited from arc::gen3::CArcBase
static const std::string m_sVersion
 

Detailed Description

template<typename T = arc::gen3::fits::BPP_16>
class arc::gen3::CArcFitsFile< T >

ARC FITS file interface class. Utilizes the cfitsio library for all actions.

See also
arc::gen3::CArcBase

Constructor & Destructor Documentation

◆ CArcFitsFile()

template<typename T >
arc::gen3::CArcFitsFile< T >::CArcFitsFile ( void  )

Constructor Creates an empty FITS file object.

◆ ~CArcFitsFile()

template<typename T >
arc::gen3::CArcFitsFile< T >::~CArcFitsFile ( void  )
virtual

Destructor

Member Function Documentation

◆ cfitsioVersion()

template<typename T >
const std::string arc::gen3::CArcFitsFile< T >::cfitsioVersion ( void  )
staticnoexcept

Returns a textual representation of the cfitsio library version.

Returns
A string representation of the cfitsio library version.

◆ close()

template<typename T >
void arc::gen3::CArcFitsFile< T >::close ( void  )
noexcept

Closes the file.

◆ compare()

template<typename T >
void arc::gen3::CArcFitsFile< T >::compare ( CArcFitsFile< T > &  cFitsFile)

Compares this file image data to another. This method does not check headers, except for size values.

Parameters
cFitsFile- A reference to another valid FITS file.

◆ create()

template<typename T >
void arc::gen3::CArcFitsFile< T >::create ( const std::filesystem::path &  tFileName,
const std::uint32_t  uiCols,
const std::uint32_t  uiRows 
)

Creates a new single image file on disk with the specified image dimensions.

Parameters
tFileName- The new FITS file name.
uiCols- The image column size ( in pixels ).
uiRows- The image row size ( in pixels ).
Exceptions
std::runtime_error
std::invalid_argument

◆ create3D()

template<typename T >
void arc::gen3::CArcFitsFile< T >::create3D ( const std::filesystem::path &  tFileName,
const std::uint32_t  uiCols,
const std::uint32_t  uiRows 
)

Creates a new data cube file on disk with the specified image dimensions.

Parameters
tFileName- The new FITS file name.
uiCols- The image column size ( in pixels ).
uiRows- The image row size ( in pixels ).
Exceptions
std::runtime_error
std::invalid_argument

◆ flush()

template<typename T >
void arc::gen3::CArcFitsFile< T >::flush ( void  )

Causes all internal data buffers to write data to the disk file.

Exceptions
std::runtime_erroron error.

◆ generateTestData()

template<typename T >
void arc::gen3::CArcFitsFile< T >::generateTestData ( void  )

Generates a ramp test pattern image within the file. The size of the image is determined by the image dimensions supplied during the create() method call. This method is only valid for single image files.

Exceptions
std::runtime_erroron error.

◆ getBaseFile()

template<typename T >
fitsfile * arc::gen3::CArcFitsFile< T >::getBaseFile ( void  )

Returns the underlying cfitsio file pointer.

Returns
A pointer to the internal cfitsio file pointer ( may be nullptr ).

◆ getBitsPerPixel()

template<typename T >
std::uint32_t arc::gen3::CArcFitsFile< T >::getBitsPerPixel ( void  )

Returns the image bits-per-pixel value.

Returns
The image bits-per-pixel value.
Exceptions
std::runtime_erroron error.

◆ getCols()

template<typename T >
std::uint32_t arc::gen3::CArcFitsFile< T >::getCols ( void  )

Returns the number of columns in the image.

Returns
The number of columns in the image.
Exceptions
std::runtime_erroron error.

◆ getFileName()

template<typename T >
const std::string arc::gen3::CArcFitsFile< T >::getFileName ( void  )

Returns the file name.

Returns
The FITS filename associated with this object.
Exceptions
std::runtime_erroron error.

◆ getHeader()

template<typename T >
std::unique_ptr< arc::gen3::CArcStringList > arc::gen3::CArcFitsFile< T >::getHeader ( void  )

Returns the FITS header as a list of strings.

See also
arc::gen3::CArcStringList
std::unique_ptr
Returns
A std::unique_ptr to a arc::gen3::CArcStringList.
Exceptions
std::runtime_erroron error.

◆ getNAxis()

template<typename T >
std::uint32_t arc::gen3::CArcFitsFile< T >::getNAxis ( void  )

Returns the number of dimensions in the image.

Returns
The number of dimensions in the image.
Exceptions
std::runtime_erroron error.

◆ getNumberOfFrames()

template<typename T >
std::uint32_t arc::gen3::CArcFitsFile< T >::getNumberOfFrames ( void  )

Returns the number of frames. A single image file will return a value of 0.

Returns
The number of frames.
Exceptions
std::runtime_erroron error.

◆ getParameters()

template<typename T >
std::unique_ptr< arc::gen3::fits::CParam > arc::gen3::CArcFitsFile< T >::getParameters ( void  )

Returns the basic image parameters ( number of cols, rows, frames, dimensions and bits-per-pixel ).

Returns
Pointer to an arc::gen3::fits::CParam class that contains all the image parameters. May return nullptr.
Exceptions
std::runtime_erroron error.

◆ getRows()

template<typename T >
std::uint32_t arc::gen3::CArcFitsFile< T >::getRows ( void  )

Returns the number of rows in the image.

Returns
The number of rows in the image.
Exceptions
std::runtime_erroron error.

◆ getType()

template<typename T >
std::string arc::gen3::CArcFitsFile< T >::getType ( void  )
noexcept

Returns the class bits-per-pixel typename.

Returns
The class bits-per-pixel typename.

◆ maxTVal()

template<typename T >
std::uint32_t arc::gen3::CArcFitsFile< T >::maxTVal ( void  )

Determines the maximum value for a specific data type. Example, for std::uint16_t: 2^16 = 65536.

Returns
The maximum value for the data type currently in use.

◆ open()

template<typename T >
void arc::gen3::CArcFitsFile< T >::open ( const std::filesystem::path &  tFileName,
arc::gen3::fits::e_ReadMode  eMode = arc::gen3::fits::e_ReadMode::READMODE 
)

Opens an existing file. Can be used to open a file containing a single image or data cube ( a file with multiple image planes ).

Parameters
tFileName- The file name.
eMode- The mode with which to open the file ( default = e_ReadMode::READMODE ).
Exceptions
std::runtime_error
std::invalid_argument

◆ read() [1/2]

template<typename T >
void arc::gen3::CArcFitsFile< T >::read ( T *  pBuf,
const std::uint32_t  uiCols,
const std::uint32_t  uiRows 
)

Read the image from a single image file into the specified user buffer.

Parameters
pBuf- The user supplied buffer.
uiCols- The buffer column length ( in pixels ).
uiRows- The buffer row length ( in pixels ).
Exceptions
std::runtime_error
std::invalid_argument
std::length_error

◆ read() [2/2]

template<typename T >
std::unique_ptr< T[], arc::gen3::fits::ArrayDeleter< T > > arc::gen3::CArcFitsFile< T >::read ( void  )

Read the image from a single image file.

Returns
A pointer to the image data.
Exceptions
std::runtime_error
std::invalid_argument

◆ read3D()

template<typename T >
std::unique_ptr< T[], arc::gen3::fits::ArrayDeleter< T > > arc::gen3::CArcFitsFile< T >::read3D ( const std::uint32_t  uiImageNumber)

Reads an image from a data cube file.

Parameters
uiImageNumber- The image number.
Returns
A pointer to the image data.
Exceptions
std::runtime_error
std::invalid_argument

◆ readKeyword()

template<typename T >
arc::gen3::fits::keywordValue_t arc::gen3::CArcFitsFile< T >::readKeyword ( const std::string &  sKey,
arc::gen3::fits::e_Type  eType 
)

Reads a keyword value from the header.

Parameters
sKey- A valid FITS keyword.
eType- The keyword value type.
Exceptions
std::runtime_error
std::invalid_argument

◆ readSubImage()

template<typename T >
std::unique_ptr< T[], arc::gen3::fits::ArrayDeleter< T > > arc::gen3::CArcFitsFile< T >::readSubImage ( arc::gen3::fits::Point  lowerLeftPoint,
arc::gen3::fits::Point  upperRightPoint 
)

Reads a sub-image from a single image file.

Parameters
lowerLeftPoint- The lower left point { col, row } of the sub-image.
upperRightPoint- The upper right point { col, row } of the sub-image.
Returns
A pointer to the sub-image data.
Exceptions
std::runtime_error
std::invalid_argument

◆ reOpen()

template<typename T >
void arc::gen3::CArcFitsFile< T >::reOpen ( void  )

Effectively closes and re-opens the underlying disk file.

Exceptions
std::runtime_erroron error.

◆ reSize()

template<typename T >
void arc::gen3::CArcFitsFile< T >::reSize ( const std::uint32_t  uiCols,
const std::uint32_t  uiRows 
)

Resizes a single image file by modifying the NAXES keyword and increasing the image data portion of the file.

Parameters
uiCols- The number of cols the new FITS file will have.
uiRows- The number of rows the new FITS file will have.
Exceptions
std::runtime_error
std::invalid_argument

◆ reWrite3D()

template<typename T >
void arc::gen3::CArcFitsFile< T >::reWrite3D ( T *  pBuf,
const std::uint32_t  uiImageNumber 
)

Re-writes an existing image in a data cube file. The image data MUST match in size to the exising images within the data cube.

Parameters
pBuf- The image buffer. Buffer access violation results in undefined behavior.
uiImageNumber- The number of the data cube image to replace.
Exceptions
std::runtime_error
std::invalid_argument

◆ updateKeyword()

template<typename T >
void arc::gen3::CArcFitsFile< T >::updateKeyword ( const std::string &  sKey,
void *  pValue,
arc::gen3::fits::e_Type  eType,
const std::string &  sComment = "" 
)

Updates an existng header keyword.

'HIERARCH' keyword NOTE: This text will be prefixed to any keyword by the cfitsio library if the keyword is greater than 8 characters, which is the standard FITS keyword length. See the link below for details:

http://heasarc.gsfc.nasa.gov/docs/software/fitsio/c/f_user/node28.html

Parameters
sKey- A valid FITS keyword.
pValue- A pointer to the keyword value. The value type is determined by the eType parameter. Must not equal nullptr.
eType- The keyword value type.
sComment- The optional header comment ( default = " " ).
Exceptions
std::runtime_error
std::invalid_argument

◆ version()

template<typename T >
const std::string arc::gen3::CArcFitsFile< T >::version ( void  )
staticnoexcept

Returns a textual representation of the library version.

Returns
A string representation of the library version.

◆ write() [1/2]

template<typename T >
void arc::gen3::CArcFitsFile< T >::write ( T *  pBuf)

Writes image data to a single image file.

Parameters
pBuf- The image buffer to write. Buffer access violation results in undefined behavior.
Exceptions
std::runtime_error
std::invalid_argument

◆ write() [2/2]

template<typename T >
void arc::gen3::CArcFitsFile< T >::write ( T *  pBuf,
const std::int64_t  i64Bytes,
const std::int64_t  i64Pixel = 1 
)

Writes the specified number of bytes to a single image file. The start position of the data within the file image can be specified.

Parameters
pBuf- The image buffer to write. Buffer access violation results in undefined behavior.
i64Bytes- The number of bytes to write.
i64Pixel- The start pixel within the file image. ( default = 1 ).
Exceptions
std::runtime_error
std::invalid_argument

◆ write3D()

template<typename T >
void arc::gen3::CArcFitsFile< T >::write3D ( T *  pBuf)

Writes an image to the end of a data cube file.

Parameters
pBuf- The image buffer to write. Buffer access violation results in undefined behavior.
Exceptions
std::runtime_error
std::invalid_argument

◆ writeKeyword()

template<typename T >
void arc::gen3::CArcFitsFile< T >::writeKeyword ( const std::string &  sKey,
void *  pValue,
arc::gen3::fits::e_Type  eType,
const std::string &  sComment = "" 
)

Writes a new keyword to the header.

'HIERARCH' keyword NOTE: This text will be prefixed to any keyword by the cfitsio library if the keyword is greater than 8 characters, which is the standard FITS keyword length. See the link below for details:

http://heasarc.gsfc.nasa.gov/docs/software/fitsio/c/f_user/node28.html

Parameters
sKey- A valid FITS keyword.
pValue- A pointer to the keyword value. The value type is determined by the eType parameter. Cannot equal nullptr.
eType- The keyword value type.
sComment- The optional header comment ( default = " " ).
Exceptions
std::runtime_error
std::invalid_argument

◆ writeSubImage()

template<typename T >
void arc::gen3::CArcFitsFile< T >::writeSubImage ( T *  pBuf,
const arc::gen3::fits::Point lowerLeftPoint,
const arc::gen3::fits::Point upperRightPoint 
)

Writes a sub-image of the specified buffer to a single image file.

Parameters
pBuf- The image buffer to write. Buffer access violation results in undefined behavior.
lowerLeftPoint- The lower left point { col, row } of the sub-image.
upperRightPoint- The upper right point { col, row } of the sub-image.
Exceptions
std::runtime_error
std::invalid_argument

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