| 104 | } |
| 105 | |
| 106 | void ImageVtkXmlIO::Write() |
| 107 | { |
| 108 | ValidateOutputLocation(); |
| 109 | |
| 110 | const auto *input = dynamic_cast<const Image *>(this->GetInput()); |
| 111 | |
| 112 | vtkSmartPointer<VtkXMLImageDataWriter> writer = vtkSmartPointer<VtkXMLImageDataWriter>::New(); |
| 113 | if (this->GetOutputStream()) |
| 114 | { |
| 115 | writer->SetStream(this->GetOutputStream()); |
| 116 | } |
| 117 | else |
| 118 | { |
| 119 | writer->SetFileName(this->GetOutputLocation().c_str()); |
| 120 | } |
| 121 | |
| 122 | ImageVtkReadAccessor vtkReadAccessor(Image::ConstPointer(input), nullptr, input->GetVtkImageData()); |
| 123 | writer->SetInputData(const_cast<vtkImageData *>(vtkReadAccessor.GetVtkImageData())); |
| 124 | |
| 125 | if (writer->Write() == 0 || writer->GetErrorCode() != 0) |
| 126 | { |
| 127 | mitkThrow() << "vtkXMLImageDataWriter error: " << vtkErrorCode::GetStringFromErrorCode(writer->GetErrorCode()); |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | IFileIO::ConfidenceLevel ImageVtkXmlIO::GetWriterConfidenceLevel() const |
| 132 | { |
nothing calls this directly
no test coverage detected