ifw-odp 5.0.0
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
ifw::odp::ImageCube Class Reference

This class is C++ wrapper for a CPL image list object. It provides a simplified interface that allows to call CPL routines from INS applications. Normally a image list can be used to handle FITS cubes. When a FITS cube is loaded, each plane of the FITS cube will be an element of the image list. The total number of planes can be obtained with the method GetSize(). More...

#include <imageCube.hpp>

Inheritance diagram for ifw::odp::ImageCube:
ifw::odp::Error

Public Member Functions

 ImageCube ()
 Class constructor.
 
 ImageCube (const ImageCube &cube)
 Copy constructor.
 
virtual ~ImageCube ()
 Class destructor.
 
constexpr cpl_size GetSize () const
 Get image list size.
 
bool Status () const
 Get image status.
 
constexpr bool IsImageList () const
 Check is CPL image list is valid.
 
cpl_imagelist * GetCplImageList () const
 Get CPL image list.
 
void SetCplImageList (cpl_imagelist *imageList)
 Set CPL image list.
 
virtual void Save (const std::string filename, cpl_type_bpp type_bpp=CPL_BPP_IEEE_FLOAT, unsigned mode=CPL_IO_DEFAULT)
 Save CPL image list into a FITS file (cube).
 
virtual void Load (const std::string filename, const cpl_size extension=0, cpl_type type=CPL_TYPE_FLOAT)
 Load CPL image from a FITS file.
 
virtual void Load (const std::string filename, const cpl_size llx, const cpl_size lly, const cpl_size urx, const cpl_size ury, const cpl_size extension=0, cpl_type type=CPL_TYPE_FLOAT)
 Load CPL image from a FITS file subwindow.
 
virtual void Unload ()
 Release CPL image list.
 
void * Get (const cpl_size pos)
 Get an image from the image list at a given position.
 
void Get (const cpl_size pos, Image *img)
 Get an image from the image list at a given position.
 
void Set (const Image *img, const cpl_size pos)
 Insert an image into the image list at a given position.
 
void Push (Image *img)
 Insert an image into the image list at the end position.
 
void Pop ()
 Remove the last image from the list.
 
void Remove (const cpl_size pos)
 Remove an image from the list at specified location.
 
void Retrieve (const cpl_size pos, Image *img)
 Get an image from the list at specified location.
 
bool IsUniform () const
 Determine if an image list, eg. FITS cube is uniform.
 
- Public Member Functions inherited from ifw::odp::Error
 Error ()
 Class constructor.
 
virtual ~Error ()
 Class destructor.
 
void ResetCplError ()
 Reset CPL error and internal error flag.
 
bool CheckCplError () const
 Check if there is an error in CPL.
 

Protected Attributes

cpl_type m_cpl_type
 
cpl_imagelist * m_cpl_imageList
 

Additional Inherited Members

- Protected Member Functions inherited from ifw::odp::Error
std::string GetErrorMsg () const
 Get CPL error message.
 

Detailed Description

This class is C++ wrapper for a CPL image list object. It provides a simplified interface that allows to call CPL routines from INS applications. Normally a image list can be used to handle FITS cubes. When a FITS cube is loaded, each plane of the FITS cube will be an element of the image list. The total number of planes can be obtained with the method GetSize().

ImageCube - CPL image list wrapper class

Attention
Methods Get() and Set() do copy the elements from or into the list so memory might be a problem for large list of big images .
See also
CPL Reference: http://www.eso.org/observing/cpl/reference_3.0/ or above

Constructor & Destructor Documentation

◆ ImageCube() [1/2]

ifw::odp::ImageCube::ImageCube ( )

Class constructor.

Returns
none

◆ ImageCube() [2/2]

ifw::odp::ImageCube::ImageCube ( const ImageCube & cube)
explicit

Copy constructor.

Parameters
[in]cubeimage list to be copied.
Returns
none

CPL image list is duplicated

See also
CPL function: cpl_imagelist_duplicate

◆ ~ImageCube()

ifw::odp::ImageCube::~ImageCube ( )
virtual

Class destructor.

Returns
none
See also
CPL function: cpl_imagelist_delete

Member Function Documentation

◆ Get() [1/2]

void * ifw::odp::ImageCube::Get ( const cpl_size pos)

Get an image from the image list at a given position.

Parameters
[in]posthe image id (from 0 to number of images-1)

The image returned is a const image.

Returns
image

◆ Get() [2/2]

void ifw::odp::ImageCube::Get ( const cpl_size pos,
odp::Image * img )

Get an image from the image list at a given position.

Parameters
[in]posthe image id (from 0 to number of images-1)
[out]imgPointer to the image object.
Returns
none
Attention
The image obtained is a copy of the image allocated in the list at the specified position therefore the user shall take the actions to deallocate the memory. However object Image will delete the memory automatically at the class destructor.
See also
CPL function: cpl_imagelist_get

◆ GetCplImageList()

cpl_imagelist * ifw::odp::ImageCube::GetCplImageList ( ) const
inline

Get CPL image list.

Returns
CPL image list

◆ GetSize()

constexpr cpl_size ifw::odp::ImageCube::GetSize ( ) const
inlineconstexpr

Get image list size.

Returns
Image list size

◆ IsImageList()

constexpr bool ifw::odp::ImageCube::IsImageList ( ) const
inlineconstexpr

Check is CPL image list is valid.

Returns
TRUE is CPL image list is not nullptr, FALSE otherwise.

◆ IsUniform()

bool ifw::odp::ImageCube::IsUniform ( ) const

Determine if an image list, eg. FITS cube is uniform.

Returns
true when the image list is uniform, false if non-uniform.

Determine if an imagelist contains images of equal size and type. If the image list is nullptr returned value will be false but an error will be added to the error stack.

See also
CPL function: cpl_imagelist_is_uniform

◆ Load() [1/2]

void ifw::odp::ImageCube::Load ( const std::string filename,
const cpl_size extension = 0,
cpl_type type = CPL_TYPE_FLOAT )
virtual

Load CPL image from a FITS file.

Parameters
[in]filenameAbsolute or relative path name of the file to be loaded.
[in]extensionExtension id to be loaded, default is zero.
[in]typeCPL type used to store the input image, default is FLOAT.
Returns
none
See also
CPL function: cpl_imagelist_load

◆ Load() [2/2]

void ifw::odp::ImageCube::Load ( const std::string filename,
const cpl_size llx,
const cpl_size lly,
const cpl_size urx,
const cpl_size ury,
const cpl_size extension = 0,
cpl_type type = CPL_TYPE_FLOAT )
virtual

Load CPL image from a FITS file subwindow.

Parameters
[in]filenameAbsolute or relative path name of the file to be loaded.
[in]llxLower left X coordinate
[in]llyLower left Y coordinate
[in]urxUpper right X coordinate
[in]uryUpper right Y coordinate
[in]extensionExtension number to be loaded, default is zero.
[in]typeCPL type used to store the input image, default is FLOAT.
Returns
none
See also
CPL function: cpl_imagelist_load_window

◆ Pop()

void ifw::odp::ImageCube::Pop ( )

Remove the last image from the list.

Returns
none

This method removes the last image from the image list.

See also
CPL function: cpl_imagelist_unset

◆ Push()

void ifw::odp::ImageCube::Push ( odp::Image * img)

Insert an image into the image list at the end position.

Parameters
[in]imgImage to be inserted
Returns
none

The image is put at the end position in the image list.

Attention
The image object will be copied and image list will take care of releasing the copied memory.
See also
CPL function: cpl_imagelist_set

◆ Remove()

void ifw::odp::ImageCube::Remove ( const cpl_size pos)

Remove an image from the list at specified location.

Parameters
[in]posThe list position (from 0 to the number of images - 1)
Returns
none

This method removes the image at the specified location. The memory of the CPL image is released as well.

See also
CPL function: cpl_imagelist_unset

◆ Retrieve()

void ifw::odp::ImageCube::Retrieve ( const cpl_size pos,
odp::Image * img )

Get an image from the list at specified location.

Parameters
[in]posThe list position (from 0 to the number of images - 1)
[out]imgThe obtained image.
Returns
none

This method obtains the image at the specified location and remove it from the list. It is up to the user to deallocate the obtained image object. Previous image object will be deallocated before to assign the new one.

See also
CPL function: cpl_imagelist_unset

◆ Save()

void ifw::odp::ImageCube::Save ( const std::string filename,
cpl_type_bpp type_bpp = CPL_BPP_IEEE_FLOAT,
unsigned mode = CPL_IO_DEFAULT )
virtual

Save CPL image list into a FITS file (cube).

Parameters
[in]filenameAbsolute path name of the file to be saved.
[in]type_bppData type of the image to be saved.
[in]modeSave mode (default: CPL_IO_DEFAULT)
Returns
none
See also
CPL function: cpl_imagelist_save

◆ Set()

void ifw::odp::ImageCube::Set ( const Image * img,
const cpl_size pos )

Insert an image into the image list at a given position.

Parameters
[in]imgImage to be inserted
[in]posThe list position (from 0 to number of images)
Returns
none

The image is put at the position specified by parameter 'pos' in the image list. The image that is already there is deallocated. To add a new image, the position must be equal to the size of the image list. This will increment the list and put the new image at the end of the list.

Attention
The image object will be copied and image list will take care of releasing the copied memory.
See also
CPL function: cpl_imagelist_set

◆ SetCplImageList()

void ifw::odp::ImageCube::SetCplImageList ( cpl_imagelist * imageList)

Set CPL image list.

Parameters
[in]imageListCPL image list
Returns
none

◆ Status()

bool ifw::odp::ImageCube::Status ( ) const
inline

Get image status.

Returns
TRUE is CPL image is valid, FALSE otherwise.

◆ Unload()

void ifw::odp::ImageCube::Unload ( )
virtual

Release CPL image list.

Returns
none
    Delete image list object from memory.
See also
CPL function: cpl_imagelist_delete

Member Data Documentation

◆ m_cpl_imageList

cpl_imagelist* ifw::odp::ImageCube::m_cpl_imageList
protected

◆ m_cpl_type

cpl_type ifw::odp::ImageCube::m_cpl_type
protected

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