Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Static Public Member Functions | List of all members
BIAS::IOUtils Class Reference

Class grouping together some IO code often used in (small) application, like loading images, parsing their meta data etc. More...

#include <Utils/IOUtils.hh>

Classes

class  ProgressBar
 
struct  ProgressIndicator
 

Static Public Member Functions

template<class ptType , class inPtType >
static bool CheckType (inPtType *checked, ptType *&result)
 
template<class ptType , class inPtType >
static bool CheckTypeDelete (inPtType *checked, ptType *&result)
 
static std::string ExtendOutName (const std::string &outname, const std::string &suffix, const std::string &extension)
 Will take outname which is assumed to be of path/base.ext structure and will build path/base_extension.suffix from it. More...
 
static std::string ExtendOutName (const std::string &outname, const std::string &extension)
 Will take outname which is assumed to be of path/base.ext structure and will build path/base_extension.ext from it. More...
 
static bool ExtractSubPaths (const std::string &environmentVariable, std::vector< std::string > &subPaths)
 Seperates out the paths that are contained in a list of directories that are stored in an environment variable. More...
 
static bool FindFile (const std::string &searchPaths, const std::string &baseFileName, std::string &fullFileName)
 Searches for the file specified by baseFileName in the specified searchPaths. More...
 
static bool FindFileEnv (const std::string &environmentVariable, const std::string &baseFileName, std::string &fullFileName)
 Like FindFile() but reads out the searchPath from the specified environmentVariable. More...
 
static bool FindShaderFile (const std::string &shaderFileName, std::string &res)
 Convenience wrapper to using SHADERSRC environment variable. More...
 
static int GetApplicationMemory ()
 
static bool GetProjection (ImageBase &imgBase, Projection &projOut)
 This is the implementation found in Camera::ParseMetaData() ! It allows to extract the Projection from ImageBase without the unconvenient type determination. More...
 
static bool GetProjectionParametersPerspective (ImageBase &imgBase, BIAS::ProjectionParametersPerspective *&ppp)
 
template<class dataType >
static bool LoadCamera (std::string *fileName, BIAS::Camera< dataType > &cam)
 
template<class dataType >
static bool LoadCamera (const std::string &fileName, BIAS::Camera< dataType > &cam)
 
template<class dataType >
static bool LoadCamera (std::string *fileName, BIAS::Camera< dataType > &cam, BIAS::Projection &proj)
 
template<class dataType >
static bool LoadCamera (const std::string &fileName, BIAS::Camera< dataType > &cam, BIAS::Projection &proj)
 
template<class dataType >
static bool LoadCamera (const std::string &fileName, BIAS::Camera< dataType > &cam, BIAS::Projection &proj, unsigned int &width, unsigned int &height, unsigned int &channels)
 
static bool LoadCamera (const std::string *fileName, BIAS::ImageBase &cam, BIAS::Projection &proj)
 
static bool LoadCamera (const std::string *fileName, BIAS::ImageBase &cam, BIAS::ProjectionParametersPerspective *&ppp)
 
template<class dataType >
static bool LoadCamera (const std::string &fileName, BIAS::Camera< dataType > &cam, BIAS::ProjectionParametersPerspective *&proj, unsigned int &width, unsigned int &height, unsigned int &channels)
 
static bool LoadCamera (const std::string *fileName, BIAS::ImageBase &cam, BIAS::ProjectionParametersPerspectiveDepth *&ppp)
 
template<class dataType >
static bool LoadCamera (const std::string &fileName, BIAS::Camera< dataType > &cam, BIAS::ProjectionParametersPerspectiveDepth *&proj, unsigned int &width, unsigned int &height, unsigned int &channels)
 
static bool LoadFloat (const std::string &filename, BIAS::Image< float > &outcome)
 
static bool LoadImage (const std::string &fileName, ImageBase &img, unsigned int &width, unsigned int &height, unsigned int &channels)
 
template<class type >
static bool LoadImageList (const std::string &listFileName, std::vector< Image< type > > &imgs, const bool verbose=false)
 Takes in the name of a text file, that contains an image file-name per line, tries to load these images into the vector. More...
 
template<class type >
static bool LoadImageList (const std::string &listFileName, std::vector< Image< type > > &imgs, std::vector< ProjectionParametersPerspective * > &ppp, const bool verbose=false)
 
static bool LoadImageList (const std::string &listFileName, std::vector< ImageBase > &imgs, std::vector< ProjectionParametersPerspective * > &ppp, const bool verbose=false)
 
static bool LoadImageList (const std::string &listFileName, std::vector< ImageBase > &imgs, std::vector< ProjectionParametersPerspective > &ppp, const bool verbose=false)
 
static bool LoadParameters (const std::string *fileName, BIAS::ProjectionParametersPerspective *&ppp)
 
static bool ParseCommandLineEvalHelp (Param &params, int argc, char *argv[])
 parses the command line, adds parameter "help" More...
 
static bool ParseCommandLineEvalHelp (Param &params, int argc, char *argv[], int &fup)
 parses the command line, adds parameter "help" and return first unknown parameter in fup More...
 
static void PrintWithLineNumbers (const std::string &text, std::ostream &out=std::cout)
 
static bool ReadIn2DPointList (const std::string &fileName, std::vector< BIAS::Vector2< int > > &pointLst)
 Appends 2D points read in from file to vector. More...
 
static bool ReadIn2DPointList (const std::string &fileName, std::vector< unsigned int > &xPos, std::vector< unsigned int > &yPos)
 
template<class T >
static bool ReadIn2DPointList (const std::string &fileName, std::vector< BIAS::Vector2< T > > &pointList)
 Reads a list of 2D points from a text file and appends them to the given vector. More...
 
template<class T >
static bool ReadIn3DPointList (const std::string &fileName, std::vector< BIAS::Vector3< T > > &pointList)
 Reads a list of 3D points from a text file and appends them to the given vector. More...
 
template<class dataType >
static bool SaveCamera (const std::string &fileName, const BIAS::Camera< dataType > &cam)
 
template<class dataType >
static bool SaveCamera (const std::string &fileName, BIAS::Camera< dataType > &cam, const BIAS::Projection &proj)
 
static bool SaveForPlot (const std::string &filename, const std::vector< double > &x_vector, const std::vector< double > &y_vector)
 
template<class T >
static bool Write2DPointWithDatumList (const std::string &fileName, std::vector< unsigned int > &xPos, std::vector< unsigned int > &yPos, std::vector< T > &datum)
 

Detailed Description

Class grouping together some IO code often used in (small) application, like loading images, parsing their meta data etc.

Author
bartczak 01/2008

Definition at line 45 of file IOUtils.hh.

Member Function Documentation

template<class ptType , class inPtType >
static bool BIAS::IOUtils::CheckType ( inPtType *  checked,
ptType *&  result 
)
inlinestatic

Definition at line 423 of file IOUtils.hh.

template<class ptType , class inPtType >
static bool BIAS::IOUtils::CheckTypeDelete ( inPtType *  checked,
ptType *&  result 
)
inlinestatic

Definition at line 432 of file IOUtils.hh.

string IOUtils::ExtendOutName ( const std::string &  outname,
const std::string &  suffix,
const std::string &  extension 
)
static

Will take outname which is assumed to be of path/base.ext structure and will build path/base_extension.suffix from it.

Definition at line 138 of file IOUtils.cpp.

string IOUtils::ExtendOutName ( const std::string &  outname,
const std::string &  extension 
)
static

Will take outname which is assumed to be of path/base.ext structure and will build path/base_extension.ext from it.

Definition at line 157 of file IOUtils.cpp.

bool IOUtils::ExtractSubPaths ( const std::string &  environmentVariable,
std::vector< std::string > &  subPaths 
)
static

Seperates out the paths that are contained in a list of directories that are stored in an environment variable.

Definition at line 43 of file IOUtils.cpp.

bool IOUtils::FindFile ( const std::string &  searchPaths,
const std::string &  baseFileName,
std::string &  fullFileName 
)
static

Searches for the file specified by baseFileName in the specified searchPaths.

Parameters
searchPathsis a string like returned by getenv, i.e. a path list seperated by a colon for Linux or a path list seperated by a semicolon for windows
returnstrue if file was found;

Definition at line 77 of file IOUtils.cpp.

bool IOUtils::FindFileEnv ( const std::string &  environmentVariable,
const std::string &  baseFileName,
std::string &  fullFileName 
)
static

Like FindFile() but reads out the searchPath from the specified environmentVariable.

Like FindFile but reads out the searchPath from the specified environmentVariable.

Definition at line 113 of file IOUtils.cpp.

Referenced by BIAS::SeparableBilateralFilter::Init().

bool IOUtils::FindShaderFile ( const std::string &  shaderFileName,
std::string &  res 
)
static

Convenience wrapper to using SHADERSRC environment variable.

Definition at line 127 of file IOUtils.cpp.

static int BIAS::IOUtils::GetApplicationMemory ( )
inlinestatic

Definition at line 457 of file IOUtils.hh.

bool IOUtils::GetProjection ( ImageBase imgBase,
Projection projOut 
)
static

This is the implementation found in Camera::ParseMetaData() ! It allows to extract the Projection from ImageBase without the unconvenient type determination.

Returns
true if a valid pose was found.

Definition at line 244 of file IOUtils.cpp.

References BIAS::AppData::data, BIAS::MetaData::Find(), BIAS::ImageBase::GetMetaData(), BIAS::Projection::GetParameters(), BIAS::AppData::length, BIAS::ProjectionParametersBase::PoseValid(), BIAS::AppData::sdata, BIAS::AppData::tag, and BIAS::XMLBase::XMLReadFromString().

bool IOUtils::GetProjectionParametersPerspective ( ImageBase imgBase,
BIAS::ProjectionParametersPerspective *&  ppp 
)
static
template<class dataType >
static bool BIAS::IOUtils::LoadCamera ( std::string *  fileName,
BIAS::Camera< dataType > &  cam 
)
inlinestatic

Definition at line 315 of file IOUtils.hh.

References BIAS::ImageIO::Load().

Referenced by LoadImageList().

template<class dataType >
static bool BIAS::IOUtils::LoadCamera ( const std::string &  fileName,
BIAS::Camera< dataType > &  cam 
)
inlinestatic

Definition at line 326 of file IOUtils.hh.

References BIAS::ImageIO::Load().

template<class dataType >
static bool BIAS::IOUtils::LoadCamera ( std::string *  fileName,
BIAS::Camera< dataType > &  cam,
BIAS::Projection proj 
)
inlinestatic
template<class dataType >
static bool BIAS::IOUtils::LoadCamera ( const std::string &  fileName,
BIAS::Camera< dataType > &  cam,
BIAS::Projection proj 
)
inlinestatic
template<class dataType >
static bool BIAS::IOUtils::LoadCamera ( const std::string &  fileName,
BIAS::Camera< dataType > &  cam,
BIAS::Projection proj,
unsigned int &  width,
unsigned int &  height,
unsigned int &  channels 
)
inlinestatic
static bool BIAS::IOUtils::LoadCamera ( const std::string *  fileName,
BIAS::ImageBase cam,
BIAS::Projection proj 
)
inlinestatic

Definition at line 477 of file IOUtils.hh.

References BIAS::ImageIO::Load().

static bool BIAS::IOUtils::LoadCamera ( const std::string *  fileName,
BIAS::ImageBase cam,
BIAS::ProjectionParametersPerspective *&  ppp 
)
inlinestatic
template<class dataType >
static bool BIAS::IOUtils::LoadCamera ( const std::string &  fileName,
BIAS::Camera< dataType > &  cam,
BIAS::ProjectionParametersPerspective *&  proj,
unsigned int &  width,
unsigned int &  height,
unsigned int &  channels 
)
inlinestatic
static bool BIAS::IOUtils::LoadCamera ( const std::string *  fileName,
BIAS::ImageBase cam,
BIAS::ProjectionParametersPerspectiveDepth *&  ppp 
)
inlinestatic
template<class dataType >
static bool BIAS::IOUtils::LoadCamera ( const std::string &  fileName,
BIAS::Camera< dataType > &  cam,
BIAS::ProjectionParametersPerspectiveDepth *&  proj,
unsigned int &  width,
unsigned int &  height,
unsigned int &  channels 
)
inlinestatic
bool IOUtils::LoadFloat ( const std::string &  filename,
BIAS::Image< float > &  outcome 
)
static
bool IOUtils::LoadImage ( const std::string &  fileName,
ImageBase img,
unsigned int &  width,
unsigned int &  height,
unsigned int &  channels 
)
static
template<class type >
static bool BIAS::IOUtils::LoadImageList ( const std::string &  listFileName,
std::vector< Image< type > > &  imgs,
const bool  verbose = false 
)
inlinestatic

Takes in the name of a text file, that contains an image file-name per line, tries to load these images into the vector.

Returns
false if not usccesfull in loading any image.

Definition at line 53 of file IOUtils.hh.

References BIAS::ImageIO::Load(), and BIAS::Param::ParseListFile().

template<class type >
static bool BIAS::IOUtils::LoadImageList ( const std::string &  listFileName,
std::vector< Image< type > > &  imgs,
std::vector< ProjectionParametersPerspective * > &  ppp,
const bool  verbose = false 
)
inlinestatic

Definition at line 78 of file IOUtils.hh.

References LoadCamera(), and BIAS::Param::ParseListFile().

static bool BIAS::IOUtils::LoadImageList ( const std::string &  listFileName,
std::vector< ImageBase > &  imgs,
std::vector< ProjectionParametersPerspective * > &  ppp,
const bool  verbose = false 
)
inlinestatic

Definition at line 108 of file IOUtils.hh.

References LoadCamera(), and BIAS::Param::ParseListFile().

static bool BIAS::IOUtils::LoadImageList ( const std::string &  listFileName,
std::vector< ImageBase > &  imgs,
std::vector< ProjectionParametersPerspective > &  ppp,
const bool  verbose = false 
)
inlinestatic

Definition at line 137 of file IOUtils.hh.

static bool BIAS::IOUtils::LoadParameters ( const std::string *  fileName,
BIAS::ProjectionParametersPerspective *&  ppp 
)
inlinestatic
bool IOUtils::ParseCommandLineEvalHelp ( Param params,
int  argc,
char *  argv[] 
)
static
bool IOUtils::ParseCommandLineEvalHelp ( Param params,
int  argc,
char *  argv[],
int &  fup 
)
static

parses the command line, adds parameter "help" and return first unknown parameter in fup

Definition at line 192 of file IOUtils.cpp.

References BIAS::Param::AddParamBool(), BIAS::Param::GetFreeGroupID(), BIAS::Param::ParseCommandLine(), BIAS::Param::SetGroupName(), and BIAS::Param::Usage().

void IOUtils::PrintWithLineNumbers ( const std::string &  text,
std::ostream &  out = std::cout 
)
static

Definition at line 209 of file IOUtils.cpp.

bool IOUtils::ReadIn2DPointList ( const std::string &  fileName,
std::vector< BIAS::Vector2< int > > &  pointLst 
)
static

Appends 2D points read in from file to vector.

Definition at line 431 of file IOUtils.cpp.

bool IOUtils::ReadIn2DPointList ( const std::string &  fileName,
std::vector< unsigned int > &  xPos,
std::vector< unsigned int > &  yPos 
)
static

Definition at line 457 of file IOUtils.cpp.

template<class T >
static bool BIAS::IOUtils::ReadIn2DPointList ( const std::string &  fileName,
std::vector< BIAS::Vector2< T > > &  pointList 
)
inlinestatic

Reads a list of 2D points from a text file and appends them to the given vector.

Parameters
fileNamethe name of the file to read from
pointListthe list to add the points, note that it is not cleared so the points are appended
Returns
true on success or false if the file was not found

Definition at line 209 of file IOUtils.hh.

template<class T >
static bool BIAS::IOUtils::ReadIn3DPointList ( const std::string &  fileName,
std::vector< BIAS::Vector3< T > > &  pointList 
)
inlinestatic

Reads a list of 3D points from a text file and appends them to the given vector.

Parameters
fileNamethe name of the file to read from
pointListthe list to add the points, note that it is not cleared so the points are appended
Returns
true on success or false if the file was not found

Definition at line 245 of file IOUtils.hh.

template<class dataType >
static bool BIAS::IOUtils::SaveCamera ( const std::string &  fileName,
const BIAS::Camera< dataType > &  cam 
)
inlinestatic

Definition at line 389 of file IOUtils.hh.

References BIAS::ImageIO::Save().

template<class dataType >
static bool BIAS::IOUtils::SaveCamera ( const std::string &  fileName,
BIAS::Camera< dataType > &  cam,
const BIAS::Projection proj 
)
inlinestatic
bool IOUtils::SaveForPlot ( const std::string &  filename,
const std::vector< double > &  x_vector,
const std::vector< double > &  y_vector 
)
static

Definition at line 389 of file IOUtils.cpp.

template<class T >
static bool BIAS::IOUtils::Write2DPointWithDatumList ( const std::string &  fileName,
std::vector< unsigned int > &  xPos,
std::vector< unsigned int > &  yPos,
std::vector< T > &  datum 
)
inlinestatic

Definition at line 164 of file IOUtils.hh.


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