Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
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.

◆ ~PointSetWriter()

mitk::PointSetWriter::~PointSetWriter ( )
overrideprotected

Virtual destructor.

Member Function Documentation

◆ CanWriteDataType()

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

Check if the Writer can write the Content of the.

Reimplemented from mitk::FileWriter.

◆ 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

◆ GenerateData()

void mitk::PointSetWriter::GenerateData ( )
overrideprotected

Writes the XML file

◆ GetFileExtension()

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

Return the extension to be added to the filename.

Reimplemented from mitk::FileWriter.

◆ 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]

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

◆ GetInput() [2/2]

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.

◆ 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.

◆ GetSuccess()

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

◆ GetSupportedBaseData()

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

Implements mitk::FileWriter.

◆ GetWritenMIMEType()

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

Return the MimeType of the saved File.

Reimplemented from mitk::FileWriter.

◆ mitkClassMacro()

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

◆ New()

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

◆ ResizeInputs()

virtual 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

◆ SetFileName()

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

Sets the filename 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 ( 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
num
inputthe n'th input for the filter.

◆ SetInput() [2/3]

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

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

◆ SetInput() [3/3]

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

Sets the 0'th input object for the filter.

Parameters
inputthe first input for the filter.

◆ WriteCharacterData() [1/2]

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

Write character data inside a tag.

◆ WriteCharacterData() [2/2]

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

Write character data inside a tag.

◆ 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.

◆ WriteEndElement() [2/2]

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

Write an end element tag

◆ WriteIndent()

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

Writes empty spaces to the stream according to m_IndentDepth and m_Indent

◆ WriteStartElement() [1/2]

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

Write a start element tag

◆ WriteStartElement() [2/2]

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

Write a start element tag

◆ 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.

◆ 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.

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.

◆ 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.

◆ m_IndentDepth

unsigned int mitk::PointSetWriter::m_IndentDepth
protected

Definition at line 221 of file mitkPointSetWriter.h.

◆ m_MimeType

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

Definition at line 219 of file mitkPointSetWriter.h.

◆ m_Success

bool mitk::PointSetWriter::m_Success
protected

Definition at line 225 of file mitkPointSetWriter.h.

◆ 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.

◆ XML_FILE_VERSION

const char* mitk::PointSetWriter::XML_FILE_VERSION
static

Definition at line 236 of file mitkPointSetWriter.h.

◆ XML_ID

const char* mitk::PointSetWriter::XML_ID
static

Definition at line 242 of file mitkPointSetWriter.h.

◆ XML_POINT

const char* mitk::PointSetWriter::XML_POINT
static

Definition at line 238 of file mitkPointSetWriter.h.

◆ XML_POINT_SET

const char* mitk::PointSetWriter::XML_POINT_SET
static

Definition at line 228 of file mitkPointSetWriter.h.

◆ XML_POINT_SET_FILE

const char* mitk::PointSetWriter::XML_POINT_SET_FILE
static

Definition at line 234 of file mitkPointSetWriter.h.

◆ XML_SPEC

const char* mitk::PointSetWriter::XML_SPEC
static

Definition at line 240 of file mitkPointSetWriter.h.

◆ XML_TIME_SERIES

const char* mitk::PointSetWriter::XML_TIME_SERIES
static

Definition at line 230 of file mitkPointSetWriter.h.

◆ XML_TIME_SERIES_ID

const char* mitk::PointSetWriter::XML_TIME_SERIES_ID
static

Definition at line 232 of file mitkPointSetWriter.h.

◆ XML_X

const char* mitk::PointSetWriter::XML_X
static

Definition at line 244 of file mitkPointSetWriter.h.

◆ XML_Y

const char* mitk::PointSetWriter::XML_Y
static

Definition at line 246 of file mitkPointSetWriter.h.

◆ XML_Z

const char* mitk::PointSetWriter::XML_Z
static

Definition at line 248 of file mitkPointSetWriter.h.


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