23 #include <vtkErrorCode.h>
24 #include <vtkSmartPointer.h>
25 #include <vtkStructuredPoints.h>
26 #include <vtkStructuredPointsReader.h>
27 #include <vtkStructuredPointsWriter.h>
35 defaultOptions[
"Save as binary file"] =
false;
45 reader->SetFileName(fileName.c_str());
48 if (reader->GetOutput() != NULL)
51 output->Initialize(reader->GetOutput());
52 output->SetVolume(reader->GetOutput()->GetScalarPointer());
53 std::vector<BaseData::Pointer> result;
54 result.push_back(output.GetPointer());
59 mitkThrow() <<
"vtkStructuredPointsReader error: "
60 << vtkErrorCode::GetStringFromErrorCode(reader->GetErrorCode());
70 if (reader->IsFileStructuredPoints())
87 writer->SetFileName(localFile.
GetFileName().c_str());
91 writer->SetFileTypeToBinary();
95 writer->SetInputData(const_cast<vtkImageData *>(vtkReadAccessor.GetVtkImageData()));
97 if (writer->Write() == 0 || writer->GetErrorCode() != 0)
99 mitkThrow() <<
"vtkStructuredPointesWriter error: "
100 << vtkErrorCode::GetStringFromErrorCode(writer->GetErrorCode());
virtual ConfidenceLevel GetReaderConfidenceLevel() const override
std::string GetFileName()
DataCollection - Class to facilitate loading/accessing structured data.
void ValidateOutputLocation() const
std::map< std::string, us::Any > Options
Options for reading or writing data.
virtual vtkImageData * GetVtkImageData(int t=0, int n=0)
Get a volume at a specific time t of channel n as a vtkImageData.
std::string GetLocalFileName() const
Get a local file name for reading.
std::pair< us::ServiceRegistration< IFileReader >, us::ServiceRegistration< IFileWriter > > RegisterService(us::ModuleContext *context=us::GetModuleContext())
virtual const BaseData * GetInput() const override
Get the input data set via SetInput().
Image class for storing images.
static const char * GetStaticNameOfClass()
A local file representation for streams.
virtual void Write() override
Write the base data to the specified location or output stream.
ImageVtkReadAccessor class provides any image read access which is required by Vtk methods...
virtual ConfidenceLevel GetReaderConfidenceLevel() const override
virtual ConfidenceLevel GetWriterConfidenceLevel() const override
us::Any GetWriterOption(const std::string &name) const
ConfidenceLevel
A confidence level describing the confidence of the reader or writer in handling the given data...
virtual ConfidenceLevel GetWriterConfidenceLevel() const override
unsigned int GetDimension() const
Get dimension of the image.
Abstract class for implementing a reader and writer.
void SetDefaultWriterOptions(const Options &defaultOptions)
virtual std::vector< BaseData::Pointer > Read() override
Reads a path or stream and creates a list of BaseData objects.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.