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

Method AppliesTo

Modules/CEST/autoload/IO/mitkCESTIOMimeTypes.cpp:48–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46 }
47
48 bool MitkCESTIOMimeTypes::MitkCESTDicomMimeType::AppliesTo(const std::string &path) const
49 {
50 bool canRead(IOMimeTypes::BaseDicomMimeType::AppliesTo(path));
51
52 // fix for bug 18572
53 // Currently this function is called for writing as well as reading, in that case
54 // the image information can of course not be read
55 // This is a bug, this function should only be called for reading.
56 if (!itksys::SystemTools::FileExists(path.c_str()))
57 {
58 return canRead;
59 }
60 // end fix for bug 18572
61
62 if (!canRead)
63 {
64 return canRead;
65 }
66
67 mitk::DICOMDCMTKTagScanner::Pointer scanner = mitk::DICOMDCMTKTagScanner::New();
68
69 mitk::DICOMTag siemensCESTprivateTag(0x0029, 0x1020);
70
71 mitk::StringList relevantFiles;
72 relevantFiles.push_back(path);
73
74 scanner->AddTag(siemensCESTprivateTag);
75 scanner->SetInputFiles(relevantFiles);
76 scanner->Scan();
77 mitk::DICOMTagCache::Pointer tagCache = scanner->GetScanCache();
78
79 mitk::DICOMImageFrameList imageFrameList = mitk::ConvertToDICOMImageFrameList(tagCache->GetFrameInfoList());
80
81 bool mapNotEmpty = false;
82
83 if (!imageFrameList.empty())
84 {
85 mitk::DICOMImageFrameInfo* firstFrame = imageFrameList.begin()->GetPointer();
86
87 std::string byteString = tagCache->GetTagValue(firstFrame, siemensCESTprivateTag).value;
88
89 if (byteString.empty()) {
90 return false;
91 }
92 mitk::CustomTagParser tagParser(relevantFiles[0]);
93
94 auto parsedPropertyList = tagParser.ParseDicomPropertyString(byteString);
95
96 mapNotEmpty = !parsedPropertyList->GetMap()->empty();
97 }
98
99 return mapNotEmpty;
100 }
101
102 MitkCESTIOMimeTypes::MitkCESTDicomMimeType *MitkCESTIOMimeTypes::MitkCESTDicomMimeType::Clone() const
103 {

Callers

nothing calls this directly

Calls 11

GetPointerMethod · 0.80
NewFunction · 0.50
AddTagMethod · 0.45
SetInputFilesMethod · 0.45
ScanMethod · 0.45
GetScanCacheMethod · 0.45
GetFrameInfoListMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
GetTagValueMethod · 0.45

Tested by

no test coverage detected