[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
vigra/sifImport.hxx | ![]() |
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 <vector> 00060 #include "vigra/multi_array.hxx" 00061 00062 namespace vigra { 00063 00064 00065 /** \addtogroup VigraSIFImport Import of Images from Andor Cameras 00066 00067 Read an Andor SIF file into a MultiArrayView. 00068 **/ 00069 //@{ 00070 00071 /********************************************************/ 00072 /* */ 00073 /* SIFImportInfo */ 00074 /* */ 00075 /********************************************************/ 00076 /** \brief Extracts image properties from an Andor SIF file header. 00077 00078 See \ref readSIF() for a usage example. This object must be 00079 used to read the image header of an Andor SIF file 00080 and enquire its properties. 00081 00082 <b>\#include</b> <<a href="sifImport_8hxx_source.html">vigra/hdf5impex.hxx</a>><br> 00083 Namespace: vigra 00084 **/ 00085 class SIFImportInfo 00086 { 00087 public: 00088 /** Construct SIFImportInfo object. 00089 00090 The header of the Andor SIF file \a filename is accessed to 00091 read the image properties. 00092 00093 \code 00094 SIFImportInfo info(filename); 00095 \endcode 00096 **/ 00097 VIGRA_EXPORT SIFImportInfo(const char* filename); 00098 00099 /** Get the width in pixels. 00100 **/ 00101 VIGRA_EXPORT const int width() const; 00102 00103 /** Get the height in pixels. 00104 **/ 00105 VIGRA_EXPORT const int height() const; 00106 00107 /** Get the stacksize, that is the number of 00108 * images contained in the dataset. 00109 **/ 00110 VIGRA_EXPORT const int stacksize() const; 00111 00112 /** Get the offset to the beginning of the actual data. 00113 * Everything before this point belongs to the 00114 * variable lenght header. 00115 **/ 00116 VIGRA_EXPORT const ptrdiff_t getOffset() const; 00117 00118 /** Get the filename of this SIF object. 00119 **/ 00120 VIGRA_EXPORT const char * getFileName() const; 00121 00122 /** Output all information such as shutter, Temperature etc. 00123 as human readable output. 00124 00125 <b> Usage:</b> 00126 00127 <b>\#include</b> <<a href="sifImport_8hxx_source.html">vigra/sifImport.hxx</a>><br> 00128 Namespace: vigra 00129 00130 \code 00131 SIFImportInfo info(filename); 00132 std::cout << info << std::endl; // print infos to the console 00133 00134 \endcode 00135 **/ 00136 VIGRA_EXPORT friend std::ostream& operator<<(std::ostream& os, const SIFImportInfo& info); 00137 00138 private: 00139 const char* m_filename; 00140 int m_width; 00141 int m_height; 00142 int m_stacksize; 00143 ptrdiff_t m_offset; 00144 int mod; 00145 int left, right, bottom, top; 00146 int xbin, ybin, xres, yres; 00147 int headerlen; 00148 double readout; 00149 double temperature1, temperature2; 00150 long long d; 00151 std::string cycleTime, temperature, exposureTime, EMGain, 00152 verticalShiftSpeed, version, model, originalFilename, preAmpGain; 00153 size_t filesize; 00154 00155 }; 00156 00157 00158 00159 00160 /** \brief Read the image data specified by the given \ref vigra::SIFImportInfo object 00161 and write them into the given 'array'. 00162 00163 The array must have the correct number of dimensions and shape for the dataset 00164 represented by 'info'. 00165 00166 <b> Declaration:</b> 00167 00168 \code 00169 namespace vigra { 00170 void 00171 readSIF(const SIFImportInfo &info, MultiArrayView<3, float, UnstridedArrayTag> array); 00172 } 00173 \endcode 00174 00175 <b> Usage:</b> 00176 00177 <b>\#include</b> <<a href="sifImport_8hxx_source.html">vigra/sifImport.hxx</a>><br> 00178 Namespace: vigra 00179 00180 \code 00181 SIFImportInfo info(filename); 00182 00183 // create a 3D array of appropriate size 00184 typedef MultiArray<3, float>::difference_type Shape; 00185 MultiArray<3, float> in(Shape(info.width(), info.height(), info.stacksize())); 00186 00187 readSIF(info, in); 00188 \endcode 00189 */ 00190 VIGRA_EXPORT void readSIF(const SIFImportInfo &info, MultiArrayView<3, float, UnstridedArrayTag> array); 00191 00192 VIGRA_EXPORT std::ostream& operator<<(std::ostream& os, const SIFImportInfo& info); 00193 00194 //@} 00195 00196 } // namespace vigra 00197 00198 #endif // VIGRA_SIFIMPORT_HXX
© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) |
html generated using doxygen and Python
|