| 503 | |
| 504 | |
| 505 | std::string |
| 506 | mitk::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 | |
| 550 | tinyxml2::XMLElement* |
| 551 | mitk::DICOMReaderConfigurator |