OPAL
Public Types | Public Member Functions | List of all members
ImageDatabase< I, S > Class Template Reference

Public Types

using ImgPixelType = I
 
using SegPixelType = S
 
using ImgType = Image< ImgPixelType >
 
using SegType = Image< SegPixelType >
 
using ImgContainerType = std::vector< ImgType >
 
using SegContainerType = std::vector< SegType >
 
using ConstImgIterator = typename ImgContainerType::const_iterator
 
using ConstSegIterator = typename SegContainerType::const_iterator
 

Public Member Functions

void Add (const std::string &imgFileName, const std::string &segFileName)
 Adds a pair of image and its segmentation. More...
 
void Add (const ImgType &imgMat, const SegType &segMat, const std::string &imgFileName="", const std::string &segFileName="")
 Adds a pair "image, its segmentation" without reading files from file system. More...
 
void ReadFromConfig (const std::string &fileName)
 
void AppendFilesFromList (const std::string &fileName)
 Read a list of filenames as 'image, segmentation' pairs and add them to the database. More...
 
void ReadFilesFromList (const std::string &fileName)
 Clear the database and read from list. More...
 
void Clear ()
 Clear the contents of the database.
 
const ImgTypeGetImage (size_t i) const
 
const SegTypeGetSegmentation (size_t i) const
 
std::string GetImageName (size_t i) const
 
std::string GetSegmentationName (size_t j) const
 
size_t GetImageCount () const
 
bool IsEmpty () const
 
size_t GetImageHeight () const
 
size_t GetImageWidth () const
 
ConstImgIterator img_cbegin () const
 
ConstSegIterator seg_cbegin () const
 
ConstImgIterator img_cend () const
 
ConstSegIterator seg_cend () const
 

Member Function Documentation

§ Add() [1/2]

template<class I , class S >
void ImageDatabase< I, S >::Add ( const std::string &  imgFileName,
const std::string &  segFileName 
)

Adds a pair of image and its segmentation.

Reads both from files.

Parameters
[in]imgFileNameName of image file.
[in]segFileNameName of segmentation file.
Exceptions
std::runtime_error.

§ Add() [2/2]

template<class I , class S >
void ImageDatabase< I, S >::Add ( const ImgType imgMat,
const SegType segMat,
const std::string &  imgFileName = "",
const std::string &  segFileName = "" 
)

Adds a pair "image, its segmentation" without reading files from file system.

Names of files can be passed, but are used only for logging. The following conditions must be met for successful run:

  1. Image and segmentation must be non-empty.
  2. Size of image matches size of segmentation.
  3. Size of image matches size of other images in the database.
Parameters
[in]imgMatImage.
[in]segMatSegmentation.
[in]imgFileNameName of image file (optional).
[in]segFileNameName of segmentation file (optional).
Exceptions
std::runtime_error.

§ AppendFilesFromList()

template<class I , class S >
void ImageDatabase< I, S >::AppendFilesFromList ( const std::string &  fileName)

Read a list of filenames as 'image, segmentation' pairs and add them to the database.

Doesn't clear the database before execution, adds images to existing ones.

Parameters
[in]fileNameName of config file.
Exceptions
stdiostream excetions, std::runtime_error.

§ ReadFilesFromList()

template<class I , class S >
void ImageDatabase< I, S >::ReadFilesFromList ( const std::string &  fileName)

Clear the database and read from list.

See AppendFilesFromList.

Parameters
[in]fileNameName of config file.
Exceptions
stdiostream excetions, std::runtime_error.

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