MCPcopy Create free account
hub / github.com/MITK/MITK / CreateConfigStringFromReader

Method CreateConfigStringFromReader

Modules/DICOM/src/mitkDICOMReaderConfigurator.cpp:505–548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

503
504
505std::string
506mitk::DICOMReaderConfigurator
507::CreateConfigStringFromReader(DICOMFileReader::ConstPointer reader) const
508{
509 // check possible sub-classes from the most-specific one up to the most generic one
510 const DICOMFileReader* cPointer = reader;
511 tinyxml2::XMLDocument document;
512 tinyxml2::XMLElement* root = nullptr;
513 if (const auto* specificReader = dynamic_cast<const ClassicDICOMSeriesReader*>(cPointer))
514 {
515 root = this->CreateConfigStringFromReader(document, specificReader);
516 }
517 else
518 if (const auto* specificReader = dynamic_cast<const ThreeDnTDICOMSeriesReader*>(cPointer))
519 {
520 root = this->CreateConfigStringFromReader(document, specificReader);
521 }
522 else
523 if (const auto* specificReader = dynamic_cast<const DICOMITKSeriesGDCMReader*>(cPointer))
524 {
525 root = this->CreateConfigStringFromReader(document, specificReader);
526 }
527 else
528 {
529 MITK_WARN << "Unknown reader class passed to DICOMReaderConfigurator::CreateConfigStringFromReader(). Cannot serialize.";
530 return ""; // no serialization, what a pity
531 }
532
533 if (nullptr != root)
534 {
535 document.InsertEndChild( root );
536
537 tinyxml2::XMLPrinter printer;
538 document.Print(&printer);
539
540 std::string xmltext = printer.CStr();
541 return xmltext;
542 }
543 else
544 {
545 MITK_WARN << "DICOMReaderConfigurator::CreateConfigStringFromReader() created empty serialization. Problem?";
546 return "";
547 }
548}
549
550tinyxml2::XMLElement*
551mitk::DICOMReaderConfigurator

Callers 2

mainFunction · 0.80

Calls 12

GetFixTiltByShearingMethod · 0.80
GetGroup3DandTMethod · 0.80
PrintMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 1