MCPcopy Create free account
hub / github.com/MITK/MITK / GetPolyData

Method GetPolyData

Modules/Core/src/IO/mitkSurfaceVtkIO.cpp:34–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32 }
33
34 vtkSmartPointer<vtkPolyData> SurfaceVtkIO::GetPolyData(unsigned int t, std::string &fileName)
35 {
36 const auto *input = dynamic_cast<const Surface *>(this->GetInput());
37
38 vtkSmartPointer<vtkTransformPolyDataFilter> transformPolyData = vtkSmartPointer<vtkTransformPolyDataFilter>::New();
39
40 // surfaces do not have to exist in all timesteps; therefor, only write valid surfaces
41 if (input->GetVtkPolyData(t) == nullptr)
42 return vtkSmartPointer<vtkPolyData>();
43
44 std::string baseName = this->GetOutputLocation();
45 std::string extension = Utf8Util::Utf8ToLocal8Bit(itksys::SystemTools::GetFilenameExtension(Utf8Util::Local8BitToUtf8(baseName)));
46 if (!extension.empty())
47 {
48 baseName = baseName.substr(0, baseName.size() - extension.size());
49 }
50
51 std::ostringstream ss;
52 ss.imbue(::std::locale::classic());
53
54 BaseGeometry *geometry = input->GetGeometry(t);
55 if (input->GetTimeGeometry()->IsValidTimeStep(t))
56 {
57 if (input->GetTimeGeometry()->CountTimeSteps() > 1)
58 {
59 const TimeBounds &timebounds = input->GetTimeGeometry()->GetTimeBounds(t);
60 ss << baseName << "_S" << std::setprecision(0) << timebounds[0] << "_E" << std::setprecision(0) << timebounds[1]
61 << "_T" << t << extension;
62 }
63 else
64 {
65 // use the original file name
66 ss << this->GetOutputLocation();
67 }
68 }
69 else
70 {
71 MITK_WARN << "Error on write: TimeGeometry invalid of surface " << fileName << ".";
72 return vtkSmartPointer<vtkPolyData>();
73 }
74
75 fileName = ss.str();
76
77 transformPolyData->SetInputData(input->GetVtkPolyData(t));
78 transformPolyData->SetTransform(geometry->GetVtkTransform());
79 transformPolyData->UpdateWholeExtent();
80
81 vtkSmartPointer<vtkPolyData> polyData = transformPolyData->GetOutput();
82 return polyData;
83 }
84
85 IFileIO::ConfidenceLevel SurfaceVtkIO::GetWriterConfidenceLevel() const
86 {

Callers 3

WriteMethod · 0.80
WriteMethod · 0.80
WriteMethod · 0.80

Calls 12

GetOutputLocationMethod · 0.80
GetGeometryMethod · 0.80
NewFunction · 0.50
GetInputMethod · 0.45
GetVtkPolyDataMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
IsValidTimeStepMethod · 0.45
CountTimeStepsMethod · 0.45
GetTimeBoundsMethod · 0.45
GetVtkTransformMethod · 0.45
GetOutputMethod · 0.45

Tested by

no test coverage detected