SourceXtractorPlusPlus  0.13
Please provide a description of the project.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SourceXtractor::FitsImageSource Class Reference

#include <FitsImageSource.h>

Inheritance diagram for SourceXtractor::FitsImageSource:
[legend]
Collaboration diagram for SourceXtractor::FitsImageSource:
[legend]

Public Member Functions

 FitsImageSource (const std::string &filename, int hdu_number=0, ImageTile::ImageType image_type=ImageTile::AutoType, std::shared_ptr< FitsFileManager > manager=FitsFileManager::getInstance())
 
 FitsImageSource (const std::string &filename, int width, int height, ImageTile::ImageType image_type, const std::shared_ptr< CoordinateSystem > coord_system=nullptr, bool append=false, std::shared_ptr< FitsFileManager > manager=FitsFileManager::getInstance())
 
virtual ~FitsImageSource ()=default
 
std::string getRepr () const override
 Human readable representation of this source. More...
 
int getWidth () const override
 Returns the width of the image in pixels. More...
 
int getHeight () const override
 Returns the height of the image in pixels. More...
 
std::shared_ptr< ImageTilegetImageTile (int x, int y, int width, int height) const override
 
void saveTile (ImageTile &tile) override
 
template<typename TT >
bool readFitsKeyword (const std::string &header_keyword, TT &out_value) const
 
int getHDU () const
 
ImageTile::ImageType getType () const override
 
std::unique_ptr< std::vector< char > > getFitsHeaders (int &number_of_records) const
 
const std::map< std::string, MetadataEntrygetMetadata () const override
 
void setMetadata (std::string key, MetadataEntry value) override
 
- Public Member Functions inherited from SourceXtractor::ImageSource
 ImageSource ()
 
virtual ~ImageSource ()=default
 
- Public Member Functions inherited from std::enable_shared_from_this< ImageSource >
enable_shared_from_this (T... args)
 
operator= (T... args)
 
shared_from_this (T... args)
 
~enable_shared_from_this (T... args)
 

Private Member Functions

void switchHdu (fitsfile *fptr, int hdu_number) const
 
int getDataType () const
 
int getImageType () const
 

Private Attributes

std::string m_filename
 
std::shared_ptr< FitsFilem_fits_file
 
std::shared_ptr< FitsFileManagerm_manager
 
int m_hdu_number
 
int m_width
 
int m_height
 
ImageTile::ImageType m_image_type
 

Detailed Description

Definition at line 42 of file FitsImageSource.h.

Constructor & Destructor Documentation

◆ FitsImageSource() [1/2]

SourceXtractor::FitsImageSource::FitsImageSource ( const std::string filename,
int  hdu_number = 0,
ImageTile::ImageType  image_type = ImageTile::AutoType,
std::shared_ptr< FitsFileManager manager = FitsFileManager::getInstance() 
)

Constructor

Parameters
filenamePath to the FITS file
hdu_numberHDU number. If <= 0, the constructor will use the first HDU containing an image
manager

Definition at line 47 of file FitsImageSource.cpp.

References SourceXtractor::ImageTile::DoubleImage, conf::filename, SourceXtractor::ImageTile::FloatImage, SourceXtractor::ImageTile::IntImage, SourceXtractor::ImageTile::LongLongImage, m_fits_file, m_hdu_number, m_height, m_image_type, m_manager, m_width, switchHdu(), and SourceXtractor::ImageTile::UIntImage.

Here is the call graph for this function:

◆ FitsImageSource() [2/2]

SourceXtractor::FitsImageSource::FitsImageSource ( const std::string filename,
int  width,
int  height,
ImageTile::ImageType  image_type,
const std::shared_ptr< CoordinateSystem coord_system = nullptr,
bool  append = false,
std::shared_ptr< FitsFileManager manager = FitsFileManager::getInstance() 
)

Definition at line 99 of file FitsImageSource.cpp.

References conf::filename, getDataType(), getImageType(), SourceXtractor::ImageTile::getTypeSize(), std::left(), m_fits_file, m_hdu_number, m_manager, std::setw(), std::ostringstream::str(), and switchHdu().

Here is the call graph for this function:

◆ ~FitsImageSource()

virtual SourceXtractor::FitsImageSource::~FitsImageSource ( )
virtualdefault

Member Function Documentation

◆ getDataType()

int SourceXtractor::FitsImageSource::getDataType ( ) const
private

◆ getFitsHeaders()

std::unique_ptr< std::vector< char > > SourceXtractor::FitsImageSource::getFitsHeaders ( int &  number_of_records) const

Definition at line 230 of file FitsImageSource.cpp.

References std::string::begin(), std::string::end(), getMetadata(), and std::string::size().

Referenced by SourceXtractor::WCS::WCS().

Here is the call graph for this function:

◆ getHDU()

int SourceXtractor::FitsImageSource::getHDU ( ) const
inline

Definition at line 92 of file FitsImageSource.h.

References m_hdu_number.

◆ getHeight()

int SourceXtractor::FitsImageSource::getHeight ( ) const
inlineoverridevirtual

Returns the height of the image in pixels.

Implements SourceXtractor::ImageSource.

Definition at line 73 of file FitsImageSource.h.

References m_height.

◆ getImageTile()

std::shared_ptr< ImageTile > SourceXtractor::FitsImageSource::getImageTile ( int  x,
int  y,
int  width,
int  height 
) const
overridevirtual

Implements SourceXtractor::ImageSource.

Definition at line 174 of file FitsImageSource.cpp.

References SourceXtractor::ImageTile::create(), getDataType(), m_fits_file, m_hdu_number, m_image_type, std::enable_shared_from_this< ImageSource >::shared_from_this(), switchHdu(), x, and y.

Here is the call graph for this function:

◆ getImageType()

int SourceXtractor::FitsImageSource::getImageType ( ) const
private

◆ getMetadata()

const std::map<std::string, MetadataEntry> SourceXtractor::FitsImageSource::getMetadata ( ) const
inlineoverridevirtual
Returns
A copy of the metadata set

Reimplemented from SourceXtractor::ImageSource.

Definition at line 102 of file FitsImageSource.h.

References m_fits_file, and m_hdu_number.

Referenced by getFitsHeaders(), and readFitsKeyword().

◆ getRepr()

std::string SourceXtractor::FitsImageSource::getRepr ( ) const
inlineoverridevirtual

Human readable representation of this source.

Implements SourceXtractor::ImageSource.

Definition at line 63 of file FitsImageSource.h.

References m_filename.

◆ getType()

ImageTile::ImageType SourceXtractor::FitsImageSource::getType ( ) const
inlineoverridevirtual

Implements SourceXtractor::ImageSource.

Definition at line 96 of file FitsImageSource.h.

References m_image_type.

◆ getWidth()

int SourceXtractor::FitsImageSource::getWidth ( ) const
inlineoverridevirtual

Returns the width of the image in pixels.

Implements SourceXtractor::ImageSource.

Definition at line 68 of file FitsImageSource.h.

References m_width.

◆ readFitsKeyword()

template<typename TT >
bool SourceXtractor::FitsImageSource::readFitsKeyword ( const std::string header_keyword,
TT &  out_value 
) const
inline

Definition at line 82 of file FitsImageSource.h.

References getMetadata().

Here is the call graph for this function:

◆ saveTile()

void SourceXtractor::FitsImageSource::saveTile ( ImageTile tile)
overridevirtual

Implements SourceXtractor::ImageSource.

Definition at line 195 of file FitsImageSource.cpp.

References SourceXtractor::ImageTile::getDataPtr(), getDataType(), SourceXtractor::ImageTile::getHeight(), SourceXtractor::ImageTile::getPosX(), SourceXtractor::ImageTile::getPosY(), SourceXtractor::ImageTile::getWidth(), m_fits_file, m_hdu_number, switchHdu(), x, and y.

Here is the call graph for this function:

◆ setMetadata()

void SourceXtractor::FitsImageSource::setMetadata ( std::string  key,
MetadataEntry  value 
)
overridevirtual

Reimplemented from SourceXtractor::ImageSource.

Definition at line 274 of file FitsImageSource.cpp.

References std::left(), m_fits_file, m_hdu_number, SourceXtractor::MetadataEntry::m_value, std::setw(), std::ostringstream::str(), and switchHdu().

Here is the call graph for this function:

◆ switchHdu()

void SourceXtractor::FitsImageSource::switchHdu ( fitsfile *  fptr,
int  hdu_number 
) const
private

Definition at line 214 of file FitsImageSource.cpp.

References m_filename.

Referenced by FitsImageSource(), getImageTile(), saveTile(), and setMetadata().

Member Data Documentation

◆ m_filename

std::string SourceXtractor::FitsImageSource::m_filename
private

Definition at line 114 of file FitsImageSource.h.

Referenced by getRepr(), and switchHdu().

◆ m_fits_file

std::shared_ptr<FitsFile> SourceXtractor::FitsImageSource::m_fits_file
private

Definition at line 115 of file FitsImageSource.h.

Referenced by FitsImageSource(), getImageTile(), getMetadata(), saveTile(), and setMetadata().

◆ m_hdu_number

int SourceXtractor::FitsImageSource::m_hdu_number
private

◆ m_height

int SourceXtractor::FitsImageSource::m_height
private

Definition at line 121 of file FitsImageSource.h.

Referenced by FitsImageSource(), and getHeight().

◆ m_image_type

ImageTile::ImageType SourceXtractor::FitsImageSource::m_image_type
private

Definition at line 122 of file FitsImageSource.h.

Referenced by FitsImageSource(), getDataType(), getImageTile(), getImageType(), and getType().

◆ m_manager

std::shared_ptr<FitsFileManager> SourceXtractor::FitsImageSource::m_manager
private

Definition at line 116 of file FitsImageSource.h.

Referenced by FitsImageSource().

◆ m_width

int SourceXtractor::FitsImageSource::m_width
private

Definition at line 120 of file FitsImageSource.h.

Referenced by FitsImageSource(), and getWidth().


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