17 #include "vtkObjectFactory.h"
21 #include <vtksys/RegularExpression.hxx>
22 #include <vtksys/SystemTools.hxx>
28 reg_ex(new
vtksys::RegularExpression(
"^(.*)\\.([0-9.]+)$"))
31 reg_ex2(new
vtksys::RegularExpression(
"^(.*)(\\.|_|-)([0-9.]+)\\.(.*)$"))
35 reg_ex3(new
vtksys::RegularExpression(
"^(.*)([a-zA-Z])([0-9.]+)\\.(.*)$"))
39 reg_ex4(new
vtksys::RegularExpression(
"^([0-9.]+)(\\.|_|-)(.*)\\.(.*)$"))
43 reg_ex5(new
vtksys::RegularExpression(
"^([0-9.]+)([a-zA-Z])(.*)\\.(.*)$"))
48 reg_ex_last(new
vtksys::RegularExpression(
"^(.*[^0-9])([0-9]+)([^0-9]*)$"))
64 this->SetSequenceName(
NULL);
71 if (this->
reg_ex->find(file))
73 this->SetSequenceName(this->
reg_ex->match(1).c_str());
77 else if (this->
reg_ex2->find(file))
79 this->SetSequenceName(std::string(this->
reg_ex2->match(1) + this->reg_ex2->match(2) +
".." +
80 this->reg_ex2->match(4))
85 else if (this->
reg_ex3->find(file))
87 this->SetSequenceName(std::string(this->
reg_ex3->match(1) + this->reg_ex3->match(2) +
".." +
88 this->reg_ex3->match(4))
93 else if (this->
reg_ex4->find(file))
95 this->SetSequenceName(std::string(
".." + this->
reg_ex4->match(2) + this->reg_ex4->match(3) +
96 "." + this->reg_ex4->match(4))
101 else if (this->
reg_ex5->find(file))
103 this->SetSequenceName(std::string(
".." + this->
reg_ex5->match(2) + this->reg_ex5->match(3) +
104 "." + this->reg_ex5->match(4))
111 std::string fname_wo_ext = vtksys::SystemTools::GetFilenameWithoutExtension(file);
112 std::string ext = vtksys::SystemTools::GetFilenameExtension(file);
115 this->SetSequenceName(
116 (this->
reg_ex_last->match(1) +
".." + this->reg_ex_last->match(3) + ext).c_str());
127 this->Superclass::PrintSelf(os, indent);
~vtkFileSequenceParser() override
void PrintSelf(ostream &os, vtkIndent indent) override
bool ParseFileSequence(const char *file)
vtksys::RegularExpression * reg_ex_last
vtksys::RegularExpression * reg_ex
vtksys::RegularExpression * reg_ex4
vtksys::RegularExpression * reg_ex3
vtksys::RegularExpression * reg_ex5
vtksys::RegularExpression * reg_ex2
vtkStandardNewMacro(vtkFileSequenceParser)