[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

sifImport.hxx
1 /************************************************************************/
2 /* */
3 /* Copyright 2010 by Joachim Schleicher and Ullrich Koethe */
4 /* */
5 /* This file is part of the VIGRA computer vision library. */
6 /* The VIGRA Website is */
7 /* http://hci.iwr.uni-heidelberg.de/vigra/ */
8 /* Please direct questions, bug reports, and contributions to */
9 /* ullrich.koethe@iwr.uni-heidelberg.de or */
10 /* vigra@informatik.uni-hamburg.de */
11 /* */
12 /* Permission is hereby granted, free of charge, to any person */
13 /* obtaining a copy of this software and associated documentation */
14 /* files (the "Software"), to deal in the Software without */
15 /* restriction, including without limitation the rights to use, */
16 /* copy, modify, merge, publish, distribute, sublicense, and/or */
17 /* sell copies of the Software, and to permit persons to whom the */
18 /* Software is furnished to do so, subject to the following */
19 /* conditions: */
20 /* */
21 /* The above copyright notice and this permission notice shall be */
22 /* included in all copies or substantial portions of the */
23 /* Software. */
24 /* */
25 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND */
26 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */
27 /* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
28 /* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */
29 /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
30 /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
31 /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
32 /* OTHER DEALINGS IN THE SOFTWARE. */
33 /* */
34 /************************************************************************/
35 
36 
37 /*
38  * Opens an Andor .sif file as MultiImageView.
39  * The width, height and number of images are extracted
40  * from the ASCII encoded variable length header.
41  *
42  * Based on the Java-Code from
43  * http://rsb.info.nih.gov/ij/plugins/open-sif.html
44  * written by
45  * L. Stirling Churchman (stirling at stanford.edu)
46  * Philippe Carl (pcarl at uni-muenster.de)
47  * Yoshiyuki Arai (arai at phys1.med.osaka-u.ac.jp)
48  *
49  * Currently tested SIF versions: 4.16.12005.0
50  * 4.16.30001.0
51  * 4. 6. 3.0
52 */
53 
54 #ifndef VIGRA_SIFIMPORT_HXX
55 #define VIGRA_SIFIMPORT_HXX
56 
57 #include <fstream>
58 #include <cstring>
59 #include <cstddef>
60 #include <vector>
61 #include "vigra/multi_array.hxx"
62 
63 namespace vigra {
64 
65 
66  /** \addtogroup VigraSIFImport Import of Images from Andor Cameras
67 
68  Read an Andor SIF file into a MultiArrayView.
69 **/
70 //@{
71 
72 /********************************************************/
73 /* */
74 /* SIFImportInfo */
75 /* */
76 /********************************************************/
77 /** \brief Extracts image properties from an Andor SIF file header.
78 
79 See \ref readSIF() for a usage example. This object must be
80 used to read the image header of an Andor SIF file
81 and enquire its properties.
82 
83 <b>\#include</b> <<a href="sifImport_8hxx_source.html">vigra/hdf5impex.hxx</a>><br>
84 Namespace: vigra
85 **/
87 {
88  public:
89  /** Construct SIFImportInfo object.
90 
91  The header of the Andor SIF file \a filename is accessed to
92  read the image properties.
93 
94  \code
95  SIFImportInfo info(filename);
96  \endcode
97  **/
98  VIGRA_EXPORT SIFImportInfo(const char* filename);
99 
100  /** Get the width in pixels.
101  **/
102  VIGRA_EXPORT const int width() const;
103 
104  /** Get the height in pixels.
105  **/
106  VIGRA_EXPORT const int height() const;
107 
108  /** Get the stacksize, that is the number of
109  * images contained in the dataset.
110  **/
111  VIGRA_EXPORT const int stacksize() const;
112 
113  /** Get the offset to the beginning of the actual data.
114  * Everything before this point belongs to the
115  * variable lenght header.
116  **/
117  VIGRA_EXPORT const ptrdiff_t getOffset() const;
118 
119  /** Get the filename of this SIF object.
120  **/
121  VIGRA_EXPORT const char * getFileName() const;
122 
123  /** Output all information such as shutter, Temperature etc.
124  as human readable output.
125 
126  <b> Usage:</b>
127 
128  <b>\#include</b> <<a href="sifImport_8hxx_source.html">vigra/sifImport.hxx</a>><br>
129  Namespace: vigra
130 
131  \code
132  SIFImportInfo info(filename);
133  std::cout << info << std::endl; // print infos to the console
134 
135  \endcode
136  **/
137  VIGRA_EXPORT friend std::ostream& operator<<(std::ostream& os, const SIFImportInfo& info);
138 
139  private:
140  const char* m_filename;
141  int m_width;
142  int m_height;
143  int m_stacksize;
144  ptrdiff_t m_offset;
145  int mod;
146  int left, right, bottom, top;
147  int xbin, ybin, xres, yres;
148  int headerlen;
149  double readout;
150  double temperature1, temperature2;
151  long long d;
152  std::string cycleTime, temperature, exposureTime, EMGain,
153  verticalShiftSpeed, version, model, originalFilename, preAmpGain;
154  size_t filesize;
155 
156 };
157 
158 
159 
160 
161  /** \brief Read the image data specified by the given \ref vigra::SIFImportInfo object
162  and write them into the given 'array'.
163 
164  The array must have the correct number of dimensions and shape for the dataset
165  represented by 'info'.
166 
167  <b> Declaration:</b>
168 
169  \code
170  namespace vigra {
171  void
172  readSIF(const SIFImportInfo &info, MultiArrayView<3, float, UnstridedArrayTag> array);
173  }
174  \endcode
175 
176  <b> Usage:</b>
177 
178  <b>\#include</b> <<a href="sifImport_8hxx_source.html">vigra/sifImport.hxx</a>><br>
179  Namespace: vigra
180 
181  \code
182  SIFImportInfo info(filename);
183 
184  // create a 3D array of appropriate size
185  typedef MultiArray<3, float>::difference_type Shape;
186  MultiArray<3, float> in(Shape(info.width(), info.height(), info.stacksize()));
187 
188  readSIF(info, in);
189  \endcode
190 */
191 VIGRA_EXPORT void readSIF(const SIFImportInfo &info, MultiArrayView<3, float, UnstridedArrayTag> array);
192 
193 VIGRA_EXPORT std::ostream& operator<<(std::ostream& os, const SIFImportInfo& info);
194 
195 //@}
196 
197 } // namespace vigra
198 
199 #endif // VIGRA_SIFIMPORT_HXX

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de)
Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany

html generated using doxygen and Python
vigra 1.7.1 (Thu Jun 14 2012)