57 if(pathToFile.substr(pathToFile.length() - 4, 4).compare(
".ttk") == 0) {
58 this->topologicalCompressionReader->SetDebugLevel(this->
debugLevel_);
59 return readFileLocal_(pathToFile, this->topologicalCompressionReader);
60 }
else if(pathToFile.substr(pathToFile.size() - 4) ==
".tif"
61 || pathToFile.substr(pathToFile.size() - 5) ==
".tiff") {
63 }
else if(pathToFile.substr(pathToFile.length() - 4, 4).compare(
".png")
68 std::ifstream is(pathToFile.data());
71 bool const isXML = std::string(prefix).compare(
"<VTKFile ") == 0
72 || std::string(prefix).compare(
"<?xml ver") == 0;
76 return readFileLocal_(pathToFile, this->xmlGenericDataObjectReader);
87 auto objectAsMB = vtkMultiBlockDataSet::SafeDownCast(
object);
89 for(
size_t i = 0, j = objectAsMB->GetNumberOfBlocks(); i < j; i++)
92 auto ofd =
object->GetFieldData();
93 for(
size_t i = 0, j = fd->GetNumberOfArrays(); i < j; i++)
94 ofd->AddArray(fd->GetAbstractArray(i));
101 vtkInformationVector **inputVector,
102 vtkInformationVector *outputVector) {
106 auto inputTable = vtkTable::GetData(inputVector[0]);
108 auto outputMB = vtkMultiBlockDataSet::GetData(outputVector);
110 size_t const n = inputTable->GetNumberOfRows();
111 size_t const m = inputTable->GetNumberOfColumns();
114 {{
"#Files", std::to_string(n)}, {
"FILE Column", this->FilepathColumnName}});
120 auto paths = inputTable->GetColumnByName(this->FilepathColumnName.data());
122 this->
printErr(
"Table does not have column '" + this->FilepathColumnName
128 for(
size_t i = 0; i < n; i++) {
134 auto path = paths->GetVariantValue(i).ToString();
135 auto file = path.substr(path.find_last_of(
"/") + 1);
138 this->
printMsg(
"Reading (" + std::to_string(i + 1) +
"/"
139 + std::to_string(n) +
"): \"" + file +
"\"",
144 std::ifstream
const infile(path.data());
145 bool const exists = infile.good();
147 this->
printErr(
"File does not exist.");
153 this->
printErr(
"Unable to read file.");
157 outputMB->SetBlock(i, readerOutput);
162 auto block = outputMB->GetBlock(i);
163 auto fieldData = block->GetFieldData();
164 for(
size_t j = 0; j < m; j++) {
165 auto columnName = inputTable->GetColumnName(j);
168 if(!fieldData->HasArray(columnName)
169 || columnName == this->FilepathColumnName) {
170 if(inputTable->GetColumn(j)->IsNumeric()) {
172 c->SetName(columnName);
173 c->SetNumberOfValues(1);
174 c->SetValue(0, inputTable->GetValue(i, j).ToDouble());
175 fieldData->AddArray(c);
178 c->SetName(columnName);
179 c->SetNumberOfValues(1);
180 c->SetValue(0, inputTable->GetValue(i, j).ToString());
181 fieldData->AddArray(c);
186 if(this->AddFieldDataRecursively)
189 this->
printMsg(
"Reading (" + std::to_string(i + 1) +
"/"
190 + std::to_string(n) +
"): \"" + file +
"\"",
198 this->
printMsg(
"Complete (#products: " + std::to_string(n) +
")", 1,
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/|__ _|"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)