TuttleOFX
1
|
00001 00002 inline bool Sequence::init( const Time first, const Time last, const Time step, const EPattern accept ) 00003 { 00004 return this->init( _directory.filename().string(), first, last, step, accept ); 00005 } 00006 00007 inline bool Sequence::initFromPattern( const boost::filesystem::path& dir, const std::string& pattern, const Time firstTime, const Time lastTime, const Time step, const EMaskOptions options, const EPattern accept ) 00008 { 00009 setDirectory(dir); 00010 return init( pattern, firstTime, lastTime, step, accept ); 00011 } 00012 00013 inline bool Sequence::initFromDetection( const EPattern& accept ) 00014 { 00015 return this->initFromDetection( getDirectory().string(), accept ); 00016 } 00017 00018 inline std::string Sequence::getAbsoluteFilenameAt( const Time time ) const 00019 { 00020 return ( getAbsoluteDirectory() / getFilenameAt( time ) ).string(); 00021 } 00022 00023 inline std::string Sequence::getFirstFilename() const 00024 { 00025 return getFilenameAt( getFirstTime() ); 00026 } 00027 00028 inline std::string Sequence::getFilenameAt( const Time time ) const 00029 { 00030 std::ostringstream o; 00031 if( time >= 0 ) 00032 { 00033 // "prefix.0001.jpg" 00034 o << _prefix << std::setw( _padding ) << std::setfill( _fillCar ) << time << _suffix; 00035 } 00036 else 00037 { 00038 // "prefix.-0001.jpg" (and not "prefix.000-1.jpg") 00039 o << _prefix << "-" << std::setw( _padding ) << std::setfill( _fillCar ) << std::abs( (int) time ) << _suffix; 00040 } 00041 return o.str(); 00042 } 00043 00044 inline std::string Sequence::getAbsoluteFirstFilename() const 00045 { 00046 return ( getAbsoluteDirectory() / getFilenameAt( getFirstTime() ) ).string(); 00047 } 00048 00049 inline std::string Sequence::getAbsoluteLastFilename() const 00050 { 00051 return ( getAbsoluteDirectory() / getFilenameAt( getLastTime() ) ).string(); 00052 } 00053 00054 /// @return pattern character in standard style 00055 00056 inline char Sequence::getPatternCharacter() const 00057 { 00058 return getPadding() ? '#' : '@'; 00059 } 00060 00061 /// @return a string pattern using standard style 00062 00063 inline std::string Sequence::getStandardPattern() const 00064 { 00065 return getPrefix() + std::string( getPadding() ? getPadding() : 1, getPatternCharacter() ) + getSuffix(); 00066 } 00067 00068 inline std::string Sequence::getAbsoluteStandardPattern() const 00069 { 00070 return (getAbsoluteDirectory() / getStandardPattern() ).string(); 00071 } 00072 00073 /// @return a string pattern using C Style 00074 00075 inline std::string Sequence::getCStylePattern() const 00076 { 00077 if( getPadding() ) 00078 return getPrefix() + "%0" + boost::lexical_cast<std::string > ( getPadding() ) + "d" + getSuffix(); 00079 else 00080 return getPrefix() + "%d" + getSuffix(); 00081 } 00082 00083 inline std::string Sequence::getAbsoluteCStylePattern() const 00084 { 00085 return (getDirectory() / getCStylePattern() ).string(); 00086 } 00087 00088 inline std::pair<Time, Time> Sequence::getRange() const 00089 { 00090 return std::pair<Time, Time > ( getFirstTime(), getLastTime() ); 00091 } 00092 00093 inline std::size_t Sequence::getStep() const 00094 { 00095 return _step; 00096 } 00097 00098 inline Time Sequence::getFirstTime() const 00099 { 00100 return _firstTime; 00101 } 00102 00103 inline Time Sequence::getLastTime() const 00104 { 00105 return _lastTime; 00106 } 00107 00108 inline std::size_t Sequence::getDuration() const 00109 { 00110 return getLastTime() - getFirstTime() + 1; 00111 } 00112 00113 inline Time Sequence::getNbFiles() const 00114 { 00115 return _nbFiles; 00116 } 00117 00118 inline std::size_t Sequence::getPadding() const 00119 { 00120 return _padding; 00121 } 00122 00123 inline bool Sequence::isStrictPadding() const 00124 { 00125 return _strictPadding; 00126 } 00127 00128 inline bool Sequence::hasMissingFile() const 00129 { 00130 return getNbMissingFiles() != 0; 00131 } 00132 00133 inline std::size_t Sequence::getNbMissingFiles() const 00134 { 00135 if( !getStep() ) 00136 return 0; 00137 return (( ( getLastTime() - getFirstTime() ) / getStep() ) + 1 ) -getNbFiles(); 00138 } 00139 00140 /// @brief filename without frame number 00141 00142 inline std::string Sequence::getIdentification() const 00143 { 00144 return _prefix + _suffix; 00145 } 00146 00147 inline std::string Sequence::getPrefix() const 00148 { 00149 return _prefix; 00150 } 00151 00152 inline std::string Sequence::getSuffix() const 00153 { 00154 return _suffix; 00155 } 00156