17#include <mitkLocaleSwitch.h>
22#include <itksys/SystemTools.hxx>
28 "MITK USDevice Writer (XML)"), m_Filename(
"")
50 MITK_WARN <<
"Cannot write to file - empty filename!";
57 m_Filename = filename;
62 tinyxml2::XMLDocument document;
63 document.InsertEndChild(document.NewDeclaration());
67 this->CreateXmlInformationOfUltrasoundDeviceTag(document, ultrasoundDeviceTag, config);
72 this->CreateXmlInformationOfGeneralSettingsTag(ultrasoundDeviceTag, generalSettingsTag, config);
75 this->CreateXmlInformationOfProbesTag(ultrasoundDeviceTag, config);
77 return document.SaveFile(m_Filename.c_str()) == tinyxml2::XML_SUCCESS;
81 tinyxml2::XMLDocument &document, tinyxml2::XMLElement* ultrasoundDeviceTag,
99 document.InsertEndChild(ultrasoundDeviceTag);
113 parentTag->InsertEndChild(generalSettingsTag);
118 if (config.
probes.size() != 0)
120 auto* doc = parentTag->GetDocument();
122 parentTag->InsertEndChild(probesTag);
124 for (
size_t index = 0; index < config.
probes.size(); ++index)
127 probesTag->InsertEndChild(probeTag);
129 mitk::USProbe::Pointer probe = config.
probes.at(index);
131 std::map<int, mitk::Vector3D> depthsAndSpacing = probe->GetDepthsAndSpacing();
132 if (depthsAndSpacing.size() != 0)
135 probeTag->InsertEndChild(depthsTag);
136 for (std::map<int, mitk::Vector3D>::iterator it = depthsAndSpacing.begin(); it != depthsAndSpacing.end(); it++)
140 depthsTag->InsertEndChild(depthTag);
145 depthTag->InsertEndChild(spacingTag);
149 probeTag->InsertEndChild(croppingTag);
void CreateXmlInformationOfUltrasoundDeviceTag(tinyxml2::XMLDocument &document, tinyxml2::XMLElement *ultrasoundDeviceTag, mitk::USDeviceReaderXML::USDeviceConfigData &config)
Creates the xml ULTRASOUNDDEVICE-Tag entry of the ultrasound video device configuration file.
void CreateXmlInformationOfGeneralSettingsTag(tinyxml2::XMLElement *parentTag, tinyxml2::XMLElement *generalSettingsTag, mitk::USDeviceReaderXML::USDeviceConfigData &config)
Creates the xml GENERALSETTINGS-Tag entry of the ultrasound video device configuration file.
bool WriteUltrasoundDeviceConfiguration(mitk::USDeviceReaderXML::USDeviceConfigData &config)
Writes the configuration settings of an ultrasound device to a xml-file.
~USDeviceWriterXML() override
void CreateXmlInformationOfProbesTag(tinyxml2::XMLElement *parentTag, mitk::USDeviceReaderXML::USDeviceConfigData &config)
Creates the xml PROBES-Tag entry of the ultrasound video device configuration file....
void SetFilename(std::string filename)
Sets the filename of the ultrasound device configuration file which should be created.
mitk::USDeviceWriterXML * Clone() const override
A device holds information about it's model, make and the connected probes. It is the common super cl...
static const char * ATTR_RESOLUTIONHEIGHT
static const char * ATTR_DEPTH
static const char * ATTR_TYPE
static const char * ATTR_SOURCEID
static const char * ATTR_BOTTOM
static const char * ATTR_IMAGESTREAMS
static const char * ATTR_X
static const char * ATTR_RESOLUTIONOVERRIDE
static const char * ATTR_COMMENT
static const char * ATTR_OPENCVPORT
static const char * ATTR_FILEVERS
static const char * ATTR_FILEPATH
static const char * ATTR_TOP
static const char * TAG_DEPTH
static const char * TAG_SPACING
static const char * TAG_PROBE
static const char * ATTR_GREYSCALE
static const char * TAG_CROPPING
static const char * ATTR_PORT
static const char * ATTR_SERVER
static const char * ATTR_NAME
static const char * ATTR_MANUFACTURER
static const char * TAG_GENERALSETTINGS
static const char * TAG_PROBES
static const char * TAG_DEPTHS
static const char * TAG_ULTRASOUNDDEVICE
static const char * ATTR_LEFT
static const char * ATTR_MODEL
static const char * ATTR_RIGHT
static const char * ATTR_RESOLUTIONWIDTH
static const char * ATTR_Y
static const char * ATTR_HOST
bool useResolutionOverride
std::vector< mitk::USProbe::Pointer > probes
std::string filepathVideoSource