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

Method Write

Modules/Core/src/IO/mitkImageVtkLegacyIO.cpp:73–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71 }
72
73 void ImageVtkLegacyIO::Write()
74 {
75 ValidateOutputLocation();
76
77 const auto *input = dynamic_cast<const Image *>(this->GetInput());
78
79 vtkSmartPointer<vtkStructuredPointsWriter> writer = vtkSmartPointer<vtkStructuredPointsWriter>::New();
80
81 // The legacy vtk image writer cannot write to streams
82 LocalFile localFile(this);
83 writer->SetFileName(localFile.GetFileName().c_str());
84
85 if (us::any_cast<bool>(GetWriterOption("Save as binary file")))
86 {
87 writer->SetFileTypeToBinary();
88 }
89
90 ImageVtkReadAccessor vtkReadAccessor(Image::ConstPointer(input), nullptr, input->GetVtkImageData());
91 writer->SetInputData(const_cast<vtkImageData *>(vtkReadAccessor.GetVtkImageData()));
92
93 if (writer->Write() == 0 || writer->GetErrorCode() != 0)
94 {
95 mitkThrow() << "vtkStructuredPointesWriter error: "
96 << vtkErrorCode::GetStringFromErrorCode(writer->GetErrorCode());
97 }
98 }
99
100 IFileIO::ConfidenceLevel ImageVtkLegacyIO::GetWriterConfidenceLevel() const
101 {

Callers

nothing calls this directly

Calls 5

NewFunction · 0.50
GetInputMethod · 0.45
SetFileNameMethod · 0.45
GetFileNameMethod · 0.45
GetVtkImageDataMethod · 0.45

Tested by

no test coverage detected