Image Component Library (ICL)
GenericImageOutput.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLIO/src/ICLIO/GenericImageOutput.h **
10 ** Module : ICLIO **
11 ** Authors: Christof Elbrechter **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLUtils/CompatMacros.h>
34 #include <ICLUtils/ProgArg.h>
35 #include <ICLUtils/SmartPtr.h>
36 #include <ICLCore/ImgBase.h>
37 #include <ICLIO/ImageOutput.h>
38 
39 namespace icl{
40  namespace io{
41 
43 
65  std::string type;
66  std::string description;
68 
69  public:
70 
73 
75 
76  GenericImageOutput(const std::string &type, const std::string &description);
77 
80 
82  void init(const std::string &type, const std::string &description);
83 
85  void init(const utils::ProgArg &pa);
86 
88  void release();
89 
91  virtual void send(const core::ImgBase *image){
92  if (impl) {
93  impl->send(image);
94  }
95  else{
96  ERROR_LOG("unable to send image with a NULL output");
97  }
98  }
99 
101  inline bool isNull() const { return !impl; };
102 
104  inline const std::string &getType() const { return type; }
105 
107  inline const std::string &getDescription() const { return description; }
108 
111  ICLASSERT_THROW(impl,utils::ICLException("GenericImageOutput:setCompression: impl was null"));
112  impl->setCompression(spec);
113  }
114 
117  ICLASSERT_THROW(impl,utils::ICLException("GenericImageOutput:getCompression: impl was null"));
118  return impl->getCompression();
119  }
120  };
121  } // namespace io
122 }
123 
virtual CompressionSpec getCompression() const
returns the implementation's current compression type (result.first) and quality (result....
Definition: GenericImageOutput.h:116
undocument this line if you encounter any issues!
Definition: Any.h:37
const std::string & getDescription() const
retusn current description string
Definition: GenericImageOutput.h:107
std::string type
Definition: GenericImageOutput.h:65
virtual void send(const core::ImgBase *image)
sends a new image
Definition: GenericImageOutput.h:91
bool isNull() const
returns whether this instance was already initialized
Definition: GenericImageOutput.h:101
compression specification
Definition: ImageCompressor.h:144
const ProgArg pa(const std::string &id, unsigned int subargidx=0)
returns given program argument
Definition: ProgArg.h:304
#define ICLIO_API
Definition: CompatMacros.h:176
Programm argument utility class.
Definition: ProgArg.h:80
utils::SmartPtr< ImageOutput > impl
Definition: GenericImageOutput.h:67
GenericImageOutput()
Null constructor.
Definition: GenericImageOutput.h:72
#define ERROR_LOG(x)
Definition: Macros.h:111
Base class for Exception handling in the ICL.
Definition: Exception.h:42
virtual void setCompression(const ImageCompressor::CompressionSpec &spec)
sets the implementations compression options
Definition: GenericImageOutput.h:110
Minimal interface for image output classes.
Definition: ImageOutput.h:54
Generic Sink for images.
Definition: GenericImageOutput.h:64
ImgBase is the Image-Interface class that provides save access to underlying Img-template .
Definition: ImgBase.h:131
Specialization of the SmartPtrBase class for Pointers.
Definition: SmartPtr.h:75
#define ICLASSERT_THROW(X, OBJ)
Definition: Macros.h:155
std::string description
Definition: GenericImageOutput.h:66
const std::string & getType() const
retusn current type string
Definition: GenericImageOutput.h:104