ISIS Core Library 0.7.2 (api 3.0.0)
Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions

isis::data::IOApplication Class Reference

#include <io_application.hpp>

Inheritance diagram for isis::data::IOApplication:
isis::util::Application

Public Member Functions

bool autoload (bool exitOnError=false)
 Load data into the input list of the Application using the internal ParameterMap.
bool autowrite (Image out_image, bool exitOnError=false)
 Write data using the internal ParameterMap.
bool autowrite (std::list< data::Image > out_images, bool exitOnError=false)
Image fetchImage ()
 Get the next image from the input.
template<typename TYPE >
TypedImage< TYPE > fetchImageAs (bool copy=true)
 Get the next image from the input.
virtual bool init (int argc, char **argv, bool exitOnError=true)
 Initializes the programm parameter map using argc/argv.
 IOApplication (const char name[], bool have_input=true, bool have_output=true)
virtual void printHelp (bool withHidden=false) const
 Virtual function to display a short help text.
virtual ~IOApplication ()

Static Public Member Functions

static void addInput (util::ParameterMap &parameters, bool needed=true, const std::string &suffix="", const std::string &desc="")
 Add input parameters to the given ParameterMap.
static void addOutput (util::ParameterMap &parameters, bool needed=true, const std::string &suffix="", const std::string &desc="")
 Add output parameters to the given ParameterMap.
static bool autoload (const util::ParameterMap &parameters, std::list< Image > &images, bool exitOnError=false, const std::string &suffix="", boost::shared_ptr< util::ConsoleFeedback > feedback=boost::shared_ptr< util::ConsoleFeedback >())
 Load images using parameters from the given ParameterMap.
static bool autowrite (const util::ParameterMap &parameters, Image out_image, bool exitOnError=false, const std::string &suffix="", boost::shared_ptr< util::ConsoleFeedback > feedback=boost::shared_ptr< util::ConsoleFeedback >())
 Write images using parameters from the given ParameterMap.
static bool autowrite (const util::ParameterMap &parameters, std::list< Image > out_images, bool exitOnError=false, const std::string &suffix="", boost::shared_ptr< util::ConsoleFeedback > feedback=boost::shared_ptr< util::ConsoleFeedback >())

Data Fields

std::list< data::Imageimages

Protected Member Functions

virtual boost::shared_ptr
< util::MessageHandlerBase
getLogHandler (std::string module, isis::LogLevel level) const

Detailed Description

Definition at line 32 of file io_application.hpp.


Constructor & Destructor Documentation

isis::data::IOApplication::IOApplication ( const char  name[],
bool  have_input = true,
bool  have_output = true 
)

Definition at line 35 of file io_application.cpp.

isis::data::IOApplication::~IOApplication ( ) [virtual]

Definition at line 50 of file io_application.cpp.


Member Function Documentation

void isis::data::IOApplication::addInput ( util::ParameterMap parameters,
bool  needed = true,
const std::string &  suffix = "",
const std::string &  desc = "" 
) [static]

Add input parameters to the given ParameterMap.

This adds the usual parameter for image input (used by autoload( const util::ParameterMap &, std::list< Image >&, bool, const std::string &, boost::shared_ptr< util::ConsoleFeedback > ) ) to the given ParameterMap. The parameters are:

  • -in the filename or path to load from
  • -rf to override the file suffix used to select the plugin used for reading
  • -rdialect selects a special dialect used for reading
    Parameters:
    parametersthe ParameterMap the parameters should be added to
    neededif true, the -in parameter is marked as needed (init will fail, if this is not set)
    suffixtext to be appended to the parameters above (eg. "1" here results in "-in1" etc.) to distinguish multiple inputs
    desca specific description of this particular input parameters (will be used in the help-output)

Definition at line 69 of file io_application.cpp.

void isis::data::IOApplication::addOutput ( util::ParameterMap parameters,
bool  needed = true,
const std::string &  suffix = "",
const std::string &  desc = "" 
) [static]

Add output parameters to the given ParameterMap.

This adds the usual parameters for image output to the given ParameterMap. The parameters are:

  • -out the filename to write to
  • -wf to override the file suffix used to select the plugin used for writing
  • -wdialect selects a special dialect used for writing
  • -repn selects a data type used for writing
  • -scale_mode selects the scaling strategy when converting data type for writing
    Parameters:
    parametersthe ParameterMap the parameters should be added to
    neededif true, the -out parameter is marked as needed (init will fail, if this is not set)
    suffixtext to be appended to the parameters above (eg. "1" here results in "-out1" etc.) to distinguish multiple outputs
    desca specific description of this particular output parameters (will be used in the help-output)

Definition at line 93 of file io_application.cpp.

bool isis::data::IOApplication::autoload ( const util::ParameterMap parameters,
std::list< Image > &  images,
bool  exitOnError = false,
const std::string &  suffix = "",
boost::shared_ptr< util::ConsoleFeedback feedback = boost::shared_ptr< util::ConsoleFeedback >() 
) [static]

Load images using parameters from the given ParameterMap.

These program parameters should be the same as set by addInput().

Parameters:
parametersthe ParameterMap the parameters should be taken from
imagesan image list to store the red images
exitOnErrorterminate the application if there was an error reading the data
suffixthe same suffix used for addInput()
feedbackif given, the util::ConsoleFeedback object will be used to display reading progress if possible

Definition at line 168 of file io_application.cpp.

bool isis::data::IOApplication::autoload ( bool  exitOnError = false)

Load data into the input list of the Application using the internal ParameterMap.

This is the default loading function, it is calling autoload( const util::ParameterMap &, std::list< Image >&, bool, const std::string &, boost::shared_ptr< util::ConsoleFeedback > ) with the ParameterMap of the application and stores the loaded image in its input list (see fetchImage and fetchImageAs).

Note:
usually there is no nedd to explicitely call that function. It is called automatically by init() if the Application is set up for input (see IOApplication()).

Definition at line 163 of file io_application.cpp.

bool isis::data::IOApplication::autowrite ( Image  out_image,
bool  exitOnError = false 
)

Write data using the internal ParameterMap.

Uses autowrite(const util::ParameterMap &, Image, bool, const std::string &, boost::shared_ptr< util::ConsoleFeedback >) with the ParameterMap of the application to write the given image.

Parameters:
out_imagethe image to be written
exitOnErrorterminate the application if there was an error writing the data

Definition at line 211 of file io_application.cpp.

bool isis::data::IOApplication::autowrite ( std::list< data::Image out_images,
bool  exitOnError = false 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 212 of file io_application.cpp.

bool isis::data::IOApplication::autowrite ( const util::ParameterMap parameters,
Image  out_image,
bool  exitOnError = false,
const std::string &  suffix = "",
boost::shared_ptr< util::ConsoleFeedback feedback = boost::shared_ptr< util::ConsoleFeedback >() 
) [static]

Write images using parameters from the given ParameterMap.

These program parameters should be the same as set by addOutput().

Parameters:
parametersthe ParameterMap the parameters should be taken from
out_imagethe image to be written
exitOnErrorterminate the application if there was an error writing the data
suffixthe same suffix used for addOutput()
feedbackif given, the util::ConsoleFeedback object will be used to display reading progress if possible

Definition at line 218 of file io_application.cpp.

bool isis::data::IOApplication::autowrite ( const util::ParameterMap parameters,
std::list< Image out_images,
bool  exitOnError = false,
const std::string &  suffix = "",
boost::shared_ptr< util::ConsoleFeedback feedback = boost::shared_ptr< util::ConsoleFeedback >() 
) [static]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 222 of file io_application.cpp.

Image isis::data::IOApplication::fetchImage ( )

Get the next image from the input.

This removes the currently first image in the input list, and returns a cheap copy of this image. If the input image list is empty, an exception is thrown. You might want to check the amount of available images via images.size().

Returns:
the currently first image in the input chain

Definition at line 262 of file io_application.cpp.

template<typename TYPE >
TypedImage<TYPE> isis::data::IOApplication::fetchImageAs ( bool  copy = true) [inline]

Get the next image from the input.

This uses fetchImage() to get the next image off of the input list and makes sure, that all chunks of this image are of the given type (using convertToType). If the input image list is empty, an exception is thrown. You might want to check the amount of available images via images.size().

Parameters:
copyenforce deep copy of the data, even if its not neccessary
Returns:
the currently first image in the input chain represented in the given type

Definition at line 92 of file io_application.hpp.

boost::shared_ptr< util::MessageHandlerBase > isis::data::IOApplication::getLogHandler ( std::string  module,
isis::LogLevel  level 
) const [protected, virtual]

Reimplemented from isis::util::Application.

Definition at line 270 of file io_application.cpp.

bool isis::data::IOApplication::init ( int  argc,
char **  argv,
bool  exitOnError = true 
) [virtual]

Initializes the programm parameter map using argc/argv.

For every entry in parameters an corresponding command line parameter is searched and parsed. A command line parameter corresponds to an entry of parameters if it string-equals caseless to this entry and is preceded by "-".

Parameters:
argcammount of command line parameters in argv
argvarray of const char[] containing the command line parameters
exitOnErrorif true the programm will exit, if there is a problem during the initialisation (like missing parameters).

Reimplemented from isis::util::Application.

Definition at line 55 of file io_application.cpp.

void isis::data::IOApplication::printHelp ( bool  withHidden = false) const [virtual]

Virtual function to display a short help text.

Ths usually shall print the programm name plus all entries of parameters with their description.

Reimplemented from isis::util::Application.

Definition at line 143 of file io_application.cpp.


Field Documentation

Definition at line 41 of file io_application.hpp.


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