Medical Imaging Interaction Toolkit  2016.11.0
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)
 
virtual std::vector< std::string > GetPossibleFileExtensions () override
 Return the possible file extensions for the data type associated with the writer. More...
 
virtual std::string GetSupportedBaseData () const override
 
virtual std::string GetFileExtension () override
 Return the extension to be added to the filename. More...
 
virtual bool CanWriteDataType (DataNode *) override
 Check if the Writer can write the Content of the. More...
 
virtual 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 ()
 
virtual ~PointSetWriter ()
 
virtual 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 ()
 
virtual ~FileWriter ()
 

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 40 of file mitkPointSetWriter.h.

Member Typedef Documentation

Constructor & Destructor Documentation

mitk::PointSetWriter::PointSetWriter ( )
protected

Constructor.

Definition at line 50 of file mitkPointSetWriter.cpp.

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

mitk::PointSetWriter::~PointSetWriter ( )
protectedvirtual

Virtual destructor.

Definition at line 60 of file mitkPointSetWriter.cpp.

Member Function Documentation

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

Check if the Writer can write the Content of the.

Reimplemented from mitk::FileWriter.

Definition at line 282 of file mitkPointSetWriter.cpp.

Pointer mitk::PointSetWriter::Clone ( ) const
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 213 of file mitkPointSetWriter.cpp.

void mitk::PointSetWriter::GenerateData ( )
overrideprotectedvirtual

Writes the XML file

Definition at line 64 of file mitkPointSetWriter.cpp.

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

Return the extension to be added to the filename.

Reimplemented from mitk::FileWriter.

Definition at line 324 of file mitkPointSetWriter.cpp.

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

Implements mitk::FileWriter.

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

Implements mitk::FileWriter.

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

Implements mitk::FileWriter.

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

Definition at line 195 of file mitkPointSetWriter.cpp.

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 207 of file mitkPointSetWriter.cpp.

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 312 of file mitkPointSetWriter.cpp.

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

Definition at line 277 of file mitkPointSetWriter.cpp.

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

Implements mitk::FileWriter.

Definition at line 319 of file mitkPointSetWriter.cpp.

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

Return the MimeType of the saved File.

Reimplemented from mitk::FileWriter.

Definition at line 307 of file mitkPointSetWriter.cpp.

mitk::PointSetWriter::mitkClassMacro ( PointSetWriter  ,
mitk::FileWriter   
)
static Pointer mitk::PointSetWriter::New ( )
static
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 173 of file mitkPointSetWriter.cpp.

References mitk::PointSet::New().

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.

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

Implements mitk::FileWriter.

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

Implements mitk::FileWriter.

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 183 of file mitkPointSetWriter.cpp.

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 188 of file mitkPointSetWriter.cpp.

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

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

Definition at line 301 of file mitkPointSetWriter.cpp.

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

Write character data inside a tag.

Definition at line 251 of file mitkPointSetWriter.cpp.

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

Write character data inside a tag.

Definition at line 266 of file mitkPointSetWriter.cpp.

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 240 of file mitkPointSetWriter.cpp.

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

Write an end element tag

Definition at line 261 of file mitkPointSetWriter.cpp.

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

Writes empty spaces to the stream according to m_IndentDepth and m_Indent

Definition at line 271 of file mitkPointSetWriter.cpp.

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

Write a start element tag

Definition at line 232 of file mitkPointSetWriter.cpp.

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

Write a start element tag

Definition at line 256 of file mitkPointSetWriter.cpp.

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 123 of file mitkPointSetWriter.cpp.

References mitk::PointSet::GetPointSet(), mitk::PointSet::GetSpecificationTypeInfo(), and mitk::BaseData::GetTimeSteps().

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 227 of file mitkPointSetWriter.cpp.

Member Data Documentation

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

Definition at line 219 of file mitkPointSetWriter.h.

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

Definition at line 213 of file mitkPointSetWriter.h.

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

Definition at line 217 of file mitkPointSetWriter.h.

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

Definition at line 215 of file mitkPointSetWriter.h.

unsigned int mitk::PointSetWriter::m_Indent
protected

Definition at line 225 of file mitkPointSetWriter.h.

Referenced by PointSetWriter().

unsigned int mitk::PointSetWriter::m_IndentDepth
protected

Definition at line 223 of file mitkPointSetWriter.h.

Referenced by PointSetWriter().

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

Definition at line 221 of file mitkPointSetWriter.h.

bool mitk::PointSetWriter::m_Success
protected

Definition at line 227 of file mitkPointSetWriter.h.

Referenced by PointSetWriter().

mitk::PointSetWriter::mitkWriterMacro

Definition at line 45 of file mitkPointSetWriter.h.

const char * mitk::PointSetWriter::VERSION_STRING
static

Definition at line 252 of file mitkPointSetWriter.h.

const char * mitk::PointSetWriter::XML_FILE_VERSION
static

Definition at line 238 of file mitkPointSetWriter.h.

const char * mitk::PointSetWriter::XML_ID
static
const char * mitk::PointSetWriter::XML_POINT
static
const char * mitk::PointSetWriter::XML_POINT_SET
static
const char * mitk::PointSetWriter::XML_POINT_SET_FILE
static

Definition at line 236 of file mitkPointSetWriter.h.

const char * mitk::PointSetWriter::XML_SPEC
static

Definition at line 242 of file mitkPointSetWriter.h.

const char * mitk::PointSetWriter::XML_TIME_SERIES
static

Definition at line 232 of file mitkPointSetWriter.h.

const char * mitk::PointSetWriter::XML_TIME_SERIES_ID
static

Definition at line 234 of file mitkPointSetWriter.h.

const char * mitk::PointSetWriter::XML_X
static
const char * mitk::PointSetWriter::XML_Y
static
const char * mitk::PointSetWriter::XML_Z
static

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