Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitk::PointSetWriter Class Reference

XML-based writer for mitk::PointSets. More...

#include <mitkPointSetWriter.h>

Inheritance diagram for mitk::PointSetWriter:
Collaboration diagram for mitk::PointSetWriter:

Public Types

typedef mitk::PointSet InputType
 
typedef InputType::Pointer InputTypePointer
 
- Public Types inherited from mitk::FileWriter
typedef FileWriter Self
 
typedef itk::ProcessObject Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 

Public Member Functions

 mitkClassMacro (PointSetWriter, mitk::FileWriter)
 
Pointer Clone () const
 
virtual void SetFileName (const char *_arg)
 
virtual const char * GetFileName () const
 
virtual void SetFilePrefix (const char *_arg)
 
virtual const char * GetFilePrefix () const
 
virtual void SetFilePattern (const char *_arg)
 
virtual const char * GetFilePattern () const
 
void SetInput (InputType *input)
 
void SetInput (const unsigned int &num, InputType *input)
 
PointSetGetInput ()
 
PointSetGetInput (const unsigned int &num)
 
std::vector< std::string > GetPossibleFileExtensions () override
 Return the possible file extensions for the data type associated with the writer. More...
 
std::string GetSupportedBaseData () const override
 
std::string GetFileExtension () override
 Return the extension to be added to the filename. More...
 
bool CanWriteDataType (DataNode *) override
 Check if the Writer can write the Content of the. More...
 
std::string GetWritenMIMEType () override
 Return the MimeType of the saved File. More...
 
virtual void SetInput (DataNode *)
 Set the DataTreenode as Input. Important: The Writer always have a SetInput-Function. More...
 
bool GetSuccess () const
 
- Public Member Functions inherited from mitk::FileWriter
virtual std::vector< std::string > GetClassHierarchy () const
 
virtual const char * GetClassName () const
 
bool IsExtensionValid (std::string extension)
 Checks if given extension is valid for file writer. More...
 
virtual std::string GetPossibleFileExtensionsAsString ()
 possible file extensions for the data type associated with the writer as string More...
 
void SetInput (BaseData *data)
 
virtual void Write ()=0
 
virtual bool CanWriteToMemory ()
 Specifies, whether the file writer also can write a file to a memory buffer. More...
 
virtual void SetWriteToMemory (bool write)
 Set/Get functions to advise the file writer to use tis internal memory array as file writing destination. More...
 
virtual bool GetWriteToMemory ()
 
virtual const char * GetMemoryPointer ()
 To be used along with a call of SetWriteToMemory(true). This returns the memory buffer where the file was written. More...
 
virtual unsigned int GetMemorySize ()
 To be used along with a call of SetWriteToMemory(true). This returns the size of the memory buffer where the file was written. More...
 
virtual void ReleaseMemory ()
 CAUTION: It's up to the user to call this function to release the memory buffer after use in case the file writer has written to its memory array. More...
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from mitk::FileWriter
static const char * GetStaticNameOfClass ()
 

Public Attributes

 mitkWriterMacro
 

Static Public Attributes

static const char * XML_POINT_SET
 
static const char * XML_TIME_SERIES
 
static const char * XML_TIME_SERIES_ID
 
static const char * XML_POINT_SET_FILE
 
static const char * XML_FILE_VERSION
 
static const char * XML_POINT
 
static const char * XML_SPEC
 
static const char * XML_ID
 
static const char * XML_X
 
static const char * XML_Y
 
static const char * XML_Z
 
static const char * VERSION_STRING
 

Protected Member Functions

 PointSetWriter ()
 
 ~PointSetWriter () override
 
void GenerateData () override
 
virtual void ResizeInputs (const unsigned int &num)
 
template<typename T >
std::string ConvertToString (T value)
 
void WriteXML (mitk::PointSet *pointSet, std::ofstream &out)
 
void WriteXMLHeader (std::ofstream &file)
 
void WriteStartElement (const char *const tag, std::ofstream &file)
 
void WriteEndElement (const char *const tag, std::ofstream &file, const bool &indent=true)
 
void WriteCharacterData (const char *const data, std::ofstream &file)
 
void WriteStartElement (std::string &tag, std::ofstream &file)
 
void WriteEndElement (std::string &tag, std::ofstream &file, const bool &indent=true)
 
void WriteCharacterData (std::string &data, std::ofstream &file)
 
void WriteIndent (std::ofstream &file)
 
- Protected Member Functions inherited from mitk::FileWriter
 FileWriter ()
 
 ~FileWriter () override
 

Protected Attributes

std::string m_FileName
 
std::string m_FilePrefix
 
std::string m_FilePattern
 
std::string m_Extension
 
std::string m_MimeType
 
unsigned int m_IndentDepth
 
unsigned int m_Indent
 
bool m_Success
 
- Protected Attributes inherited from mitk::FileWriter
bool m_CanWriteToMemory
 
bool m_WriteToMemory
 
char * m_MemoryBuffer
 
unsigned int m_MemoryBufferSize
 

Detailed Description

XML-based writer for mitk::PointSets.

XML-based writer for mitk::PointSets. Multiple PointSets can be written in a single XML file by simply setting multiple inputs to the filter. Writing of multiple XML files according to a given filename pattern is not yet supported.

Deprecated:
(as of 2014_10) Use mitk::IOUtils or mitk::FileReaderRegistry instead.

Definition at line 36 of file mitkPointSetWriter.h.

Member Typedef Documentation

◆ InputType

◆ InputTypePointer

Constructor & Destructor Documentation

◆ PointSetWriter()

mitk::PointSetWriter::PointSetWriter ( )
protected

Constructor.

Definition at line 46 of file mitkPointSetWriter.cpp.

References m_Indent, m_IndentDepth, m_Success, and mitk::PointSet::New().

◆ ~PointSetWriter()

mitk::PointSetWriter::~PointSetWriter ( )
overrideprotected

Virtual destructor.

Definition at line 56 of file mitkPointSetWriter.cpp.

Member Function Documentation

◆ CanWriteDataType()

bool mitk::PointSetWriter::CanWriteDataType ( DataNode input)
overridevirtual

Check if the Writer can write the Content of the.

Reimplemented from mitk::FileWriter.

Definition at line 278 of file mitkPointSetWriter.cpp.

◆ Clone()

Pointer mitk::PointSetWriter::Clone ( ) const

◆ ConvertToString()

template<typename T >
std::string mitk::PointSetWriter::ConvertToString ( value)
protected

Converts an arbitrary type to a string. The type has to support the << operator. This works fine at least for integral data types as float, int, long etc.

Parameters
valuethe value to convert
Returns
the string representation of value

Definition at line 209 of file mitkPointSetWriter.cpp.

Referenced by WriteXML().

◆ GenerateData()

void mitk::PointSetWriter::GenerateData ( )
overrideprotected

◆ GetFileExtension()

std::string mitk::PointSetWriter::GetFileExtension ( )
overridevirtual

Return the extension to be added to the filename.

Reimplemented from mitk::FileWriter.

Definition at line 320 of file mitkPointSetWriter.cpp.

◆ GetFileName()

virtual const char* mitk::PointSetWriter::GetFileName ( ) const
virtual
Returns
the name of the file to be written to disk.

Implements mitk::FileWriter.

◆ GetFilePattern()

virtual const char* mitk::PointSetWriter::GetFilePattern ( ) const
virtual
Warning
multiple write not (yet) supported

Implements mitk::FileWriter.

◆ GetFilePrefix()

virtual const char* mitk::PointSetWriter::GetFilePrefix ( ) const
virtual
Warning
multiple write not (yet) supported

Implements mitk::FileWriter.

◆ GetInput() [1/2]

mitk::PointSet * mitk::PointSetWriter::GetInput ( void  )
Returns
the 0'th input object of the filter.

Definition at line 191 of file mitkPointSetWriter.cpp.

Referenced by GenerateData().

◆ GetInput() [2/2]

mitk::PointSet * mitk::PointSetWriter::GetInput ( const unsigned int &  num)
Parameters
numthe index of the desired output object.
Returns
the n'th input object of the filter.

Definition at line 203 of file mitkPointSetWriter.cpp.

◆ GetPossibleFileExtensions()

std::vector< std::string > mitk::PointSetWriter::GetPossibleFileExtensions ( )
overridevirtual

Return the possible file extensions for the data type associated with the writer.

Implements mitk::FileWriter.

Definition at line 308 of file mitkPointSetWriter.cpp.

◆ GetSuccess()

bool mitk::PointSetWriter::GetSuccess ( ) const
Returns
whether the last write attempt was successful or not.

Definition at line 273 of file mitkPointSetWriter.cpp.

◆ GetSupportedBaseData()

std::string mitk::PointSetWriter::GetSupportedBaseData ( ) const
overridevirtual

Implements mitk::FileWriter.

Definition at line 315 of file mitkPointSetWriter.cpp.

◆ GetWritenMIMEType()

std::string mitk::PointSetWriter::GetWritenMIMEType ( )
overridevirtual

Return the MimeType of the saved File.

Reimplemented from mitk::FileWriter.

Definition at line 303 of file mitkPointSetWriter.cpp.

◆ mitkClassMacro()

mitk::PointSetWriter::mitkClassMacro ( PointSetWriter  ,
mitk::FileWriter   
)

◆ New()

static Pointer mitk::PointSetWriter::New ( )
static

◆ ResizeInputs()

void mitk::PointSetWriter::ResizeInputs ( const unsigned int &  num)
protectedvirtual

Resizes the number of inputs of the writer. The inputs are initialized by empty PointSets

Parameters
numthe new number of inputs

Definition at line 169 of file mitkPointSetWriter.cpp.

References mitk::PointSet::New().

Referenced by SetInput().

◆ SetFileName()

virtual void mitk::PointSetWriter::SetFileName ( const char *  _arg)
virtual

Sets the filename of the file to write.

Parameters
FileNamethe name of the file to write.

Implements mitk::FileWriter.

◆ SetFilePattern()

virtual void mitk::PointSetWriter::SetFilePattern ( const char *  _arg)
virtual
Warning
multiple write not (yet) supported

Implements mitk::FileWriter.

◆ SetFilePrefix()

virtual void mitk::PointSetWriter::SetFilePrefix ( const char *  _arg)
virtual
Warning
multiple write not (yet) supported

Implements mitk::FileWriter.

◆ SetInput() [1/3]

void mitk::PointSetWriter::SetInput ( InputType input)

Sets the 0'th input object for the filter.

Parameters
inputthe first input for the filter.

Definition at line 179 of file mitkPointSetWriter.cpp.

◆ SetInput() [2/3]

void mitk::PointSetWriter::SetInput ( const unsigned int &  num,
InputType input 
)

Sets the n'th input object for the filter. If num is larger than GetNumberOfInputs() the number of inputs is resized appropriately.

Parameters
inputthe n'th input for the filter.

Definition at line 184 of file mitkPointSetWriter.cpp.

References ResizeInputs().

◆ SetInput() [3/3]

void mitk::PointSetWriter::SetInput ( DataNode input)
virtual

Set the DataTreenode as Input. Important: The Writer always have a SetInput-Function.

Definition at line 297 of file mitkPointSetWriter.cpp.

◆ WriteCharacterData() [1/2]

void mitk::PointSetWriter::WriteCharacterData ( const char *const  data,
std::ofstream &  file 
)
protected

Write character data inside a tag.

Definition at line 247 of file mitkPointSetWriter.cpp.

Referenced by GenerateData(), and WriteXML().

◆ WriteCharacterData() [2/2]

void mitk::PointSetWriter::WriteCharacterData ( std::string &  data,
std::ofstream &  file 
)
protected

Write character data inside a tag.

Definition at line 262 of file mitkPointSetWriter.cpp.

◆ WriteEndElement() [1/2]

void mitk::PointSetWriter::WriteEndElement ( const char *const  tag,
std::ofstream &  file,
const bool &  indent = true 
)
protected

Write an end element tag End-Elements following character data should pass indent = false.

Definition at line 236 of file mitkPointSetWriter.cpp.

Referenced by GenerateData(), and WriteXML().

◆ WriteEndElement() [2/2]

void mitk::PointSetWriter::WriteEndElement ( std::string &  tag,
std::ofstream &  file,
const bool &  indent = true 
)
protected

Write an end element tag

Definition at line 257 of file mitkPointSetWriter.cpp.

◆ WriteIndent()

void mitk::PointSetWriter::WriteIndent ( std::ofstream &  file)
protected

Writes empty spaces to the stream according to m_IndentDepth and m_Indent

Definition at line 267 of file mitkPointSetWriter.cpp.

Referenced by WriteStartElement().

◆ WriteStartElement() [1/2]

void mitk::PointSetWriter::WriteStartElement ( const char *const  tag,
std::ofstream &  file 
)
protected

Write a start element tag

Definition at line 228 of file mitkPointSetWriter.cpp.

References WriteIndent().

Referenced by GenerateData(), and WriteXML().

◆ WriteStartElement() [2/2]

void mitk::PointSetWriter::WriteStartElement ( std::string &  tag,
std::ofstream &  file 
)
protected

Write a start element tag

Definition at line 252 of file mitkPointSetWriter.cpp.

◆ WriteXML()

void mitk::PointSetWriter::WriteXML ( mitk::PointSet pointSet,
std::ofstream &  out 
)
protected

Writes an XML representation of the given point set to an outstream. The XML-Header an root node is not included!

Parameters
pointSetthe point set to be converted to xml
outthe stream to write to.

Definition at line 119 of file mitkPointSetWriter.cpp.

References ConvertToString(), mitk::PointSet::GetPointSet(), mitk::PointSet::GetSpecificationTypeInfo(), mitk::BaseData::GetTimeSteps(), WriteCharacterData(), WriteEndElement(), WriteStartElement(), XML_ID, XML_POINT, XML_POINT_SET, XML_SPEC, XML_TIME_SERIES, XML_TIME_SERIES_ID, XML_X, XML_Y, and XML_Z.

Referenced by GenerateData().

◆ WriteXMLHeader()

void mitk::PointSetWriter::WriteXMLHeader ( std::ofstream &  file)
protected

Writes an standard xml header to the given stream.

Parameters
filethe stream in which the header is written.

Definition at line 223 of file mitkPointSetWriter.cpp.

Referenced by GenerateData().

Member Data Documentation

◆ m_Extension

std::string mitk::PointSetWriter::m_Extension
protected

Definition at line 217 of file mitkPointSetWriter.h.

◆ m_FileName

std::string mitk::PointSetWriter::m_FileName
protected

Definition at line 211 of file mitkPointSetWriter.h.

Referenced by GenerateData().

◆ m_FilePattern

std::string mitk::PointSetWriter::m_FilePattern
protected

Definition at line 215 of file mitkPointSetWriter.h.

◆ m_FilePrefix

std::string mitk::PointSetWriter::m_FilePrefix
protected

Definition at line 213 of file mitkPointSetWriter.h.

◆ m_Indent

unsigned int mitk::PointSetWriter::m_Indent
protected

Definition at line 223 of file mitkPointSetWriter.h.

Referenced by PointSetWriter().

◆ m_IndentDepth

unsigned int mitk::PointSetWriter::m_IndentDepth
protected

Definition at line 221 of file mitkPointSetWriter.h.

Referenced by GenerateData(), and PointSetWriter().

◆ m_MimeType

std::string mitk::PointSetWriter::m_MimeType
protected

Definition at line 219 of file mitkPointSetWriter.h.

Referenced by GenerateData().

◆ m_Success

bool mitk::PointSetWriter::m_Success
protected

Definition at line 225 of file mitkPointSetWriter.h.

Referenced by GenerateData(), and PointSetWriter().

◆ mitkWriterMacro

mitk::PointSetWriter::mitkWriterMacro

Definition at line 41 of file mitkPointSetWriter.h.

◆ VERSION_STRING

const char * mitk::PointSetWriter::VERSION_STRING
static

Definition at line 250 of file mitkPointSetWriter.h.

Referenced by GenerateData().

◆ XML_FILE_VERSION

const char * mitk::PointSetWriter::XML_FILE_VERSION
static

Definition at line 236 of file mitkPointSetWriter.h.

Referenced by GenerateData().

◆ XML_ID

const char * mitk::PointSetWriter::XML_ID
static

◆ XML_POINT

const char * mitk::PointSetWriter::XML_POINT
static

◆ XML_POINT_SET

const char * mitk::PointSetWriter::XML_POINT_SET
static

◆ XML_POINT_SET_FILE

const char * mitk::PointSetWriter::XML_POINT_SET_FILE
static

Definition at line 234 of file mitkPointSetWriter.h.

Referenced by GenerateData().

◆ XML_SPEC

const char * mitk::PointSetWriter::XML_SPEC
static

Definition at line 240 of file mitkPointSetWriter.h.

Referenced by WriteXML().

◆ XML_TIME_SERIES

const char * mitk::PointSetWriter::XML_TIME_SERIES
static

Definition at line 230 of file mitkPointSetWriter.h.

Referenced by WriteXML().

◆ XML_TIME_SERIES_ID

const char * mitk::PointSetWriter::XML_TIME_SERIES_ID
static

Definition at line 232 of file mitkPointSetWriter.h.

Referenced by WriteXML().

◆ XML_X

const char * mitk::PointSetWriter::XML_X
static

◆ XML_Y

const char * mitk::PointSetWriter::XML_Y
static

◆ XML_Z

const char * mitk::PointSetWriter::XML_Z
static

The documentation for this class was generated from the following files: