ISIS Core Library 0.7.2 (api 3.0.0)

/scr/tee1/isis/lib/Core/DataStorage/io_application.hpp

Go to the documentation of this file.
00001 /*
00002     <one line to give the program's name and a brief idea of what it does.>
00003     Copyright (C) <year>  <name of author>
00004 
00005     This program is free software: you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation, either version 3 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 
00018 */
00019 
00020 #ifndef DATA_IOAPPLICATION_HPP
00021 #define DATA_IOAPPLICATION_HPP
00022 
00023 #include "../CoreUtils/application.hpp"
00024 #include "../CoreUtils/progressfeedback.hpp"
00025 #include "image.hpp"
00026 
00027 namespace isis
00028 {
00029 namespace data
00030 {
00031 
00032 class IOApplication: public util::Application
00033 {
00034     bool m_input, m_output;
00035     template< typename TYPE > std::list<data::TypedImage<TYPE> > convertTo( const std::list<data::Image> &src ) {
00036         return std::list<data::TypedImage<TYPE> >( src.begin(), src.end() );
00037     }
00038     boost::shared_ptr<util::ConsoleFeedback> feedback;
00039 
00040 public:
00041     std::list<data::Image> images;
00053     static void addInput ( util::ParameterMap &parameters, bool needed = true, const std::string &suffix = "", const std::string &desc = "" );
00068     static void addOutput( util::ParameterMap &parameters, bool needed = true, const std::string &suffix = "", const std::string &desc = "" );
00069 
00070     IOApplication( const char name[], bool have_input = true, bool have_output = true );
00071     virtual ~IOApplication();
00072     virtual bool init( int argc, char **argv, bool exitOnError = true );
00073     virtual void printHelp( bool withHidden = false ) const;
00074 
00082     Image fetchImage();
00092     template<typename TYPE> TypedImage<TYPE> fetchImageAs( bool copy = true ) {
00093         return copy ? MemImage<TYPE>( fetchImage() ) : TypedImage<TYPE>( fetchImage() );
00094     }
00095 
00101     bool autoload( bool exitOnError = false );
00102 
00112     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 >() );
00113 
00119     bool autowrite( Image out_image, bool exitOnError = false );
00121     bool autowrite( std::list<data::Image> out_images, bool exitOnError = false );
00122 
00132     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 >() );
00134     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 >() );
00135 
00136 protected:
00137     virtual boost::shared_ptr<util::MessageHandlerBase> getLogHandler( std::string module, isis::LogLevel level )const;
00138 };
00139 
00140 }
00141 }
00142 
00143 #endif // DATA_IOAPPLICATION_HPP