31 std::vector<mitk::SemanticTypes::CaseID> GetCaseIDs()
34 if (
nullptr == persistenceService)
36 MITK_DEBUG <<
"Persistence service could not be loaded";
37 return std::vector<mitk::SemanticTypes::CaseID>();
40 std::string listIdentifier =
"caseIDs";
42 if (
nullptr == propertyList)
44 MITK_DEBUG <<
"Could not find the property list " << listIdentifier <<
" for the current MITK workbench / session.";
45 return std::vector<mitk::SemanticTypes::CaseID>();
49 if (
nullptr == caseIDsVectorProperty)
51 MITK_DEBUG <<
"Could not find the property " << listIdentifier <<
" for the " << listIdentifier <<
" property list.";
52 return std::vector<mitk::SemanticTypes::CaseID>();
55 return caseIDsVectorProperty->GetValue();
60 auto allCaseIDs = GetCaseIDs();
61 auto existingCase = std::find(allCaseIDs.begin(), allCaseIDs.end(), caseID);
62 if (existingCase == allCaseIDs.end())
74 if (
nullptr == persistenceService)
76 MITK_DEBUG <<
"Persistence service could not be loaded";
83 if (CaseIDExists(caseID))
86 return persistenceService->GetPropertyList(const_cast<mitk::SemanticTypes::CaseID&>(caseID));
95 if (
nullptr == propertyList)
97 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
102 if (
nullptr == lesionDataProperty)
104 MITK_DEBUG <<
"Lesion " << lesionID <<
" not found. Lesion can not be retrieved.";
108 std::vector<std::string> lesionData = lesionDataProperty->
GetValue();
110 if (lesionData.size() != 2)
112 MITK_DEBUG <<
"Incorrect lesion data storage. Not two (2) strings of the lesion name and the lesion UID are stored.";
117 std::string lesionClassID = lesionData[1];
119 if (
nullptr != lesionClassProperty)
122 generatedLesionClass.
UID = lesionClassID;
126 generatedLesion.
UID = lesionID;
127 generatedLesion.
name = lesionData[0];
128 generatedLesion.
lesionClass = generatedLesionClass;
130 return generatedLesion;
133 MITK_DEBUG <<
"Incorrect lesion class storage. Lesion " << lesionID <<
" can not be retrieved.";
140 if (
nullptr == propertyList)
142 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
148 if (
nullptr == controlPointVectorProperty)
150 MITK_DEBUG <<
"Could not find the control point " << controlPointUID <<
" in the storage.";
154 std::vector<int> controlPointVectorPropertyValue = controlPointVectorProperty->
GetValue();
156 if (controlPointVectorPropertyValue.size() != 3)
158 MITK_DEBUG <<
"Incorrect control point storage. Not three (3) values of the date are stored.";
164 generatedControlPoint.
UID = controlPointUID;
165 generatedControlPoint.
date = boost::gregorian::date(controlPointVectorPropertyValue[0],
166 controlPointVectorPropertyValue[1],
167 controlPointVectorPropertyValue[2]);
169 return generatedControlPoint;
176 if (
nullptr == propertyList)
178 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
183 if (
nullptr == lesionsVectorProperty)
185 MITK_DEBUG <<
"Could not find any lesion in the storage.";
189 std::vector<std::string> lesionsVectorPropertyValue = lesionsVectorProperty->
GetValue();
191 for (
const auto& lesionID : lesionsVectorPropertyValue)
194 if (!generatedLesion.
UID.empty())
196 allLesionsOfCase.push_back(generatedLesion);
200 return allLesionsOfCase;
206 if (
nullptr == propertyList)
208 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
214 if (
nullptr == segmentationVectorProperty)
216 MITK_DEBUG <<
"Could not find the segmentation " << segmentationID <<
" in the storage.";
220 std::vector<std::string> segmentationVectorPropertyValue = segmentationVectorProperty->
GetValue();
222 if (segmentationVectorPropertyValue.size() != 2)
224 MITK_DEBUG <<
"Incorrect segmentation storage. Not two (2) IDs stored.";
228 std::string lesionID = segmentationVectorPropertyValue[1];
229 if (lesionID.empty())
235 return GenerateLesion(caseID, lesionID);
241 if (
nullptr == propertyList)
243 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
249 if (
nullptr == controlPointsVectorProperty)
251 MITK_DEBUG <<
"Could not find any control points in the storage.";
255 std::vector<std::string> controlPointsVectorPropertyValue = controlPointsVectorProperty->
GetValue();
257 for (
const auto& controlPointUID : controlPointsVectorPropertyValue)
260 if (!generatedControlPoint.
UID.empty())
262 allControlPointsOfCase.push_back(generatedControlPoint);
266 return allControlPointsOfCase;
272 if (
nullptr == propertyList)
274 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
279 if (
nullptr == imageVectorProperty)
281 MITK_DEBUG <<
"Could not find the image " << imageID <<
" in the storage.";
285 std::vector<std::string> imageVectorPropertyValue = imageVectorProperty->
GetValue();
288 if (imageVectorPropertyValue.size() != 2)
290 MITK_DEBUG <<
"Incorrect data storage. Not two (2) values stored.";
295 std::string controlPointID = imageVectorPropertyValue[1];
298 if (
nullptr == controlPointVectorProperty)
300 MITK_DEBUG <<
"Could not find the control point " << controlPointID <<
" in the storage.";
304 std::vector<int> controlPointVectorPropertyValue = controlPointVectorProperty->
GetValue();
306 if (controlPointVectorPropertyValue.size() != 3)
308 MITK_DEBUG <<
"Incorrect control point storage. Not three (3) values of the date are stored.";
313 controlPoint.
UID = controlPointID;
314 controlPoint.
date = boost::gregorian::date(controlPointVectorPropertyValue[0],
315 controlPointVectorPropertyValue[1],
316 controlPointVectorPropertyValue[2]);
324 if (
nullptr == propertyList)
326 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
332 if (
nullptr == examinationPeriodsVectorProperty)
334 MITK_DEBUG <<
"Could not find any examination periods in the storage.";
338 std::vector<std::string> examinationPeriodsVectorPropertyValue = examinationPeriodsVectorProperty->GetValue();
340 for (
const auto& examinationPeriodID : examinationPeriodsVectorPropertyValue)
344 if (
nullptr == examinationPeriodVectorProperty)
346 MITK_DEBUG <<
"Could not find the examination period " << examinationPeriodID <<
" in the storage.";
350 std::vector<std::string> examinationPeriodVectorPropertyValue = examinationPeriodVectorProperty->GetValue();
352 if (examinationPeriodVectorPropertyValue.empty())
354 MITK_DEBUG <<
"Incorrect examination period storage. At least one (1) value for the examination period name has to be stored.";
361 generatedExaminationPeriod.
UID = examinationPeriodID;
362 generatedExaminationPeriod.
name = examinationPeriodVectorPropertyValue[0];
363 for (
size_t i = 1; i < examinationPeriodVectorPropertyValue.size(); ++i)
365 generatedExaminationPeriod.
controlPointUIDs.push_back(examinationPeriodVectorPropertyValue[i]);
368 allExaminationPeriods.push_back(generatedExaminationPeriod);
371 return allExaminationPeriods;
377 if (
nullptr == propertyList)
379 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
384 if (
nullptr == informationTypesVectorProperty)
386 MITK_DEBUG <<
"Could not find any information types in the storage.";
390 return informationTypesVectorProperty->
GetValue();
396 if (
nullptr == propertyList)
398 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
403 if (
nullptr == imageVectorProperty)
405 MITK_DEBUG <<
"Could not find the image " << imageID <<
" in the storage.";
409 std::vector<std::string> imageVectorPropertyValue = imageVectorProperty->
GetValue();
411 if (imageVectorPropertyValue.size() != 2)
413 MITK_DEBUG <<
"Incorrect data storage. Not two (2) values stored.";
418 return imageVectorPropertyValue[0];
424 if (
nullptr == propertyList)
426 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
431 if (
nullptr == imagesVectorProperty)
433 MITK_DEBUG <<
"Could not find any image in the storage.";
437 return imagesVectorProperty->
GetValue();
443 if (
nullptr == propertyList)
445 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
450 if (
nullptr == imagesVectorProperty)
452 MITK_DEBUG <<
"Could not find any image in the storage.";
457 std::vector<std::string> imagesVectorPropertyValue = imagesVectorProperty->
GetValue();
458 for (
const auto& imageID : imagesVectorPropertyValue)
462 if (
nullptr == imageVectorProperty)
467 std::vector<std::string> imageVectorPropertyValue = imageVectorProperty->
GetValue();
469 if (imageVectorPropertyValue.size() != 2)
475 if (imageVectorPropertyValue[1] == controlPoint.
UID)
477 allImageIDsOfControlPoint.push_back(imageID);
481 return allImageIDsOfControlPoint;
487 if (
nullptr == propertyList)
489 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
494 if (
nullptr == imagesVectorProperty)
496 MITK_DEBUG <<
"Could not find any image in the storage.";
501 std::vector<std::string> imagesVectorPropertyValue = imagesVectorProperty->
GetValue();
502 for (
const auto& imageID : imagesVectorPropertyValue)
506 if (
nullptr == imageVectorProperty)
511 std::vector<std::string> imageVectorPropertyValue = imageVectorProperty->
GetValue();
513 if (imageVectorPropertyValue.size() != 2)
519 if (imageVectorPropertyValue[0] == informationType)
521 allImageIDsOfInformationType.push_back(imageID);
525 return allImageIDsOfInformationType;
531 if (
nullptr == propertyList)
533 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
538 if (
nullptr == segmentationsVectorProperty)
540 MITK_DEBUG <<
"Could not find any segmentation in the storage.";
544 return segmentationsVectorProperty->
GetValue();
550 if (
nullptr == propertyList)
552 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
557 if (
nullptr == segmentationsVectorProperty)
559 MITK_DEBUG <<
"Could not find any segmentation in the storage.";
564 std::vector<std::string> segmentationsVectorPropertyValue = segmentationsVectorProperty->
GetValue();
565 for (
const auto& segmentationID : segmentationsVectorPropertyValue)
569 if (
nullptr == segmentationVectorProperty)
574 std::vector<std::string> segmentationVectorPropertyValue = segmentationVectorProperty->
GetValue();
576 if (segmentationVectorPropertyValue.size() != 2)
582 if (segmentationVectorPropertyValue[0] == imageID)
584 allSegmentationIDsOfImage.push_back(segmentationID);
588 return allSegmentationIDsOfImage;
594 if (
nullptr == propertyList)
596 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
601 if (
nullptr == segmentationsVectorProperty)
603 MITK_DEBUG <<
"Could not find any segmentation in the storage.";
608 std::vector<std::string> segmentationsVectorPropertyValue = segmentationsVectorProperty->
GetValue();
609 for (
const auto& segmentationID : segmentationsVectorPropertyValue)
613 if (
nullptr == segmentationVectorProperty)
618 std::vector<std::string> segmentationVectorPropertyValue = segmentationVectorProperty->
GetValue();
620 if (segmentationVectorPropertyValue.size() != 2)
626 if (segmentationVectorPropertyValue[1] == lesion.
UID)
628 allSegmentationIDsOfLesion.push_back(segmentationID);
632 return allSegmentationIDsOfLesion;
638 if (
nullptr == propertyList)
640 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
646 if (
nullptr == segmentationVectorProperty)
648 MITK_DEBUG <<
"Could not find the segmentation " << segmentationID <<
" in the storage.";
652 std::vector<std::string> segmentationVectorPropertyValue = segmentationVectorProperty->
GetValue();
654 if (segmentationVectorPropertyValue.size() != 2)
656 MITK_DEBUG <<
"Incorrect segmentation storage. Not two (2) IDs stored.";
660 return segmentationVectorPropertyValue[0];
670 return CaseIDExists(caseID);
676 if (
nullptr == persistenceService)
678 MITK_DEBUG <<
"Persistence service could not be loaded";
682 std::string listIdentifier =
"caseIDs";
684 if (
nullptr == propertyList)
686 MITK_DEBUG <<
"Could not find the property list " << listIdentifier <<
" for the current MITK workbench / session.";
691 std::vector<std::string> caseIDsVectorPropertyValue;
692 if (
nullptr == caseIDsVectorProperty)
698 caseIDsVectorPropertyValue = caseIDsVectorProperty->GetValue();
701 auto existingCase = std::find(caseIDsVectorPropertyValue.begin(), caseIDsVectorPropertyValue.end(), caseID);
702 if (existingCase != caseIDsVectorPropertyValue.end())
708 caseIDsVectorPropertyValue.push_back(caseID);
709 caseIDsVectorProperty->SetValue(caseIDsVectorPropertyValue);
710 propertyList->SetProperty(listIdentifier, caseIDsVectorProperty);
716 if (
nullptr == propertyList)
718 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
724 std::vector<std::string> imagesVectorPropertyValue;
725 if (
nullptr == imagesVectorProperty)
731 imagesVectorPropertyValue = imagesVectorProperty->GetValue();
734 auto existingImage = std::find(imagesVectorPropertyValue.begin(), imagesVectorPropertyValue.end(), imageID);
735 if (existingImage != imagesVectorPropertyValue.end())
741 imagesVectorPropertyValue.push_back(imageID);
742 imagesVectorProperty->SetValue(imagesVectorPropertyValue);
743 propertyList->SetProperty(
"images", imagesVectorProperty);
748 std::vector<std::string> imageVectorPropertyValue(2);
749 imageVectorProperty->SetValue(imageVectorPropertyValue);
750 propertyList->SetProperty(imageID, imageVectorProperty);
756 if (
nullptr == propertyList)
758 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
764 if (
nullptr == imagesVectorProperty)
766 MITK_DEBUG <<
"Could not find any images in the storage.";
771 std::vector<std::string> imagesVectorPropertyValue = imagesVectorProperty->GetValue();
772 imagesVectorPropertyValue.erase(std::remove(imagesVectorPropertyValue.begin(), imagesVectorPropertyValue.end(), imageID), imagesVectorPropertyValue.end());
773 if (imagesVectorPropertyValue.empty())
776 propertyList->DeleteProperty(
"images");
781 imagesVectorProperty->SetValue(imagesVectorPropertyValue);
785 propertyList->DeleteProperty(imageID);
791 if (
nullptr == propertyList)
793 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
799 std::vector<std::string> segmentationsVectorPropertyValue;
800 if (
nullptr == segmentationsVectorProperty)
806 segmentationsVectorPropertyValue = segmentationsVectorProperty->GetValue();
809 auto existingSegmentation = std::find(segmentationsVectorPropertyValue.begin(), segmentationsVectorPropertyValue.end(), segmentationID);
810 if (existingSegmentation != segmentationsVectorPropertyValue.end())
816 segmentationsVectorPropertyValue.push_back(segmentationID);
817 segmentationsVectorProperty->SetValue(segmentationsVectorPropertyValue);
818 propertyList->SetProperty(
"segmentations", segmentationsVectorProperty);
823 std::vector<std::string> segmentationVectorPropertyValue(2);
824 segmentationVectorPropertyValue[0] = parentID;
825 segmentationVectorProperty->SetValue(segmentationVectorPropertyValue);
826 propertyList->SetProperty(segmentationID, segmentationVectorProperty);
832 if (
nullptr == propertyList)
834 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
840 if (
nullptr == segmentationsVectorProperty)
842 MITK_DEBUG <<
"Could not find any segmentation in the storage.";
847 std::vector<std::string> segmentationsVectorPropertyValue = segmentationsVectorProperty->GetValue();
848 segmentationsVectorPropertyValue.erase(std::remove(segmentationsVectorPropertyValue.begin(), segmentationsVectorPropertyValue.end(), segmentationID), segmentationsVectorPropertyValue.end());
849 if (segmentationsVectorPropertyValue.empty())
852 propertyList->DeleteProperty(
"segmentations");
857 segmentationsVectorProperty->SetValue(segmentationsVectorPropertyValue);
861 propertyList->DeleteProperty(segmentationID);
867 if (
nullptr == propertyList)
869 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
874 std::vector<std::string> lesionsVectorPropertyValue;
875 if (
nullptr == lesionsVectorProperty)
881 lesionsVectorPropertyValue = lesionsVectorProperty->GetValue();
884 const auto& existingIndex = std::find(lesionsVectorPropertyValue.begin(), lesionsVectorPropertyValue.end(), lesion.
UID);
885 if (existingIndex != lesionsVectorPropertyValue.end())
891 lesionsVectorPropertyValue.push_back(lesion.
UID);
893 lesionsVectorProperty->SetValue(lesionsVectorPropertyValue);
894 propertyList->SetProperty(
"lesions", lesionsVectorProperty);
897 std::vector<std::string> lesionData;
898 lesionData.push_back(lesion.
name);
901 newLesionVectorProperty->SetValue(lesionData);
902 propertyList->SetProperty(lesion.
UID, newLesionVectorProperty);
906 propertyList->SetStringProperty(lesion.
lesionClass.
UID.c_str(), lesionClassType.c_str());
912 if (
nullptr == propertyList)
914 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
919 if (
nullptr == lesionVectorProperty)
921 MITK_DEBUG <<
"Could not find any lesion in the storage.";
925 std::vector<std::string> lesionVectorPropertyValue = lesionVectorProperty->
GetValue();
926 const auto existingLesion = std::find(lesionVectorPropertyValue.begin(), lesionVectorPropertyValue.end(), lesion.
UID);
927 if (existingLesion != lesionVectorPropertyValue.end())
930 std::vector<std::string> lesionData;
931 lesionData.push_back(lesion.
name);
934 newLesionVectorProperty->SetValue(lesionData);
935 propertyList->SetProperty(lesion.
UID, newLesionVectorProperty);
939 propertyList->SetStringProperty(lesion.
lesionClass.
UID.c_str(), lesionClassType.c_str());
943 MITK_DEBUG <<
"Could not find lesion " << lesion.
UID <<
" in the storage. Cannot overwrite the lesion.";
950 if (
nullptr == propertyList)
952 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
957 if (
nullptr == lesionVectorProperty)
959 MITK_DEBUG <<
"Could not find any lesion in the storage.";
963 std::vector<std::string> lesionVectorPropertyValue = lesionVectorProperty->
GetValue();
964 const auto existingLesion = std::find(lesionVectorPropertyValue.begin(), lesionVectorPropertyValue.end(), lesion.
UID);
965 if (existingLesion != lesionVectorPropertyValue.end())
970 if (
nullptr == segmentationVectorProperty)
972 MITK_DEBUG <<
"Could not find the segmentation " << segmentationID <<
" in the storage. Cannot link segmentation to lesion.";
976 std::vector<std::string> segmentationVectorPropertyValue = segmentationVectorProperty->
GetValue();
977 if (segmentationVectorPropertyValue.size() != 2)
979 MITK_DEBUG <<
"Incorrect segmentation storage. Not two (2) IDs stored.";
984 segmentationVectorPropertyValue[1] = lesion.
UID;
985 segmentationVectorProperty->
SetValue(segmentationVectorPropertyValue);
989 MITK_DEBUG <<
"Could not find lesion " << lesion.
UID <<
" in the storage. Cannot link segmentation to lesion.";
995 if (
nullptr == propertyList)
997 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
1002 if (
nullptr == segmentationVectorProperty)
1004 MITK_DEBUG <<
"Could not find the segmentation " << segmentationID <<
" in the storage. Cannot unlink lesion from segmentation.";
1008 std::vector<std::string> segmentationVectorPropertyValue = segmentationVectorProperty->
GetValue();
1010 if (segmentationVectorPropertyValue.size() != 2)
1012 MITK_DEBUG <<
"Incorrect data storage. Not two (2) values stored.";
1018 segmentationVectorPropertyValue[1] =
"";
1019 segmentationVectorProperty->
SetValue(segmentationVectorPropertyValue);
1025 if (
nullptr == propertyList)
1027 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
1032 if (
nullptr == lesionVectorProperty)
1034 MITK_DEBUG <<
"Could not find any lesion in the storage.";
1039 std::vector<std::string> lesionsVectorPropertyValue = lesionVectorProperty->
GetValue();
1040 lesionsVectorPropertyValue.erase(std::remove(lesionsVectorPropertyValue.begin(), lesionsVectorPropertyValue.end(), lesion.
UID), lesionsVectorPropertyValue.end());
1041 if (lesionsVectorPropertyValue.empty())
1044 propertyList->DeleteProperty(
"lesions");
1049 lesionVectorProperty->
SetValue(lesionsVectorPropertyValue);
1055 if (
nullptr == lesionDataProperty)
1057 MITK_DEBUG <<
"Lesion " << lesion.
UID <<
" not found (already removed?). Cannot remove the lesion.";
1061 std::vector<std::string> lesionData = lesionDataProperty->
GetValue();
1063 if (lesionData.size() != 2)
1065 MITK_DEBUG <<
"Incorrect lesion data storage. Not two (2) strings of the lesion UID and the lesion name are stored.";
1069 std::string lesionClassID = lesionData[1];
1072 propertyList->DeleteProperty(lesion.
UID);
1078 if (
nullptr == propertyList)
1080 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
1086 if (
nullptr == lesionClassProperty)
1088 MITK_DEBUG <<
"Lesion class " << lesionClassID <<
" not found (already removed?). Cannot remove the lesion class.";
1094 if (
nullptr == lesionVectorProperty)
1100 std::vector<std::string> lesionsVectorPropertyValue = lesionVectorProperty->
GetValue();
1101 const auto existingLesionClass = std::find_if(lesionsVectorPropertyValue.begin(), lesionsVectorPropertyValue.end(),
1102 [&propertyList, &lesionClassID](
const std::string& lesionID)
1105 if (
nullptr == lesionDataProperty)
1110 std::vector<std::string> lesionData = lesionDataProperty->
GetValue();
1112 if (lesionData.size() != 2)
1117 return lesionData[1] == lesionClassID;
1120 if (existingLesionClass == lesionsVectorPropertyValue.end())
1123 propertyList->DeleteProperty(lesionClassID);
1130 if (
nullptr == propertyList)
1132 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
1137 std::vector<std::string> controlPointsVectorPropertyValue;
1138 if (
nullptr == controlPointsVectorProperty)
1144 controlPointsVectorPropertyValue = controlPointsVectorProperty->GetValue();
1147 const auto existingControlPoint = std::find(controlPointsVectorPropertyValue.begin(), controlPointsVectorPropertyValue.end(), controlPoint.
UID);
1148 if (existingControlPoint != controlPointsVectorPropertyValue.end())
1154 controlPointsVectorPropertyValue.push_back(controlPoint.
UID);
1156 controlPointsVectorProperty->SetValue(controlPointsVectorPropertyValue);
1157 propertyList->SetProperty(
"controlpoints", controlPointsVectorProperty);
1160 std::vector<int> controlPointDate;
1161 controlPointDate.push_back(controlPoint.
date.year());
1162 controlPointDate.push_back(controlPoint.
date.month());
1163 controlPointDate.push_back(controlPoint.
date.day());
1166 newControlPointVectorProperty->SetValue(controlPointDate);
1167 propertyList->SetProperty(controlPoint.
UID, newControlPointVectorProperty);
1173 if (
nullptr == propertyList)
1175 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
1180 if (
nullptr == controlPointsVectorProperty)
1182 MITK_DEBUG <<
"Could not find any control point in the storage.";
1186 std::vector<std::string> controlPointsVectorPropertyValue = controlPointsVectorProperty->
GetValue();
1187 const auto existingControlPoint = std::find(controlPointsVectorPropertyValue.begin(), controlPointsVectorPropertyValue.end(), controlPoint.
UID);
1188 if (existingControlPoint != controlPointsVectorPropertyValue.end())
1193 if (
nullptr == imageVectorProperty)
1195 MITK_DEBUG <<
"Could not find the image " << imageID <<
" in the storage. Cannot link data to control point.";
1199 std::vector<std::string> imageVectorPropertyValue = imageVectorProperty->
GetValue();
1201 if (imageVectorPropertyValue.size() != 2)
1203 MITK_DEBUG <<
"Incorrect data storage. Not two (2) values stored.";
1208 imageVectorPropertyValue[1] = controlPoint.
UID;
1209 imageVectorProperty->
SetValue(imageVectorPropertyValue);
1213 MITK_DEBUG <<
"Could not find control point " << controlPoint.
UID <<
" in the storage. Cannot link data to control point.";
1219 if (
nullptr == propertyList)
1221 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
1226 if (
nullptr == imageVectorProperty)
1228 MITK_DEBUG <<
"Could not find the date " << imageID <<
" in the storage. Cannot unlink control point from date.";
1232 std::vector<std::string> imageVectorPropertyValue = imageVectorProperty->
GetValue();
1234 if (imageVectorPropertyValue.size() != 2)
1236 MITK_DEBUG <<
"Incorrect data storage. Not two (2) values stored.";
1242 imageVectorPropertyValue[1] =
"";
1243 imageVectorProperty->
SetValue(imageVectorPropertyValue);
1249 if (
nullptr == propertyList)
1251 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
1256 if (
nullptr == controlPointsVectorProperty)
1258 MITK_DEBUG <<
"Could not find any control point in the storage.";
1263 std::vector<std::string> controlPointsVectorPropertyValue = controlPointsVectorProperty->
GetValue();
1264 controlPointsVectorPropertyValue.erase(std::remove(controlPointsVectorPropertyValue.begin(), controlPointsVectorPropertyValue.end(), controlPoint.
UID), controlPointsVectorPropertyValue.end());
1265 if (controlPointsVectorPropertyValue.empty())
1268 propertyList->DeleteProperty(
"controlpoints");
1273 controlPointsVectorProperty->
SetValue(controlPointsVectorPropertyValue);
1277 propertyList->DeleteProperty(controlPoint.
UID);
1283 if (
nullptr == propertyList)
1285 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
1290 std::vector<std::string> examinationPeriodsVectorPropertyValue;
1291 if (
nullptr == examinationPeriodsVectorProperty)
1297 examinationPeriodsVectorPropertyValue = examinationPeriodsVectorProperty->GetValue();
1300 const auto& existingIndex = std::find(examinationPeriodsVectorPropertyValue.begin(), examinationPeriodsVectorPropertyValue.end(), examinationPeriod.
UID);
1301 if (existingIndex != examinationPeriodsVectorPropertyValue.end())
1307 examinationPeriodsVectorPropertyValue.push_back(examinationPeriod.
UID);
1309 examinationPeriodsVectorProperty->SetValue(examinationPeriodsVectorPropertyValue);
1310 propertyList->SetProperty(
"examinationperiods", examinationPeriodsVectorProperty);
1313 std::vector<std::string> examinationPeriodData;
1314 examinationPeriodData.push_back(examinationPeriod.
name);
1316 newExaminationPeriodVectorProperty->SetValue(examinationPeriodData);
1317 propertyList->SetProperty(examinationPeriod.
UID, newExaminationPeriodVectorProperty);
1323 if (
nullptr == propertyList)
1325 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
1330 if (
nullptr == examinationPeriodDataVectorProperty)
1332 MITK_DEBUG <<
"Could not find examination period " << examinationPeriod.
UID <<
" in the storage. Cannot rename the examination period.";
1336 std::vector<std::string> examinationPeriodDataVectorPropertyValue = examinationPeriodDataVectorProperty->
GetValue();
1338 if (examinationPeriodDataVectorPropertyValue.size() < 1)
1340 MITK_DEBUG <<
"Incorrect examination period storage. At least one (1) name has to be stored.";
1346 examinationPeriodDataVectorPropertyValue[0] = examinationPeriod.
name;
1348 examinationPeriodDataVectorProperty->
SetValue(examinationPeriodDataVectorPropertyValue);
1355 if (
nullptr == propertyList)
1357 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
1363 if (
nullptr == controlPointUIDsVectorProperty)
1365 MITK_DEBUG <<
"Could not find the examination period " << examinationPeriod.
UID <<
" in the storage. Cannot add the control point to the examination period.";
1369 std::vector<std::string> controlPointUIDsVectorPropertyValue = controlPointUIDsVectorProperty->
GetValue();
1371 controlPointUIDsVectorPropertyValue.push_back(controlPoint.
UID);
1375 const auto& leftControlPoint = GenerateControlpoint(caseID, leftControlPointUID);
1376 const auto& rightControlPoint = GenerateControlpoint(caseID, rightControlPointUID);
1378 return leftControlPoint.date <= rightControlPoint.date;
1381 std::sort(controlPointUIDsVectorPropertyValue.begin(), controlPointUIDsVectorPropertyValue.end(), lambda);
1383 controlPointUIDsVectorProperty->
SetValue(controlPointUIDsVectorPropertyValue);
1389 if (
nullptr == propertyList)
1391 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
1397 if (
nullptr == controlPointUIDsVectorProperty)
1399 MITK_DEBUG <<
"Could not find examination period " << examinationPeriod.
UID <<
" in the storage. Cannot add the control point to the examination period.";
1403 std::vector<std::string> controlPointUIDsVectorPropertyValue = controlPointUIDsVectorProperty->
GetValue();
1405 if (controlPointUIDsVectorPropertyValue.size() < 2)
1407 MITK_DEBUG <<
"Incorrect examination period storage. At least one (1) control point ID has to be stored.";
1412 controlPointUIDsVectorPropertyValue.erase(std::remove(controlPointUIDsVectorPropertyValue.begin(), controlPointUIDsVectorPropertyValue.end(), controlPoint.
UID), controlPointUIDsVectorPropertyValue.end());
1413 if (controlPointUIDsVectorPropertyValue.size() < 2)
1420 controlPointUIDsVectorProperty->
SetValue(controlPointUIDsVectorPropertyValue);
1428 if (
nullptr == propertyList)
1430 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
1435 if (
nullptr == examinationPeriodsVectorProperty)
1437 MITK_DEBUG <<
"Could not find any examination periods in the storage.";
1441 std::vector<std::string> examinationPeriodsVectorPropertyValue = examinationPeriodsVectorProperty->GetValue();
1442 examinationPeriodsVectorPropertyValue.erase(std::remove(examinationPeriodsVectorPropertyValue.begin(), examinationPeriodsVectorPropertyValue.end(), examinationPeriod.
UID), examinationPeriodsVectorPropertyValue.end());
1443 if (examinationPeriodsVectorPropertyValue.empty())
1446 propertyList->DeleteProperty(
"examinationperiods");
1451 examinationPeriodsVectorProperty->SetValue(examinationPeriodsVectorPropertyValue);
1455 propertyList->DeleteProperty(examinationPeriod.
UID);
1461 if (
nullptr == propertyList)
1463 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
1468 std::vector<std::string> informationTypesVectorPropertyValue;
1469 if (
nullptr == informationTypesVectorProperty)
1475 informationTypesVectorPropertyValue = informationTypesVectorProperty->GetValue();
1478 const auto existingInformationType = std::find(informationTypesVectorPropertyValue.begin(), informationTypesVectorPropertyValue.end(), informationType);
1479 if (existingInformationType == informationTypesVectorPropertyValue.end())
1482 informationTypesVectorPropertyValue.push_back(informationType);
1483 informationTypesVectorProperty->SetValue(informationTypesVectorPropertyValue);
1484 propertyList->SetProperty(
"informationtypes", informationTypesVectorProperty);
1490 if (
nullptr == imageVectorProperty)
1492 MITK_DEBUG <<
"Could not find the image " << imageID <<
" in the storage. Cannot add information type to image.";
1496 std::vector<std::string> imageVectorPropertyValue = imageVectorProperty->
GetValue();
1498 if (imageVectorPropertyValue.size() != 2)
1500 MITK_DEBUG <<
"Incorrect data storage. Not two (2) values stored.";
1505 imageVectorPropertyValue[0] = informationType;
1506 imageVectorProperty->
SetValue(imageVectorPropertyValue);
1512 if (
nullptr == propertyList)
1514 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
1519 if (
nullptr == imageVectorProperty)
1521 MITK_DEBUG <<
"Could not find the image " << imageID <<
" in the storage. Cannot remove information type from image.";
1525 std::vector<std::string> imageVectorPropertyValue = imageVectorProperty->
GetValue();
1527 if (imageVectorPropertyValue.size() != 2)
1529 MITK_DEBUG <<
"Incorrect data storage. Not two (2) values stored.";
1535 imageVectorPropertyValue[0] =
"";
1536 imageVectorProperty->
SetValue(imageVectorPropertyValue);
1542 if (
nullptr == propertyList)
1544 MITK_DEBUG <<
"Could not find the property list " << caseID <<
" for the current MITK workbench / session.";
1549 if (
nullptr == informationTypesVectorProperty)
1551 MITK_DEBUG <<
"Could not find any information type in the storage.";
1555 std::vector<std::string> informationTypesVectorPropertyValue = informationTypesVectorProperty->
GetValue();
1556 informationTypesVectorPropertyValue.erase(std::remove(informationTypesVectorPropertyValue.begin(), informationTypesVectorPropertyValue.end(), informationType), informationTypesVectorPropertyValue.end());
1557 if (informationTypesVectorPropertyValue.empty())
1560 propertyList->DeleteProperty(
"informationtypes");
1565 informationTypesVectorProperty->
SetValue(informationTypesVectorPropertyValue);
void AddExaminationPeriod(const SemanticTypes::CaseID &caseID, const SemanticTypes::ExaminationPeriod &examinationPeriod)
void AddInformationTypeToImage(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &imageID, const SemanticTypes::InformationType &informationType)
void LinkSegmentationToLesion(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &segmentationID, const SemanticTypes::Lesion &lesion)
SemanticTypes::InformationType GetInformationTypeOfImage(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &imageID)
void AddControlPointToExaminationPeriod(const SemanticTypes::CaseID &caseID, const SemanticTypes::ControlPoint &controlPoint, const SemanticTypes::ExaminationPeriod &examinationPeriod)
std::vector< ID > IDVector
std::vector< ID > controlPointUIDs
virtual const char * GetValue() const
void RemoveControlPoint(const SemanticTypes::CaseID &caseID, const SemanticTypes::ControlPoint &controlPoint)
void UnlinkSegmentationFromLesion(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &segmentationID)
virtual void SetValue(const VectorType ¶meter_vector)
sets the content vector
MITKSEMANTICRELATIONS_EXPORT bool InstanceExists(const SemanticTypes::CaseID &caseID)
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::InformationTypeVector GetAllInformationTypesOfCase(const SemanticTypes::CaseID &caseID)
virtual const VectorType & GetValue() const
returns a const reference to the contained vector
boost::gregorian::date date
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::IDVector GetAllSegmentationIDsOfImage(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &imageID)
std::vector< Lesion > LesionVector
void AddControlPoint(const SemanticTypes::CaseID &caseID, const SemanticTypes::ControlPoint &controlPoint)
SemanticTypes::ControlPoint GetControlPointOfImage(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &imageID)
void AddImage(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &imageID)
MITKSEMANTICRELATIONS_EXPORT void RenameExaminationPeriod(const SemanticTypes::CaseID &caseID, const SemanticTypes::ExaminationPeriod &examinationPeriod)
std::vector< ControlPoint > ControlPointVector
void RemoveLesionClass(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &lesionClassID)
SemanticTypes::Lesion GetLesionOfSegmentation(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &segmentationID)
void RemoveControlPointFromExaminationPeriod(const SemanticTypes::CaseID &caseID, const SemanticTypes::ControlPoint &controlPoint, const SemanticTypes::ExaminationPeriod &examinationPeriod)
void LinkImageToControlPoint(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &imageID, const SemanticTypes::ControlPoint &controlPoint)
The concept of an examination period. An examination period holds a vector of control point UIDs...
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::IDVector GetAllSegmentationIDsOfLesion(const SemanticTypes::CaseID &caseID, const SemanticTypes::Lesion &lesion)
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::IDVector GetAllImageIDsOfInformationType(const SemanticTypes::CaseID &caseID, const SemanticTypes::InformationType &informationType)
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::LesionVector GetAllLesionsOfCase(const SemanticTypes::CaseID &caseID)
void UnlinkImageFromControlPoint(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &imageID)
void OverwriteLesion(const SemanticTypes::CaseID &caseID, const SemanticTypes::Lesion &lesion)
void RemoveExaminationPeriod(const SemanticTypes::CaseID &caseID, const SemanticTypes::ExaminationPeriod &examinationPeriod)
#define PERSISTENCE_GET_SERVICE_MACRO
Providing a std::vector as property.
void RemoveLesion(const SemanticTypes::CaseID &caseID, const SemanticTypes::Lesion &lesion)
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::IDVector GetAllImageIDsOfControlPoint(const SemanticTypes::CaseID &caseID, const SemanticTypes::ControlPoint &controlPoint)
void RemoveInformationTypeFromImage(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &imageID)
std::string InformationType
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ExaminationPeriodVector GetAllExaminationPeriodsOfCase(const SemanticTypes::CaseID &caseID)
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::IDVector GetAllSegmentationIDsOfCase(const SemanticTypes::CaseID &caseID)
MITKSEMANTICRELATIONS_EXPORT std::vector< SemanticTypes::CaseID > GetAllCaseIDs()
std::vector< InformationType > InformationTypeVector
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::IDVector GetAllImageIDsOfCase(const SemanticTypes::CaseID &caseID)
void RemoveSegmentation(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &segmentationID)
void RemoveImage(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &imageID)
void AddLesion(const SemanticTypes::CaseID &caseID, const SemanticTypes::Lesion &lesion)
void AddSegmentation(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &segmentationID, const SemanticTypes::ID &parentID)
std::vector< ExaminationPeriod > ExaminationPeriodVector
SemanticTypes::ID GetImageIDOfSegmentation(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &segmentationID)
void RemoveInformationType(const SemanticTypes::CaseID &caseID, const SemanticTypes::InformationType &informationType)
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ControlPointVector GetAllControlPointsOfCase(const SemanticTypes::CaseID &caseID)
void AddCase(const SemanticTypes::CaseID &caseID)