[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
00001 /************************************************************************/ 00002 /* */ 00003 /* Copyright 2010 by Joachim Schleicher and Ullrich Koethe */ 00004 /* */ 00005 /* This file is part of the VIGRA computer vision library. */ 00006 /* The VIGRA Website is */ 00007 /* http://hci.iwr.uni-heidelberg.de/vigra/ */ 00008 /* Please direct questions, bug reports, and contributions to */ 00009 /* ullrich.koethe@iwr.uni-heidelberg.de or */ 00010 /* vigra@informatik.uni-hamburg.de */ 00011 /* */ 00012 /* Permission is hereby granted, free of charge, to any person */ 00013 /* obtaining a copy of this software and associated documentation */ 00014 /* files (the "Software"), to deal in the Software without */ 00015 /* restriction, including without limitation the rights to use, */ 00016 /* copy, modify, merge, publish, distribute, sublicense, and/or */ 00017 /* sell copies of the Software, and to permit persons to whom the */ 00018 /* Software is furnished to do so, subject to the following */ 00019 /* conditions: */ 00020 /* */ 00021 /* The above copyright notice and this permission notice shall be */ 00022 /* included in all copies or substantial portions of the */ 00023 /* Software. */ 00024 /* */ 00025 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND */ 00026 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */ 00027 /* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */ 00028 /* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */ 00029 /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */ 00030 /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */ 00031 /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */ 00032 /* OTHER DEALINGS IN THE SOFTWARE. */ 00033 /* */ 00034 /************************************************************************/ 00035 00036 00037 /* 00038 * Opens an Andor .sif file as MultiImageView. 00039 * The width, height and number of images are extracted 00040 * from the ASCII encoded variable length header. 00041 * 00042 * Based on the Java-Code from 00043 * http://rsb.info.nih.gov/ij/plugins/open-sif.html 00044 * written by 00045 * L. Stirling Churchman (stirling at stanford.edu) 00046 * Philippe Carl (pcarl at uni-muenster.de) 00047 * Yoshiyuki Arai (arai at phys1.med.osaka-u.ac.jp) 00048 * 00049 * Currently tested SIF versions: 4.16.12005.0 00050 * 4.16.30001.0 00051 * 4. 6. 3.0 00052 */ 00053 00054 #ifndef VIGRA_SIFIMPORT_HXX 00055 #define VIGRA_SIFIMPORT_HXX 00056 00057 #include <fstream> 00058 #include <cstring> 00059 #include <cstddef> 00060 #include <vector> 00061 #include "vigra/multi_array.hxx" 00062 00063 namespace vigra { 00064 00065 00066 /** \addtogroup VigraSIFImport Import of Images from Andor Cameras 00067 00068 Read an Andor SIF file into a MultiArrayView. 00069 **/ 00070 //@{ 00071 00072 /********************************************************/ 00073 /* */ 00074 /* SIFImportInfo */ 00075 /* */ 00076 /********************************************************/ 00077 /** \brief Extracts image properties from an Andor SIF file header. 00078 00079 See \ref readSIF() for a usage example. This object must be 00080 used to read the image header of an Andor SIF file 00081 and enquire its properties. 00082 00083 <b>\#include</b> <<a href="sifImport_8hxx_source.html">vigra/hdf5impex.hxx</a>><br> 00084 Namespace: vigra 00085 **/ 00086 class SIFImportInfo 00087 { 00088 public: 00089 /** Construct SIFImportInfo object. 00090 00091 The header of the Andor SIF file \a filename is accessed to 00092 read the image properties. 00093 00094 \code 00095 SIFImportInfo info(filename); 00096 \endcode 00097 **/ 00098 VIGRA_EXPORT SIFImportInfo(const char* filename); 00099 00100 /** Get the width in pixels. 00101 **/ 00102 VIGRA_EXPORT const int width() const; 00103 00104 /** Get the height in pixels. 00105 **/ 00106 VIGRA_EXPORT const int height() const; 00107 00108 /** Get the stacksize, that is the number of 00109 * images contained in the dataset. 00110 **/ 00111 VIGRA_EXPORT const int stacksize() const; 00112 00113 /** Get the offset to the beginning of the actual data. 00114 * Everything before this point belongs to the 00115 * variable lenght header. 00116 **/ 00117 VIGRA_EXPORT const ptrdiff_t getOffset() const; 00118 00119 /** Get the filename of this SIF object. 00120 **/ 00121 VIGRA_EXPORT const char * getFileName() const; 00122 00123 /** Output all information such as shutter, Temperature etc. 00124 as human readable output. 00125 00126 <b> Usage:</b> 00127 00128 <b>\#include</b> <<a href="sifImport_8hxx_source.html">vigra/sifImport.hxx</a>><br> 00129 Namespace: vigra 00130 00131 \code 00132 SIFImportInfo info(filename); 00133 std::cout << info << std::endl; // print infos to the console 00134 00135 \endcode 00136 **/ 00137 VIGRA_EXPORT friend std::ostream& operator<<(std::ostream& os, const SIFImportInfo& info); 00138 00139 private: 00140 const char* m_filename; 00141 int m_width; 00142 int m_height; 00143 int m_stacksize; 00144 ptrdiff_t m_offset; 00145 int mod; 00146 int left, right, bottom, top; 00147 int xbin, ybin, xres, yres; 00148 int headerlen; 00149 double readout; 00150 double temperature1, temperature2; 00151 long long d; 00152 std::string cycleTime, temperature, exposureTime, EMGain, 00153 verticalShiftSpeed, version, model, originalFilename, preAmpGain; 00154 size_t filesize; 00155 00156 }; 00157 00158 00159 00160 00161 /** \brief Read the image data specified by the given \ref vigra::SIFImportInfo object 00162 and write them into the given 'array'. 00163 00164 The array must have the correct number of dimensions and shape for the dataset 00165 represented by 'info'. 00166 00167 <b> Declaration:</b> 00168 00169 \code 00170 namespace vigra { 00171 void 00172 readSIF(const SIFImportInfo &info, MultiArrayView<3, float, UnstridedArrayTag> array); 00173 } 00174 \endcode 00175 00176 <b> Usage:</b> 00177 00178 <b>\#include</b> <<a href="sifImport_8hxx_source.html">vigra/sifImport.hxx</a>><br> 00179 Namespace: vigra 00180 00181 \code 00182 SIFImportInfo info(filename); 00183 00184 // create a 3D array of appropriate size 00185 typedef MultiArray<3, float>::difference_type Shape; 00186 MultiArray<3, float> in(Shape(info.width(), info.height(), info.stacksize())); 00187 00188 readSIF(info, in); 00189 \endcode 00190 */ 00191 VIGRA_EXPORT void readSIF(const SIFImportInfo &info, MultiArrayView<3, float, UnstridedArrayTag> array); 00192 00193 VIGRA_EXPORT std::ostream& operator<<(std::ostream& os, const SIFImportInfo& info); 00194 00195 //@} 00196 00197 } // namespace vigra 00198 00199 #endif // VIGRA_SIFIMPORT_HXX
© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) |
html generated using doxygen and Python
|