diff --git a/Examples/FirstSteps/NewModule/autoload/IO/mitkExampleDataStructureReaderService.cpp b/Examples/FirstSteps/NewModule/autoload/IO/mitkExampleDataStructureReaderService.cpp index 0fd2a438da..1bfdb684f6 100644 --- a/Examples/FirstSteps/NewModule/autoload/IO/mitkExampleDataStructureReaderService.cpp +++ b/Examples/FirstSteps/NewModule/autoload/IO/mitkExampleDataStructureReaderService.cpp @@ -1,91 +1,91 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "mitkExampleDataStructureReaderService.h" // mitk includes #include "mitkExampleIOMimeTypes.h" #include "mitkGeometry3D.h" #include // itk includes #include "itksys/SystemTools.hxx" namespace mitk { ExampleDataStructureReaderService::ExampleDataStructureReaderService(const ExampleDataStructureReaderService &other) : mitk::AbstractFileReader(other) { } ExampleDataStructureReaderService::ExampleDataStructureReaderService() : mitk::AbstractFileReader(CustomMimeType(mitk::ExampleIOMimeTypes::EXAMPLE_MIMETYPE()), "Default reader for the example data structure") { m_ServiceReg = this->RegisterService(); } ExampleDataStructureReaderService::~ExampleDataStructureReaderService() {} - std::vector> ExampleDataStructureReaderService::Read() + std::vector> ExampleDataStructureReaderService::DoRead() { std::vector> result; std::string location = GetInputLocation(); std::string ext = itksys::SystemTools::GetFilenameLastExtension(location); ext = itksys::SystemTools::LowerCase(ext); if (location == "") { MITK_ERROR << "No file name specified."; } try { std::ifstream file(location); std::string content(""); std::string line(""); if (file.is_open()) { while (getline(file, line)) { content += line; content += "\n"; } } else { mitkThrow() << "Could not open file " << this->GetInputLocation() << " for reading."; } mitk::ExampleDataStructure::Pointer outputData = mitk::ExampleDataStructure::New(); outputData->SetData(content); result.push_back(outputData.GetPointer()); MITK_INFO << "Example file read"; } catch (const mitk::Exception& e) { MITK_ERROR << e.GetDescription(); } catch (...) { MITK_ERROR << "Unknown error occurred while trying to read file."; } return result; } } // namespace MITK mitk::ExampleDataStructureReaderService *mitk::ExampleDataStructureReaderService::Clone() const { return new ExampleDataStructureReaderService(*this); } diff --git a/Examples/FirstSteps/NewModule/autoload/IO/mitkExampleDataStructureReaderService.h b/Examples/FirstSteps/NewModule/autoload/IO/mitkExampleDataStructureReaderService.h index 4f1384ed8e..bdc2ab20e8 100644 --- a/Examples/FirstSteps/NewModule/autoload/IO/mitkExampleDataStructureReaderService.h +++ b/Examples/FirstSteps/NewModule/autoload/IO/mitkExampleDataStructureReaderService.h @@ -1,47 +1,49 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef __mitkExampleDataStructureReaderService_h #define __mitkExampleDataStructureReaderService_h #include "mitkCommon.h" #include "mitkExampleDataStructure.h" #include #include #include namespace mitk { /** \brief The reader service for the MITK example data type */ class ExampleDataStructureReaderService : public mitk::AbstractFileReader { public: typedef mitk::ExampleDataStructure OutputType; ExampleDataStructureReaderService(const ExampleDataStructureReaderService &other); ExampleDataStructureReaderService(); ~ExampleDataStructureReaderService() override; using AbstractFileReader::Read; - std::vector> Read() override; + + protected: + std::vector> DoRead() override; private: ExampleDataStructureReaderService *Clone() const override; us::ServiceRegistration m_ServiceReg; }; } // namespace MITK #endif // __mitkExampleDataStructureReaderService_h diff --git a/Modules/Classification/CLVigraRandomForest/include/mitkDummyLsetReader.h b/Modules/Classification/CLVigraRandomForest/include/mitkDummyLsetReader.h index b840cf141d..f118964448 100644 --- a/Modules/Classification/CLVigraRandomForest/include/mitkDummyLsetReader.h +++ b/Modules/Classification/CLVigraRandomForest/include/mitkDummyLsetReader.h @@ -1,45 +1,48 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef _MITK_DummyLsetFileReader__H_ #define _MITK_DummyLsetFileReader__H_ #include namespace mitk { /** * Read deprecated *.lset format (Multilabel Image format 2014) * @ingroup Process */ class DummyLsetFileReader : public mitk::AbstractFileReader { public: DummyLsetFileReader(); DummyLsetFileReader(const mitk::DummyLsetFileReader& other); ~DummyLsetFileReader() override; using AbstractFileReader::Read; - std::vector > Read() override; + +protected: + std::vector> DoRead() override; + private: DummyLsetFileReader * Clone() const override; }; } // end of namespace mitk #endif diff --git a/Modules/Classification/CLVigraRandomForest/include/mitkRandomForestIO.h b/Modules/Classification/CLVigraRandomForest/include/mitkRandomForestIO.h index 1bcb652b7f..456837251c 100644 --- a/Modules/Classification/CLVigraRandomForest/include/mitkRandomForestIO.h +++ b/Modules/Classification/CLVigraRandomForest/include/mitkRandomForestIO.h @@ -1,61 +1,62 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef _MITK_DecisionForestFileIO__H_ #define _MITK_DecisionForestFileIO__H_ #include #include "vigra/random_forest.hxx" namespace mitk { /** * Writes vigra based mitk::DecisionForest * @ingroup Process */ class RandomForestFileIO : public mitk::AbstractFileIO { public: RandomForestFileIO(); RandomForestFileIO(const mitk::RandomForestFileIO& other); ~RandomForestFileIO() override; using AbstractFileIO::Write; void Write() override; using AbstractFileIO::Read; - std::vector > Read() override; ConfidenceLevel GetReaderConfidenceLevel() const override; ConfidenceLevel GetWriterConfidenceLevel() const override; - protected: +protected: + std::vector> DoRead() override; + mutable vigra::RandomForest m_rf; // DecisionForestFileIO(const DecisionForestFileIO& other); // virtual mitk::DecisionForestFileIO* Clone() const; private: AbstractFileIO* IOClone() const override; }; } // end of namespace mitk #endif diff --git a/Modules/Classification/CLVigraRandomForest/src/IO/mitkDummyLsetReader.cpp b/Modules/Classification/CLVigraRandomForest/src/IO/mitkDummyLsetReader.cpp index a4e6256ba0..a1ae48a41a 100644 --- a/Modules/Classification/CLVigraRandomForest/src/IO/mitkDummyLsetReader.cpp +++ b/Modules/Classification/CLVigraRandomForest/src/IO/mitkDummyLsetReader.cpp @@ -1,66 +1,66 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include #include #include #include #include #include typedef itk::Image ImageType; -std::vector > mitk::DummyLsetFileReader::Read() +std::vector > mitk::DummyLsetFileReader::DoRead() { std::vector > result; typedef itk::ImageFileReader FileReaderType; FileReaderType::Pointer reader = FileReaderType::New(); reader->SetFileName(this->GetInputLocation()); itk::NrrdImageIO::Pointer io = itk::NrrdImageIO::New(); reader->SetImageIO(io); reader->Update(); mitk::Image::Pointer img; mitk::CastToMitkImage(reader->GetOutput(),img); result.push_back(img.GetPointer()); return result; } mitk::DummyLsetFileReader::DummyLsetFileReader(const DummyLsetFileReader & other) : AbstractFileReader(other) { } mitk::DummyLsetFileReader* mitk::DummyLsetFileReader::Clone() const { return new DummyLsetFileReader(*this); } mitk::DummyLsetFileReader::~DummyLsetFileReader() {} mitk::DummyLsetFileReader::DummyLsetFileReader() { CustomMimeType mimeType(this->GetMimeTypePrefix() + "lset"); mimeType.AddExtension("lset"); mimeType.SetCategory("Images"); mimeType.SetComment("Experimental MBI LabelSetImage"); this->SetMimeType(mimeType); this->SetDescription("MBI LabelSetImage"); this->RegisterService(); } diff --git a/Modules/Classification/CLVigraRandomForest/src/IO/mitkRandomForestIO.cpp b/Modules/Classification/CLVigraRandomForest/src/IO/mitkRandomForestIO.cpp index 4dedf92d42..79a0e270fb 100644 --- a/Modules/Classification/CLVigraRandomForest/src/IO/mitkRandomForestIO.cpp +++ b/Modules/Classification/CLVigraRandomForest/src/IO/mitkRandomForestIO.cpp @@ -1,218 +1,218 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef __mitkDecisionForestIO__cpp #define __mitkDecisionForestIO__cpp #include "mitkRandomForestIO.h" #include "itksys/SystemTools.hxx" //#include "mitkHDF5IOMimeTypes.h" #include "vigra/random_forest_hdf5_impex.hxx" #include #include #include "mitkVigraRandomForestClassifier.h" #include "mitkIOMimeTypes.h" #define GetAttribute(name,type)\ type name;\ hdf5_file.readAttribute(".",name,name); mitk::RandomForestFileIO::ConfidenceLevel mitk::RandomForestFileIO::GetReaderConfidenceLevel() const { std::string ext = itksys::SystemTools::GetFilenameLastExtension(this->GetLocalFileName().c_str()); bool is_loaded = vigra::rf_import_HDF5(m_rf, this->GetInputLocation()); return ext == ".forest" && is_loaded == true? IFileReader::Supported : IFileReader::Unsupported; } mitk::RandomForestFileIO::ConfidenceLevel mitk::RandomForestFileIO::GetWriterConfidenceLevel() const { mitk::VigraRandomForestClassifier::ConstPointer input = dynamic_cast(this->GetInput()); if (input.IsNull()) { return IFileWriter::Unsupported; }else{ return IFileWriter::Supported; } } mitk::RandomForestFileIO::RandomForestFileIO() : AbstractFileIO(mitk::VigraRandomForestClassifier::GetStaticNameOfClass()) { CustomMimeType customReaderMimeType(mitk::IOMimeTypes::DEFAULT_BASE_NAME() + ".forest"); std::string category = "Vigra Random Forest File"; customReaderMimeType.SetComment("Vigra Random Forest"); customReaderMimeType.SetCategory(category); customReaderMimeType.AddExtension("forest"); // this->AbstractFileIOWriter::SetRanking(100); this->AbstractFileWriter::SetMimeTypePrefix(mitk::IOMimeTypes::DEFAULT_BASE_NAME() + ".forest"); this->AbstractFileWriter::SetMimeType(customReaderMimeType); this->SetWriterDescription("Vigra Random Forest"); this->AbstractFileReader::SetMimeTypePrefix(mitk::IOMimeTypes::DEFAULT_BASE_NAME() + ".forest"); this->AbstractFileReader::SetMimeType(customReaderMimeType); this->SetReaderDescription("Vigra Random Forest"); // this->SetReaderDescription(mitk::DecisionForestIOMimeTypes::DECISIONFOREST_MIMETYPE_DESCRIPTION()); // this->SetWriterDescription(mitk::DecisionForestIOMimeTypes::DECISIONFOREST_MIMETYPE_DESCRIPTION()); this->RegisterService(); } mitk::RandomForestFileIO::RandomForestFileIO(const mitk::RandomForestFileIO& other) : AbstractFileIO(other) { } mitk::RandomForestFileIO::~RandomForestFileIO() {} std::vector > mitk::RandomForestFileIO:: -Read() +DoRead() { mitk::VigraRandomForestClassifier::Pointer output = mitk::VigraRandomForestClassifier::New(); std::vector > result; if ( this->GetInputLocation().empty()) { MITK_ERROR << "Sorry, filename has not been set!"; return result; } else { const std::string& locale = "C"; const std::string& currLocale = setlocale( LC_ALL, nullptr ); if ( locale.compare(currLocale)!=0 ) { try { setlocale(LC_ALL, locale.c_str()); } catch(...) { MITK_INFO << "Could not set locale " << locale; } } output->SetRandomForest(m_rf); result.push_back(output.GetPointer()); vigra::HDF5File hdf5_file(this->GetInputLocation() , vigra::HDF5File::Open); hdf5_file.cd_mk("/_mitkOptions"); // --------------------------------------------------------- // Read tree weights if(hdf5_file.existsDataset("treeWeights")) { auto treeWeight = output->GetTreeWeights(); treeWeight.resize(m_rf.tree_count(),1); vigra::MultiArrayView<2, double> W(vigra::Shape2(treeWeight.rows(),treeWeight.cols()),treeWeight.data()); hdf5_file.read("treeWeights",W); output->SetTreeWeights(treeWeight); } // --------------------------------------------------------- // --------------------------------------------------------- // Read itemList if(hdf5_file.existsDataset("itemList")){ std::string items_string; hdf5_file.read("itemList",items_string); auto itemlist = output->GetItemList(); std::string current_item = ""; for(auto character : items_string) { if(character == ';'){ // skip seperator and push back item itemlist.push_back(current_item); current_item.clear(); }else{ current_item = current_item + character; } } output->SetItemList(itemlist); } // --------------------------------------------------------- hdf5_file.close(); return result; } } void mitk::RandomForestFileIO::Write() { mitk::BaseData::ConstPointer input = this->GetInput(); if (input.IsNull()) { MITK_ERROR <<"Sorry, input to NrrdDiffusionImageWriter is nullptr!"; return; } if ( this->GetOutputLocation().empty() ) { MITK_ERROR << "Sorry, filename has not been set!"; return ; }else{ const std::string& locale = "C"; const std::string& currLocale = setlocale( LC_ALL, nullptr ); if ( locale.compare(currLocale)!=0 ) { try { setlocale(LC_ALL, locale.c_str()); } catch(...) { MITK_INFO << "Could not set locale " << locale; } } mitk::VigraRandomForestClassifier::ConstPointer mitkDC = dynamic_cast(input.GetPointer()); //mitkDC->GetRandomForest() vigra::rf_export_HDF5(mitkDC->GetRandomForest(), this->GetOutputLocation()); vigra::HDF5File hdf5_file(this->GetOutputLocation() , vigra::HDF5File::Open); hdf5_file.cd_mk("/_mitkOptions"); // Write tree weights // --------------------------------------------------------- auto treeWeight = mitkDC->GetTreeWeights(); vigra::MultiArrayView<2, double> W(vigra::Shape2(treeWeight.rows(),treeWeight.cols()),treeWeight.data()); hdf5_file.write("treeWeights",W); // --------------------------------------------------------- // Write itemList // --------------------------------------------------------- auto items = mitkDC->GetItemList(); std::string item_stringlist; for(auto entry : items) item_stringlist = item_stringlist + entry + ";"; hdf5_file.write("itemList",item_stringlist); // --------------------------------------------------------- hdf5_file.close(); } } mitk::AbstractFileIO* mitk::RandomForestFileIO::IOClone() const { return new RandomForestFileIO(*this); } #endif diff --git a/Modules/US/USModel/mitkUSDeviceReaderXML.cpp b/Modules/US/USModel/mitkUSDeviceReaderXML.cpp index 4295678f0e..250b7af835 100644 --- a/Modules/US/USModel/mitkUSDeviceReaderXML.cpp +++ b/Modules/US/USModel/mitkUSDeviceReaderXML.cpp @@ -1,204 +1,204 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ // MITK #include "mitkUSDeviceReaderWriterConstants.h" #include "mitkUSDeviceReaderXML.h" #include #include #include // Third Party #include #include #include mitk::USDeviceReaderXML::USDeviceReaderXML() : AbstractFileReader( mitk::IGTMimeTypes::USDEVICEINFORMATIONXML_MIMETYPE(), "MITK USDevice Reader (XML)"), m_Filename("") { RegisterService(); } mitk::USDeviceReaderXML::~USDeviceReaderXML() { } mitk::USDeviceReaderXML::USDeviceConfigData &mitk::USDeviceReaderXML::GetUSDeviceConfigData() { return m_DeviceConfig; } mitk::USDeviceReaderXML::USDeviceReaderXML(const mitk::USDeviceReaderXML& other) : AbstractFileReader(other) { } mitk::USDeviceReaderXML* mitk::USDeviceReaderXML::Clone() const { return new USDeviceReaderXML(*this); } -std::vector> mitk::USDeviceReaderXML::Read() +std::vector> mitk::USDeviceReaderXML::DoRead() { MITK_WARN << "This method is not implemented. \ Please use the method ReadUltrasoundDeviceConfiguration() instead."; std::vector result; return result; } bool mitk::USDeviceReaderXML::ReadUltrasoundDeviceConfiguration() { MITK_INFO << "Try to start reading xml device configuration..."; if (m_Filename == "") { MITK_WARN << "Cannot read file - empty filename!"; return false; } TiXmlDocument document(m_Filename); if (!document.LoadFile()) { MITK_ERROR << "Error when opening and reading file :" << m_Filename; return false; } TiXmlHandle documentHandle(&document); TiXmlElement* ultrasoundDeviceTag = documentHandle.FirstChildElement(TAG_ULTRASOUNDDEVICE).ToElement(); if (ultrasoundDeviceTag == nullptr) { MITK_ERROR << "Error parsing the file :" << m_Filename << std::endl << "Wrong xml format structure."; return false; } //Extract attribute information of the ULTRASOUNDDEVICE-Tag: this->ExtractAttributeInformationOfUltrasoundDeviceTag(ultrasoundDeviceTag); TiXmlElement* generalSettingsTag = documentHandle.FirstChildElement(TAG_ULTRASOUNDDEVICE).FirstChildElement(TAG_GENERALSETTINGS).ToElement(); if (generalSettingsTag == nullptr) { MITK_ERROR << "Error parsing the GENERALSETTINGS-Tag in the file :" << m_Filename; return false; } //Extract attribute information of the GENERALSETTINGS-Tag: this->ExtractAttributeInformationOfGeneralSettingsTag(generalSettingsTag); TiXmlElement* probesTag = documentHandle.FirstChildElement(TAG_ULTRASOUNDDEVICE).FirstChildElement(TAG_PROBES).ToElement(); if (probesTag == nullptr) { MITK_ERROR << "Error: PROBES-Tag was not found in the file :" << m_Filename << "Therefore, creating default probe."; //Create default ultrasound probe: mitk::USProbe::Pointer ultrasoundProbeDefault = mitk::USProbe::New(); ultrasoundProbeDefault->SetName("default"); ultrasoundProbeDefault->SetDepth(0); m_DeviceConfig.probes.push_back(ultrasoundProbeDefault); return true; } //Extract all saved and configured probes of the USDevice: for (TiXmlElement* probeTag = probesTag->FirstChildElement(TAG_PROBE); probeTag != nullptr; probeTag = probeTag->NextSiblingElement()) { this->ExtractProbe(probeTag); } return true; } void mitk::USDeviceReaderXML::SetFilename(std::string filename) { m_Filename = filename; } void mitk::USDeviceReaderXML::ExtractAttributeInformationOfUltrasoundDeviceTag(TiXmlElement *ultrasoundTag) { ultrasoundTag->QueryDoubleAttribute(ATTR_FILEVERS, &m_DeviceConfig.fileversion); ultrasoundTag->QueryStringAttribute(ATTR_TYPE, &m_DeviceConfig.deviceType); ultrasoundTag->QueryStringAttribute(ATTR_NAME, &m_DeviceConfig.deviceName); ultrasoundTag->QueryStringAttribute(ATTR_MANUFACTURER, &m_DeviceConfig.manufacturer); ultrasoundTag->QueryStringAttribute(ATTR_MODEL, &m_DeviceConfig.model); ultrasoundTag->QueryStringAttribute(ATTR_COMMENT, &m_DeviceConfig.comment); ultrasoundTag->QueryIntAttribute(ATTR_IMAGESTREAMS, &m_DeviceConfig.numberOfImageStreams); ultrasoundTag->QueryStringAttribute(ATTR_HOST, &m_DeviceConfig.host); ultrasoundTag->QueryIntAttribute(ATTR_PORT, &m_DeviceConfig.port); ultrasoundTag->QueryBoolAttribute(ATTR_SERVER, &m_DeviceConfig.server); } void mitk::USDeviceReaderXML::ExtractAttributeInformationOfGeneralSettingsTag(TiXmlElement *generalSettingsTag) { generalSettingsTag->QueryBoolAttribute(ATTR_GREYSCALE, &m_DeviceConfig.useGreyscale); generalSettingsTag->QueryBoolAttribute(ATTR_RESOLUTIONOVERRIDE, &m_DeviceConfig.useResolutionOverride); generalSettingsTag->QueryIntAttribute(ATTR_RESOLUTIONHEIGHT, &m_DeviceConfig.resolutionHeight); generalSettingsTag->QueryIntAttribute(ATTR_RESOLUTIONWIDTH, &m_DeviceConfig.resolutionWidth); generalSettingsTag->QueryIntAttribute(ATTR_SOURCEID, &m_DeviceConfig.sourceID); generalSettingsTag->QueryStringAttribute(ATTR_FILEPATH, &m_DeviceConfig.filepathVideoSource); generalSettingsTag->QueryIntAttribute(ATTR_OPENCVPORT, &m_DeviceConfig.opencvPort); } void mitk::USDeviceReaderXML::ExtractProbe(TiXmlElement *probeTag) { mitk::USProbe::Pointer ultrasoundProbe = mitk::USProbe::New(); std::string probeName; probeTag->QueryStringAttribute(ATTR_NAME, &probeName); ultrasoundProbe->SetName(probeName); TiXmlElement* depthsTag = probeTag->FirstChildElement(TAG_DEPTHS); if (depthsTag != nullptr) { for (TiXmlElement* depthTag = depthsTag->FirstChildElement(TAG_DEPTH); depthTag != nullptr; depthTag = depthTag->NextSiblingElement()) { int depth = 0; mitk::Vector3D spacing; spacing[0] = 1; spacing[1] = 1; spacing[2] = 1; depthTag->QueryIntAttribute(ATTR_DEPTH, &depth); TiXmlElement* spacingTag = depthTag->FirstChildElement(TAG_SPACING); if (spacingTag != nullptr) { spacingTag->QueryDoubleAttribute(ATTR_X, &spacing[0]); spacingTag->QueryDoubleAttribute(ATTR_Y, &spacing[1]); } ultrasoundProbe->SetDepthAndSpacing(depth, spacing); } } else { MITK_ERROR << "Error: DEPTHS-Tag was not found in the file :" << m_Filename << "Therefore, creating default depth [0] and spacing [1,1,1] for the probe."; ultrasoundProbe->SetDepth(0); } unsigned int croppingTop = 0; unsigned int croppingBottom = 0; unsigned int croppingLeft = 0; unsigned int croppingRight = 0; TiXmlElement* croppingTag = probeTag->FirstChildElement(TAG_CROPPING); if (croppingTag != nullptr) { croppingTag->QueryUnsignedAttribute(ATTR_TOP, &croppingTop); croppingTag->QueryUnsignedAttribute(ATTR_BOTTOM, &croppingBottom); croppingTag->QueryUnsignedAttribute(ATTR_LEFT, &croppingLeft); croppingTag->QueryUnsignedAttribute(ATTR_RIGHT, &croppingRight); } ultrasoundProbe->SetProbeCropping(croppingTop, croppingBottom, croppingLeft, croppingRight); m_DeviceConfig.probes.push_back(ultrasoundProbe); } diff --git a/Modules/US/USModel/mitkUSDeviceReaderXML.h b/Modules/US/USModel/mitkUSDeviceReaderXML.h index 74d3d76b9f..a81663d7c2 100644 --- a/Modules/US/USModel/mitkUSDeviceReaderXML.h +++ b/Modules/US/USModel/mitkUSDeviceReaderXML.h @@ -1,101 +1,103 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef mitkUSDeviceReaderXML_H_HEADER_INCLUDED_ #define mitkUSDeviceReaderXML_H_HEADER_INCLUDED_ #include #include #include class TiXmlElement; class TiXmlNode; namespace mitk { class MITKUS_EXPORT USDeviceReaderXML : public AbstractFileReader { public: USDeviceReaderXML(); ~USDeviceReaderXML() override; using AbstractFileReader::Read; - std::vector> Read() override; + bool ReadUltrasoundDeviceConfiguration(); void SetFilename(std::string filename); typedef struct USDeviceConfigData_ { double fileversion; std::string deviceType; std::string deviceName; std::string manufacturer; std::string model; std::string comment; std::string host; int port; bool server; int numberOfImageStreams; bool useGreyscale; bool useResolutionOverride; int resolutionWidth; int resolutionHeight; int sourceID; std::string filepathVideoSource; int opencvPort; std::vector probes; USDeviceConfigData_() : fileversion(0), deviceType("Unknown"), deviceName("Unknown"), manufacturer("Unknown"), comment(""), host("localhost"), port(18944), server(false), numberOfImageStreams(1), useGreyscale(true), useResolutionOverride(true), resolutionWidth(640), resolutionHeight(480), sourceID(0), filepathVideoSource(""), opencvPort(0) { }; }USDeviceConfigData; USDeviceConfigData &GetUSDeviceConfigData(); protected: + std::vector> DoRead() override; + USDeviceReaderXML(const USDeviceReaderXML& other); mitk::USDeviceReaderXML* Clone() const override; /** * \brief Extracts all stored attribute information of the ULTRASOUNDDEVICE-Tag. */ void ExtractAttributeInformationOfUltrasoundDeviceTag(TiXmlElement *element); /** * \brief Extracts all stored attribute information of the GENERALSETTINGS-Tag. */ void ExtractAttributeInformationOfGeneralSettingsTag(TiXmlElement *element); /** * \brief Extracts all stored information of a single ultrasound probe. */ void ExtractProbe(TiXmlElement *element); private: std::string m_Filename; USDeviceConfigData m_DeviceConfig; }; } // namespace mitk #endif // mitkUSDeviceReaderXML_H_HEADER_INCLUDED_