00001 /*!@file Raster/DpxFile.H DPX (Digital Picture Exchange) image file format */ 00002 00003 // //////////////////////////////////////////////////////////////////// // 00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005 // 00005 // by the University of Southern California (USC) and the iLab at USC. // 00006 // See http://iLab.usc.edu for information about this project. // 00007 // //////////////////////////////////////////////////////////////////// // 00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00010 // in Visual Environments, and Applications'' by Christof Koch and // 00011 // Laurent Itti, California Institute of Technology, 2001 (patent // 00012 // pending; application number 09/912,225 filed July 23, 2001; see // 00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00014 // //////////////////////////////////////////////////////////////////// // 00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00016 // // 00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00018 // redistribute it and/or modify it under the terms of the GNU General // 00019 // Public License as published by the Free Software Foundation; either // 00020 // version 2 of the License, or (at your option) any later version. // 00021 // // 00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00025 // PURPOSE. See the GNU General Public License for more details. // 00026 // // 00027 // You should have received a copy of the GNU General Public License // 00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00030 // Boston, MA 02111-1307 USA. // 00031 // //////////////////////////////////////////////////////////////////// // 00032 // 00033 // Primary maintainer for this file: Rob Peters <rjpeters at usc dot edu> 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Raster/DpxFile.H $ 00035 // $Id: DpxFile.H 9204 2008-02-01 18:46:27Z rjpeters $ 00036 // 00037 00038 #ifndef RASTER_DPXFILE_H_DEFINED 00039 #define RASTER_DPXFILE_H_DEFINED 00040 00041 #include "Image/Dims.H" 00042 #include "Image/Image.H" 00043 #include "Util/Types.H" 00044 00045 /// DPX (Digital Picture Exchange) image file format 00046 /** NOTE: This class currently contains only a partial DPX file parser 00047 and does NOT provide full support for all DPX files. 00048 00049 For details, see http://www.fileformat.info/format/dpx/ 00050 */ 00051 class DpxFile 00052 { 00053 public: 00054 DpxFile(const char* fname); 00055 00056 struct FileHeader 00057 { 00058 uint32 MagicNumber; 00059 uint32 ImageDataOffset; 00060 char HeaderVersion[8]; 00061 uint32 FileSize; 00062 uint32 DittoKey; 00063 uint32 GenericHeaderSize; 00064 uint32 IndustryHeaderSize; 00065 uint32 UserDefinedDataSize; 00066 char ImageFilename[100]; 00067 char CreateTime[24]; 00068 char Creator[100]; 00069 char Project[200]; 00070 char Copyright[200]; 00071 uint32 EncryptKey; 00072 char Reserved[104]; 00073 }; 00074 00075 struct ImageElementInfo 00076 { 00077 uint32 DataSign; 00078 uint32 LowData; 00079 float LowQuantity; 00080 uint32 HighData; 00081 float HighQuantity; 00082 byte Descriptor; 00083 byte Transfer; 00084 byte Colorimetric; 00085 byte BitSize; 00086 uint16 Packing; 00087 uint16 Encoding; 00088 uint32 DataOffset; 00089 uint32 EndOfLinePadding; 00090 uint32 EndOfImagePadding; 00091 char Description[32]; 00092 }; 00093 00094 struct ImageHeader 00095 { 00096 uint16 Orientation; 00097 uint16 NumberElements; 00098 uint32 PixelsPerLine; 00099 uint32 LinesPerElement; 00100 ImageElementInfo ImageElement[8]; 00101 byte Reserved[52]; 00102 }; 00103 00104 struct OrientationHeader 00105 { 00106 uint32 XOffset; 00107 uint32 YOffset; 00108 float XCenter; 00109 float YCenter; 00110 uint32 XOriginalSize; 00111 uint32 YOriginalSize; 00112 char FileName[100]; 00113 char TimeDate[24]; 00114 char InputName[32]; 00115 char InputSN[32]; 00116 uint16 Border[4]; 00117 uint32 AspectRatio[2]; 00118 byte Reserved[28]; 00119 }; 00120 00121 struct FilmIndustryHeader 00122 { 00123 char FilmMfgId[2]; 00124 char FilmType[2]; 00125 char Offset[2]; 00126 char Prefix[6]; 00127 char Count[4]; 00128 char Format[32]; 00129 uint32 FramePosition; 00130 uint32 SequenceLen; 00131 uint32 HeldCount; 00132 float FrameRate; 00133 float ShutterAngle; 00134 char FrameId[32]; 00135 char SlateInfo[100]; 00136 byte Reserved[56]; 00137 }; 00138 00139 struct TelevisionIndustryHeader 00140 { 00141 uint32 TimeCode; 00142 uint32 UserBits; 00143 byte Interlace; 00144 byte FiledNumber; 00145 byte VideoSignal; 00146 byte Padding; 00147 float HorzSampleRate; 00148 float VertSampleRate; 00149 float FrameRate; 00150 float TimeOffset; 00151 float Gamma; 00152 float BlackLevel; 00153 float BlackGain; 00154 float Breakpoint; 00155 float WhiteLevel; 00156 float IntegrationTimes; 00157 byte Reserved[76]; 00158 }; 00159 00160 Dims dims; 00161 00162 FileHeader fh; 00163 ImageHeader ih; 00164 OrientationHeader oh; 00165 FilmIndustryHeader fih; 00166 TelevisionIndustryHeader tih; 00167 00168 Image<uint16> rawimage; 00169 }; 00170 00171 // ###################################################################### 00172 /* So things look consistent in everyone's emacs... */ 00173 /* Local Variables: */ 00174 /* mode: c++ */ 00175 /* indent-tabs-mode: nil */ 00176 /* End: */ 00177 00178 #endif // RASTER_DPXFILE_H_DEFINED