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

Method GetRevisionAppropriateJSONString

Modules/CEST/src/mitkCustomTagParser.cpp:624–707  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

622}
623
624std::string mitk::CustomTagParser::GetRevisionAppropriateJSONString(std::string revisionString)
625{
626 std::string returnValue = "";
627
628 if ("" == revisionString)
629 {
630 MITK_WARN << "Could not extract revision";
631 }
632 else
633 {
634 GetClosestLowerRevision(revisionString);
635
636 bool useExternal = false;
637 bool useInternal = false;
638
639 if ("" != m_ClosestExternalRevision)
640 {
641 useExternal = true;
642 }
643 if ("" != m_ClosestInternalRevision)
644 {
645 useInternal = true;
646 }
647
648 if (useExternal && useInternal)
649 {
650 if (std::stoi(m_ClosestInternalRevision) > std::stoi(m_ClosestExternalRevision))
651 {
652 useExternal = false;
653 }
654 }
655
656 if (useExternal)
657 {
658 std::string stringToJSONDirectory = GetExternalJSONDirectory();
659
660 std::string prospectiveJsonPath = stringToJSONDirectory + "/" + m_ClosestExternalRevision + ".json";
661
662 std::ifstream externalJSON(prospectiveJsonPath.c_str());
663
664 if (externalJSON.good())
665 {
666 MITK_INFO << "Found external json for CEST parameters at " << prospectiveJsonPath;
667
668 std::stringstream buffer;
669 buffer << externalJSON.rdbuf();
670
671 returnValue = buffer.str();
672
673 useInternal = false;
674 }
675 }
676
677 if (useInternal)
678 {
679 std::string filename = m_ClosestInternalRevision + ".json";
680 us::ModuleResource jsonResource = us::GetModuleContext()->GetModule()->GetResource(filename);
681

Callers

nothing calls this directly

Calls 6

GetModuleContextFunction · 0.85
GetResourceMethod · 0.80
IsFileMethod · 0.80
GetModuleMethod · 0.45
IsValidMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected