78 std::vector< std::string >::iterator nit;
86 std::string origFileName =
87 itksys::SystemTools::GetFilenameName( ( *nit ).c_str() );
89 IntVectorType::reverse_iterator numGroupLengthItr =
92 IntVectorType::reverse_iterator numGroupStartItr =
97 int megaCaptureNumericalGroupCounter = 0;
103 std::string ValueAsString(
105 ( *numGroupStartItr ),
106 ( *numGroupLengthItr ) );
110 NumericalValues[tempidx] = atoi( ValueAsString.c_str() );
114 ++megaCaptureNumericalGroupCounter;
123 numGroupStartItr = numGroupStartItr - 1;
127 int LengthHeaderFile = *numGroupStartItr - 3;
130 std::string fileNamePath = itksys::SystemTools::GetFilenamePath(
m_FileName);
132 + origFileName.substr(0, LengthHeaderFile) +
".meg";
147 this->SetProgress( 0.25 +
148 0.75 * static_cast< float >( counter ) / static_cast< float >(
m_FileNameS.size() ) );
183 std::string regExpFileName = FilenameModified;
196 std::string regExpString =
"([0-9]+)";
197 int megaCaptureNumericalGroupCounter = 0;
203 regExpFileName.replace(*numGroupStartItr, *numGroupLengthItr, regExpString);
206 ++megaCaptureNumericalGroupCounter;
209 this->SetProgress( 0.05 );
214 regExpFileName =
"^" + regExpFileName +
"$";
218 itksys::SystemTools::ConvertToUnixSlashes(unixArchetype);
220 std::string origFileName =
221 itksys::SystemTools::GetFilenameName( unixArchetype.c_str() );
223 std::string fileNamePath =
224 itksys::SystemTools::GetFilenamePath( unixArchetype.c_str() );
226 std::string pathPrefix;
228 itk::RegularExpressionSeriesFileNames::Pointer fit =
229 itk::RegularExpressionSeriesFileNames::New();
230 fit->SetDirectory( fileNamePath.c_str() );
231 fit->SetRegularExpression( regExpFileName.c_str() );
233 fit->NumericSortOn();
237 this->SetProgress( 0.15 );
240 std::string::iterator s_start = origFileName.begin();
241 std::string::iterator s_end = origFileName.end();
242 std::string::iterator s_it = s_start;
245 while ( s_it != s_end )
248 if ( ( *s_it ) >=
'0' && ( *s_it ) <=
'9' )
250 sIndex =
static_cast< int >( s_it - s_start );
254 while ( s_it != origFileName.end() && ( *s_it ) >=
'0' && ( *s_it ) <=
'9' )
260 ( s_it - s_start ) - sIndex);
270 this->SetProgress( 0.25 );
292 return ( StartAndLengthNumericalGroup.first.size() >= 9 );
301 std::string unixArchetype = iFilename;
303 itksys::SystemTools::ConvertToUnixSlashes(unixArchetype);
304 if ( itksys::SystemTools::FileIsDirectory( unixArchetype.c_str() ) )
307 std::cout <<
"iFilename is directory" << std::endl;
308 return std::string();
313 std::string origFileName =
314 itksys::SystemTools::GetFilenameName( unixArchetype.c_str() );
315 std::string fileNamePath =
316 itksys::SystemTools::GetFilenamePath( unixArchetype.c_str() );
317 std::string pathPrefix;
318 std::string ofileNameModified;
321 for (
unsigned int j = 0; j < origFileName.length(); j++ )
323 char oneChar = origFileName[j];
337 ofileNameModified +=
"\\";
339 ofileNameModified += oneChar;
345 if ( fileNamePath ==
"" )
354 return ofileNameModified;
366 std::string::const_iterator s_start = iFilename.begin();
367 std::string::const_iterator s_it = s_start;
368 std::string::const_iterator s_end = iFilename.end();
372 while ( s_it != s_end )
375 if ( ( *s_it ) >=
'0' && ( *s_it ) <=
'9' )
377 sIndex =
static_cast< int >( s_it - s_start );
382 oStartAndLength.first.push_back(sIndex);
385 while ( ( s_it != s_end ) && ( ( *s_it ) >=
'0' ) && ( ( *s_it ) <=
'9' ) )
391 oStartAndLength.second.push_back(
392 static_cast< int >( s_it - s_start ) - sIndex);
401 return oStartAndLength;
408 const std::vector< unsigned int > & iNumericalValues)
410 ioTempInfo.
m_CCoord = iNumericalValues[0];
411 ioTempInfo.
m_RCoord = iNumericalValues[1];
412 ioTempInfo.
m_YCoord = iNumericalValues[2];
413 ioTempInfo.
m_XCoord = iNumericalValues[3];
414 ioTempInfo.
m_TCoord = iNumericalValues[4];
415 ioTempInfo.
m_ZCoord = iNumericalValues[5];
422 const std::vector< unsigned int > & iNumericalValues)
424 ioTempInfo.
m_PCoord = iNumericalValues[0];
425 ioTempInfo.
m_CCoord = iNumericalValues[1];
426 ioTempInfo.
m_RCoord = iNumericalValues[2];
430 ioTempInfo.
m_TCoord = iNumericalValues[6];
431 ioTempInfo.
m_Channel = iNumericalValues[7];
432 ioTempInfo.
m_ZCoord = iNumericalValues[8];
void NewMegaCaptureFile(GoFigureFileInfoHelper &ioTempInfo, const std::vector< unsigned int > &iNumericalValues)
Used for the database version2.
GoFigureFileInfoHelperMultiIndexContainer m_OutputFileList
std::string GetHeaderFilename()
GoFigureFileInfoHelperMultiIndexContainer GetOutput()
int m_NbSignificantMegaCaptureNumGroup
std::string m_HeaderFileName
StringVectorType m_FileNameS
std::pair< IntVectorType, IntVectorType > PairIntVectorType
void OldMegaCaptureFile(GoFigureFileInfoHelper &ioTempInfo, const std::vector< unsigned int > &iNumericalValues)
Used for the database version1.
static std::string CleanFileName(const std::string &iFilename)
return a modified cleaned filename
static bool IsNewMegaCapture(const std::string &iFilename)
return true if the filename is of new megacapture format, false if it is the old one ...
static bool AreTheseNumericalGroupNewMegaCapture(PairIntVectorType StartAndLengthNumericalGroup)
PairIntVectorType m_StartAndLengthNumGroup
static PairIntVectorType GetStartAndLengthOfNumericalGroupFilename(const std::string &iFilename)
return the list of the Index and the list of the length of all the numerical group present in the fil...
void SetFileName(const std::string &iName)