ifw-odp  2.0.0-alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
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 odp::ImageCube:
odp::Error

Public Member Functions

 ImageCube ()
 Class constructor. More...
 
 ImageCube (const ImageCube &cube)
 Copy constructor. More...
 
virtual ~ImageCube ()
 Class destructor. More...
 
constexpr cpl_size GetSize () const
 Get image list size. More...
 
bool Status () const
 Get image status. More...
 
constexpr bool IsImageList () const
 Check is CPL image list is valid. More...
 
cpl_imagelist * GetCplImageList () const
 Get CPL image list. More...
 
void SetCplImageList (cpl_imagelist *imageList)
 Set CPL image list. More...
 
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). More...
 
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. More...
 
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. More...
 
virtual void Unload ()
 Release CPL image list. More...
 
void Get (const cpl_size pos, Image *img)
 Get an image from the image list at a given position. More...
 
void Set (const Image *img, const cpl_size pos)
 Insert an image into the image list at a given position. More...
 
void Push (Image *img)
 Insert an image into the image list at the end position. More...
 
void Pop ()
 Remove the last image from the list. More...
 
void Remove (const cpl_size pos)
 Remove an image from the list at specified location. More...
 
void Retrieve (const cpl_size pos, Image *img)
 Get an image from the list at specified location. More...
 
bool IsUniform () const
 Determine if an image list, eg. FITS cube is uniform. More...
 
- Public Member Functions inherited from odp::Error
 Error ()
 Class constructor. More...
 
virtual ~Error ()
 Class destructor. More...
 
void ResetCplError ()
 Reset CPL error and internal error flag. More...
 
bool CheckCplError () const
 Check if there is an error in CPL. More...
 

Protected Attributes

cpl_type m_cpl_type
 
cpl_imagelist * m_cpl_imageList
 

Additional Inherited Members

- Protected Member Functions inherited from odp::Error
void AddCplError () const
 Add CPL error to the error stack. More...
 
std::string GetErrorMsg () const
 Get CPL error message. More...
 
- Static Protected Member Functions inherited from odp::Error
static void DumpError (unsigned self, unsigned first, unsigned last)
 Dump current CPL error. More...
 

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

odp::ImageCube::ImageCube ( )

Class constructor.

Returns
none
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
odp::ImageCube::~ImageCube ( )
virtual

Class destructor.

Returns
none
See Also
CPL function: cpl_imagelist_delete

Member Function Documentation

void 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
cpl_imagelist* odp::ImageCube::GetCplImageList ( ) const
inline

Get CPL image list.

Returns
CPL image list
constexpr cpl_size odp::ImageCube::GetSize ( ) const
inline

Get image list size.

Returns
Image list size
constexpr bool odp::ImageCube::IsImageList ( ) const
inline

Check is CPL image list is valid.

Returns
TRUE is CPL image list is not nullptr, FALSE otherwise.
bool 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
void 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
void 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
void 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
void 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
void 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
void 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
void 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
void 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
void odp::ImageCube::SetCplImageList ( cpl_imagelist *  imageList)

Set CPL image list.

Parameters
[in]imageListCPL image list
Returns
none
bool odp::ImageCube::Status ( ) const
inline

Get image status.

Returns
TRUE is CPL image is valid, FALSE otherwise.
void 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

cpl_imagelist* odp::ImageCube::m_cpl_imageList
protected
cpl_type odp::ImageCube::m_cpl_type
protected

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