libpniio
image_reader.hpp
Go to the documentation of this file.
1 //
2 // (c) Copyright 2011 DESY, Eugen Wintersberger <eugen.wintersberger@desy.de>
3 //
4 // This file is part of libpniio.
5 //
6 // libpniio is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // libpniio is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with libpniio. If not, see <http://www.gnu.org/licenses/>.
18 // ===========================================================================
19 //
20 // Created on: Apr 23, 2012
21 // Author: Eugen Wintersberger <eugen.wintersberger@desy.de>
22 //
23 //
24 
25 #pragma once
26 
27 #include <iostream>
28 #include <fstream>
29 #include <string>
30 #include <vector>
31 
32 #include <pni/core/types.hpp>
33 #include "data_reader.hpp"
34 #include "image_info.hpp"
35 
36 namespace pni{
37 namespace io{
38 
54  {
55  protected:
56  //===================constructors and destructor===================
58  image_reader();
60  image_reader(const image_reader &) = delete;
64  explicit image_reader(const pni::core::string &fname,
65  bool binary=false);
66 
67  //==================assignment operators===========================
69  image_reader &operator=(const image_reader &r) = delete;
70 
73 
74  public:
76  virtual ~image_reader();
77 
78 
79  //====================methods======================================
92  virtual size_t nimages() const = 0;
93 
94  //-----------------------------------------------------------------
105  virtual image_info info(size_t i) const = 0;
106 
107  //-----------------------------------------------------------------
121  template<typename ATYPE> ATYPE image(size_t,size_t)
122  {
123  using namespace pni::core;
124  throw not_implemented_error(EXCEPTION_RECORD,
125  "Method not implemented!");
126 
127  return ATYPE(); //just to make the compiler happy
128  }
129 
130  //-----------------------------------------------------------------
146  template<typename ATYPE>
147  void image(ATYPE &,size_t,size_t)
148  {
149  using namespace pni::core;
150  throw not_implemented_error(EXCEPTION_RECORD,
151  "Method not implemented!");
152  }
153 
154  };
155 
156 
157 //end of namepsace
158 }
159 }
image information type
Definition: image_info.hpp:43
base class for data readers
Definition: data_reader.hpp:45
base class for image readers
Definition: image_reader.hpp:53
Definition: cbf_reader.hpp:41
void image(ATYPE &, size_t, size_t)
method to read a single image channel
Definition: image_reader.hpp:147
virtual size_t nimages() const =0
get number of images
ATYPE image(size_t, size_t)
method to read a single channel
Definition: image_reader.hpp:121
virtual image_info info(size_t i) const =0
get image info
image_reader & operator=(const image_reader &r)=delete
copy assignment is deleted
image_reader()
default constructor
Definition: image_reader.cpp:32
virtual ~image_reader()
destructor
Definition: image_reader.cpp:48