36 CPPUNIT_TEST_SUITE(mitkSemanticRelationsTestSuite);
41 CPPUNIT_TEST_SUITE_END();
55 void tearDown()
override 64 void IntegrationTest()
66 MITK_INFO <<
"=== IntegrationTest start ===";
69 SegmentationAndLesion();
71 MITK_INFO <<
"=== IntegrationTest end ===";
76 MITK_INFO <<
"=== InferenceTest start ===";
82 void DataStorageAccessTest()
84 MITK_INFO <<
"=== DataStorageAccessTest start ===";
86 MITK_INFO <<
"=== DataStorageAccessTest end ===";
89 void RemoveAndUnlinkTest()
91 MITK_INFO <<
"=== RemoveAndUnlinkTest start ===";
93 LesionRemoveAndUnlink();
94 RemoveImagesAndSegmentation();
95 MITK_INFO <<
"=== RemoveAndUnlinkTest end ===";
110 m_DataStorage->Add(
image);
111 CPPUNIT_ASSERT_MESSAGE(
"Not a valid image data node",
image.IsNotNull());
112 CPPUNIT_ASSERT_MESSAGE(
"Image data is empty",
image->GetData() !=
nullptr);
117 CPPUNIT_ASSERT_MESSAGE(
"CaseID not correctly stored", allCaseIDs.front() ==
"Patient1");
118 auto caseID = allCaseIDs.front();
122 CPPUNIT_ASSERT_MESSAGE(
"One control point should be stored", allControlPoints.size() == 1);
126 controlPointToCompare.
date = boost::gregorian::date(2019, 01, 01);
127 CPPUNIT_ASSERT_MESSAGE(
"Control point not correctly stored", controlPointOfImage.date == controlPointToCompare.
date);
131 CPPUNIT_ASSERT_MESSAGE(
"One information type should be stored", allInformationTypes.size() == 1);
134 CPPUNIT_ASSERT_MESSAGE(
"Information type not correctly stored", informationType ==
"CT");
138 CPPUNIT_ASSERT_MESSAGE(
"Information type not correctly stored", informationType ==
"MR");
141 void ExaminationPeriod()
149 m_DataStorage->Add(MRImage);
150 CPPUNIT_ASSERT_MESSAGE(
"Not a valid image data node", MRImage.IsNotNull());
151 CPPUNIT_ASSERT_MESSAGE(
"Image data is empty", MRImage->GetData() !=
nullptr);
152 semanticRelationsIntegration.
AddImage(MRImage);
156 CPPUNIT_ASSERT_MESSAGE(
"One CaseID should be stored", allCaseIDs.size() == 1);
157 auto caseID = allCaseIDs.front();
160 CPPUNIT_ASSERT_MESSAGE(
"One control point should be stored", allControlPoints.size() == 1);
164 controlPoint.
date = boost::gregorian::date(2019, 01, 01);
165 CPPUNIT_ASSERT_MESSAGE(
"Control point not correctly stored", controlPointOfImage.date == controlPoint.
date);
168 CPPUNIT_ASSERT_MESSAGE(
"One examination period should be stored", examinationPeriod.size() == 1);
171 CPPUNIT_ASSERT_MESSAGE(
"Two images should reference the same control point", allImageIDs.size() == 2);
176 m_DataStorage->Add(CTImage);
177 CPPUNIT_ASSERT_MESSAGE(
"Not a valid image data node", CTImage.IsNotNull());
178 CPPUNIT_ASSERT_MESSAGE(
"Image data is empty", CTImage->GetData() !=
nullptr);
179 semanticRelationsIntegration.
AddImage(CTImage);
183 CPPUNIT_ASSERT_MESSAGE(
"Two control points should be stored", allControlPoints.size() == 2);
186 CPPUNIT_ASSERT_MESSAGE(
"One examination period should be stored", examinationPeriod.size() == 1);
193 controlPoint.
date = boost::gregorian::date(2019, 02, 01);
198 CPPUNIT_ASSERT_MESSAGE(
"Two control points should be stored", allControlPoints.size() == 2);
201 CPPUNIT_ASSERT_MESSAGE(
"Two examination periods should be stored", examinationPeriod.size() == 2);
204 void SegmentationAndLesion()
206 MITK_INFO <<
"=== SegmentationAndLesion";
213 m_DataStorage->Add(
image);
214 CPPUNIT_ASSERT_MESSAGE(
"Not a valid image data node",
image.IsNotNull());
215 CPPUNIT_ASSERT_MESSAGE(
"Image data is empty",
image->GetData() !=
nullptr);
219 m_DataStorage->Add(segmentation,
image);
220 CPPUNIT_ASSERT_MESSAGE(
"Not a valid segmentation data node", segmentation.IsNotNull());
221 CPPUNIT_ASSERT_MESSAGE(
"Segmentation data is empty", segmentation->GetData() !=
nullptr);
226 CPPUNIT_ASSERT_MESSAGE(
"Two CaseIDs should be stored", allCaseIDs.size() == 2);
233 CPPUNIT_ASSERT_MESSAGE(
"Represented lesion should be the only stored lesion", lesion.UID == representedLesion.UID);
241 std::string caseID =
"invalidID";
243 CPPUNIT_ASSERT_MESSAGE(
"No lesion should be stored, given a non-existing CaseID", allLesions.size() == 0);
246 CPPUNIT_ASSERT_MESSAGE(
"No control point should be stored, given a non-existing CaseID", allControlPoints.size() == 0);
249 CPPUNIT_ASSERT_MESSAGE(
"No examination periods should be stored, given a non-existing CaseID", allExaminationPeriods.size() == 0);
252 CPPUNIT_ASSERT_MESSAGE(
"No information type should be stored, given a non-existing CaseID", allInformationTypes.size() == 0);
255 CPPUNIT_ASSERT_MESSAGE(
"No image ID should be stored, given a non-existing CaseID", allControlPoints.size() == 0);
259 m_DataStorage->Add(invalidDateImage);
261 CPPUNIT_ASSERT_MESSAGE(
"Not a valid image data node", invalidDateImage.IsNotNull());
262 CPPUNIT_ASSERT_MESSAGE(
"Image data is empty", invalidDateImage->GetData() !=
nullptr);
265 CPPUNIT_ASSERT_THROW_MESSAGE(
"Semantic relation exception not thrown: AddImage",
266 semanticRelationsIntegration.AddImage(invalidDateImage),
270 CPPUNIT_ASSERT_MESSAGE(
"No control point should be stored for an invalid DICOM date", controlPointOfImage.UID.empty());
276 CPPUNIT_ASSERT_THROW_MESSAGE(
"Semantic relation exception not thrown: GenerateControlPoint",
284 semanticRelationsIntegration.AddImage(invalidDateImage);
288 controlPointToCompare.
date = boost::gregorian::date(2018, 01, 01);
289 CPPUNIT_ASSERT_MESSAGE(
"Control point not correctly stored", controlPointOfImage.date == controlPointToCompare.
date);
293 m_DataStorage->Add(invalidModalityImage);
295 CPPUNIT_ASSERT_MESSAGE(
"Not a valid image data node", invalidModalityImage.IsNotNull());
296 CPPUNIT_ASSERT_MESSAGE(
"Image data is empty", invalidModalityImage->GetData() !=
nullptr);
298 CPPUNIT_ASSERT_THROW_MESSAGE(
"Semantic relation exception not thrown: AddImage",
299 semanticRelationsIntegration.AddImage(invalidModalityImage),
303 CPPUNIT_ASSERT_MESSAGE(
"No information type should be stored for an invalid DICOM date", informationTypeOfImage.empty());
309 semanticRelationsIntegration.AddImage(invalidModalityImage);
312 CPPUNIT_ASSERT_MESSAGE(
"Information type not correctly stored", informationType ==
"CT");
316 m_DataStorage->Add(invalidIDImage);
318 CPPUNIT_ASSERT_MESSAGE(
"Not a valid image data node", invalidModalityImage.IsNotNull());
319 CPPUNIT_ASSERT_MESSAGE(
"Image data is empty", invalidModalityImage->GetData() !=
nullptr);
321 CPPUNIT_ASSERT_THROW_MESSAGE(
"Semantic relation exception not thrown: AddImage",
322 semanticRelationsIntegration.AddImage(invalidIDImage),
330 semanticRelationsIntegration.AddImage(invalidIDImage);
333 CPPUNIT_ASSERT_MESSAGE(
"ID not correctly stored", IDFromNode == generatedUID);
337 m_DataStorage->Add(invalidCaseIDImage);
339 CPPUNIT_ASSERT_MESSAGE(
"Not a valid image data node", invalidModalityImage.IsNotNull());
340 CPPUNIT_ASSERT_MESSAGE(
"Image data is empty", invalidModalityImage->GetData() !=
nullptr);
342 CPPUNIT_ASSERT_THROW_MESSAGE(
"Semantic relation exception not thrown: AddImage",
343 semanticRelationsIntegration.AddImage(invalidCaseIDImage),
350 semanticRelationsIntegration.AddImage(invalidCaseIDImage);
353 CPPUNIT_ASSERT_MESSAGE(
"Case ID not correctly stored", caseIDFromNode ==
"Patient7");
357 void CombinedQueries()
363 m_DataStorage->Add(
image);
365 CPPUNIT_ASSERT_MESSAGE(
"Not a valid image data node",
image.IsNotNull());
366 CPPUNIT_ASSERT_MESSAGE(
"Image data is empty",
image->GetData() !=
nullptr);
369 m_DataStorage->Add(segmentation,
image);
371 CPPUNIT_ASSERT_MESSAGE(
"Not a valid segmentation data node", segmentation.IsNotNull());
372 CPPUNIT_ASSERT_MESSAGE(
"Segmentation data is empty", segmentation->GetData() !=
nullptr);
376 semanticRelationsIntegration.AddSegmentation(segmentation,
image);
381 semanticRelationsIntegration.AddLesionAndLinkSegmentation(segmentation, lesion);
384 CPPUNIT_ASSERT_MESSAGE(
"One lesion should be stored", allLesionsOfImage.size() == 1);
388 CPPUNIT_ASSERT_MESSAGE(
"Lesions should be the same", (allLesionsOfImage.size() == allLesionsOfControlPoint.size())
389 && (allLesionsOfImage.front().UID == allLesionsOfControlPoint.front().UID));
392 CPPUNIT_ASSERT_MESSAGE(
"Image IDs should be the same", (allImageIDsOfLesion.size() == 1)
396 CPPUNIT_ASSERT_MESSAGE(
"Control points should be the same", (allControlPointsOfLesion.size() == 1)
397 && (allControlPointsOfLesion.front().date == controlPoint.date));
401 CPPUNIT_ASSERT_MESSAGE(
"Control points should be the same", (allControlPointsOfLesion.size() == 1)
402 && (allControlPointsOfLesion.front().date == controlPoint.date));
405 CPPUNIT_ASSERT_MESSAGE(
"Information types should be the same", (allInformationTypesOfControlPoint.size() == 1)
406 && (allInformationTypesOfControlPoint.front() == informationType));
409 void InstanceExistences()
414 auto allSegmentationsOfCase = semanticRelationsDataStorageAccess.GetAllSegmentationsOfCase(
"Patient2");
415 CPPUNIT_ASSERT_MESSAGE(
"One segmentation should be stored", allSegmentationsOfCase.size() == 1);
417 auto segmentation = allSegmentationsOfCase.front();
418 CPPUNIT_ASSERT_MESSAGE(
"Not a valid segmentation data node", segmentation.IsNotNull());
419 CPPUNIT_ASSERT_MESSAGE(
"Segmentation data is empty", segmentation->GetData() !=
nullptr);
422 CPPUNIT_ASSERT_MESSAGE(
"Segmentation node should represent a lesion", valid);
424 auto caseID =
"Patient2";
426 CPPUNIT_ASSERT_MESSAGE(
"Segmentation (via ID) should represent a lesion", valid);
429 CPPUNIT_ASSERT_MESSAGE(
"One lesion should be stored", allLesions.size() == 1);
431 auto lesion = allLesions.front();
433 CPPUNIT_ASSERT_MESSAGE(
"Lesion should be present on segmentation", valid);
435 auto allImagesOfCase = semanticRelationsDataStorageAccess.GetAllImagesOfCase(caseID);
436 CPPUNIT_ASSERT_MESSAGE(
"One image should be stored", allImagesOfCase.size() == 1);
438 auto image = allImagesOfCase.front();
439 CPPUNIT_ASSERT_MESSAGE(
"Not a valid image data node", image.IsNotNull());
440 CPPUNIT_ASSERT_MESSAGE(
"Image data is empty", image->GetData() !=
nullptr);
443 CPPUNIT_ASSERT_MESSAGE(
"Lesion should be present on image", valid);
446 CPPUNIT_ASSERT_MESSAGE(
"Lesion should be present on segmentation", valid);
449 CPPUNIT_ASSERT_MESSAGE(
"Lesion should be present on image", valid);
453 CPPUNIT_ASSERT_MESSAGE(
"Lesion should be present at control point", valid);
455 controlPoint.date = boost::gregorian::date(2019, 01, 01);
457 CPPUNIT_ASSERT_MESSAGE(
"No lesion should be present at control point", !valid);
460 CPPUNIT_ASSERT_MESSAGE(
"Image should exist", valid);
463 CPPUNIT_ASSERT_MESSAGE(
"Segmentation should exist", valid);
466 CPPUNIT_ASSERT_MESSAGE(
"Lesion should exist", valid);
470 CPPUNIT_ASSERT_MESSAGE(
"Lesion should not exist", !valid);
474 CPPUNIT_ASSERT_MESSAGE(
"Control point should not exist for this case", !valid);
477 CPPUNIT_ASSERT_MESSAGE(
"Control point should exist for this case", valid);
480 CPPUNIT_ASSERT_MESSAGE(
"One examination period should be stored", allExaminationPeriod.size() == 1);
481 auto examinationPeriod = allExaminationPeriod.front();
484 CPPUNIT_ASSERT_MESSAGE(
"Examination period should exist for this case", valid);
488 CPPUNIT_ASSERT_MESSAGE(
"Control point should exist for this case", valid);
491 CPPUNIT_ASSERT_MESSAGE(
"Control point should not exist for this case", !valid);
494 CPPUNIT_ASSERT_MESSAGE(
"Specific image should exist for this case", valid);
497 CPPUNIT_ASSERT_MESSAGE(
"Specific image should exist for this case", valid);
500 CPPUNIT_ASSERT_MESSAGE(
"Specific image should exist for this case", valid);
504 void DataStorageAccess()
513 m_DataStorage->Add(CTImage);
514 CPPUNIT_ASSERT_MESSAGE(
"Not a valid image data node", CTImage.IsNotNull());
515 CPPUNIT_ASSERT_MESSAGE(
"Image data is empty", CTImage->GetData() !=
nullptr);
516 semanticRelationsIntegration.
AddImage(CTImage);
519 m_DataStorage->Add(MRImage);
520 CPPUNIT_ASSERT_MESSAGE(
"Not a valid image data node", MRImage.IsNotNull());
521 CPPUNIT_ASSERT_MESSAGE(
"Image data is empty", MRImage->GetData() !=
nullptr);
522 semanticRelationsIntegration.
AddImage(MRImage);
525 m_DataStorage->Add(otherCTImage);
526 CPPUNIT_ASSERT_MESSAGE(
"Not a valid image data node", otherCTImage.IsNotNull());
527 CPPUNIT_ASSERT_MESSAGE(
"Image data is empty", otherCTImage->GetData() !=
nullptr);
528 semanticRelationsIntegration.
AddImage(otherCTImage);
532 m_DataStorage->Add(PETImage);
533 CPPUNIT_ASSERT_MESSAGE(
"Not a valid image data node", PETImage.IsNotNull());
534 CPPUNIT_ASSERT_MESSAGE(
"Image data is empty", PETImage->GetData() !=
nullptr);
535 semanticRelationsIntegration.
AddImage(PETImage);
538 m_DataStorage->Add(PETSegmentation, PETImage);
539 CPPUNIT_ASSERT_MESSAGE(
"Not a valid segmentation data node", PETSegmentation.IsNotNull());
540 CPPUNIT_ASSERT_MESSAGE(
"Segmentation data is empty", PETSegmentation->GetData() !=
nullptr);
541 semanticRelationsIntegration.
AddSegmentation(PETSegmentation, PETImage);
549 auto caseID =
"Patient1";
550 auto allSegmentationsOfCase = semanticRelationsDataStorageAccess.GetAllSegmentationsOfCase(caseID);
551 CPPUNIT_ASSERT_MESSAGE(
"No segmentation should be stored", allSegmentationsOfCase.size() == 0);
553 auto allImagesOfCase = semanticRelationsDataStorageAccess.GetAllImagesOfCase(caseID);
554 CPPUNIT_ASSERT_MESSAGE(
"Three images should be stored", allImagesOfCase.size() == 3);
557 CPPUNIT_ASSERT_MESSAGE(
"No lesion should be stored", allLesions.size() == 0);
560 CPPUNIT_ASSERT_THROW_MESSAGE(
"Semantic relation exception not thrown: GetAllSegmentationsOfLesion",
561 semanticRelationsDataStorageAccess.GetAllSegmentationsOfLesion(caseID, emptyLesion),
566 CPPUNIT_ASSERT_MESSAGE(
"One lesion should be stored", allLesions.size() == 1);
568 lesion = allLesions.front();
569 auto allSegmentationsOfLesion = semanticRelationsDataStorageAccess.GetAllSegmentationsOfLesion(caseID, lesion);
570 CPPUNIT_ASSERT_MESSAGE(
"One segmentation should be stored", allSegmentationsOfLesion.size() == 1);
572 auto allImagesOfLesion = semanticRelationsDataStorageAccess.GetAllImagesOfLesion(caseID, lesion);
573 CPPUNIT_ASSERT_MESSAGE(
"One image should be stored", allImagesOfLesion.size() == 1);
576 CPPUNIT_ASSERT_MESSAGE(
"One control point should be stored", allControlPointsOfLesion.size() == 1);
577 auto controlPoint = allControlPointsOfLesion.front();
579 auto allSpecificImages = semanticRelationsDataStorageAccess.GetAllSpecificImages(caseID, controlPoint,
"PT");
580 CPPUNIT_ASSERT_MESSAGE(
"One image should be stored", allSpecificImages.size() == 1);
582 CPPUNIT_ASSERT_THROW_MESSAGE(
"Semantic relation exception not thrown: GetAllSpecificImages",
583 semanticRelationsDataStorageAccess.GetAllSpecificImages(caseID, controlPoint,
"CT"),
586 auto allSpecificSegmentations = semanticRelationsDataStorageAccess.GetAllSpecificSegmentations(caseID, controlPoint,
"PT");
587 CPPUNIT_ASSERT_MESSAGE(
"One segmentation should be stored", allSpecificSegmentations.size() == 1);
589 CPPUNIT_ASSERT_THROW_MESSAGE(
"Semantic relation exception not thrown: GetAllSpecificSegmentations",
590 semanticRelationsDataStorageAccess.GetAllSpecificSegmentations(caseID, controlPoint,
"MR"),
595 void CPRemoveAndUnlink()
603 m_DataStorage->Add(CTImage);
604 CPPUNIT_ASSERT_MESSAGE(
"Not a valid image data node", CTImage.IsNotNull());
605 CPPUNIT_ASSERT_MESSAGE(
"Image data is empty", CTImage->GetData() !=
nullptr);
606 semanticRelationsIntegration.
AddImage(CTImage);
609 m_DataStorage->Add(MRImage);
610 CPPUNIT_ASSERT_MESSAGE(
"Not a valid image data node", MRImage.IsNotNull());
611 CPPUNIT_ASSERT_MESSAGE(
"Image data is empty", MRImage->GetData() !=
nullptr);
612 semanticRelationsIntegration.
AddImage(MRImage);
616 CPPUNIT_ASSERT_MESSAGE(
"One CaseID should be stored", allCaseIDs.size() == 1);
618 auto caseID = allCaseIDs.front();
619 CPPUNIT_ASSERT_MESSAGE(
"CaseID should be Patient3", caseID ==
"Patient3");
622 CPPUNIT_ASSERT_MESSAGE(
"One examination period should be sored", allExaminationPeriods.size() == 1);
625 CPPUNIT_ASSERT_MESSAGE(
"Two control points should be stored", allControlPoints.size() == 2);
632 CPPUNIT_ASSERT_MESSAGE(
"One examination period should be stored", allExaminationPeriods.size() == 1);
635 CPPUNIT_ASSERT_MESSAGE(
"One control point should be stored since one has been removed", allControlPoints.size() == 1);
638 CPPUNIT_ASSERT_MESSAGE(
"Control point should be removed", CTControlPoint.UID.empty());
644 CPPUNIT_ASSERT_MESSAGE(
"One examination period should be sored", allExaminationPeriods.size() == 1);
647 CPPUNIT_ASSERT_MESSAGE(
"Two control points should be stored", allControlPoints.size() == 2);
651 newCTControlPoint.date = boost::gregorian::date(2019, 03, 01);
655 CPPUNIT_ASSERT_MESSAGE(
"One examination period should be sored", allExaminationPeriods.size() == 1);
658 CPPUNIT_ASSERT_MESSAGE(
"Two control points should be stored", allControlPoints.size() == 2);
661 newCTControlPoint.date = boost::gregorian::date(2019, 01, 01);
665 CPPUNIT_ASSERT_MESSAGE(
"Two examination periods should be stored", allExaminationPeriods.size() == 2);
668 CPPUNIT_ASSERT_MESSAGE(
"Two control points should be stored", allControlPoints.size() == 2);
671 void LesionRemoveAndUnlink()
673 MITK_INFO <<
"=== LesionRemoveAndUnlink";
680 CPPUNIT_ASSERT_MESSAGE(
"One CaseID should be stored", allCaseIDs.size() == 1);
681 auto caseID = allCaseIDs.front();
683 auto allImages = semanticRelationsDataStorageAccess.GetAllImagesOfCase(caseID);
684 CPPUNIT_ASSERT_MESSAGE(
"Two images should be stored", allImages.size() == 2);
687 CPPUNIT_ASSERT_MESSAGE(
"One image should be stored", allCTImageIDs.size() == 1);
690 CPPUNIT_ASSERT_MESSAGE(
"One image should be stored", allMRImageIDs.size() == 1);
694 for (
const auto& image : allImages)
697 if (imageID == allCTImageIDs.front())
701 else if (imageID == allMRImageIDs.front())
707 CPPUNIT_ASSERT_MESSAGE(
"Not a valid image data node", CTImage.IsNotNull());
708 CPPUNIT_ASSERT_MESSAGE(
"Image data is empty", CTImage->GetData() !=
nullptr);
710 CPPUNIT_ASSERT_MESSAGE(
"Not a valid image data node", MRImage.IsNotNull());
711 CPPUNIT_ASSERT_MESSAGE(
"Image data is empty", MRImage->GetData() !=
nullptr);
714 m_DataStorage->Add(CTSegmentation, CTImage);
715 CPPUNIT_ASSERT_MESSAGE(
"Not a valid segmentation data node", CTSegmentation.IsNotNull());
716 CPPUNIT_ASSERT_MESSAGE(
"Segmentation data is empty", CTSegmentation->GetData() !=
nullptr);
720 m_DataStorage->Add(MRSegmentation, MRImage);
721 CPPUNIT_ASSERT_MESSAGE(
"Not a valid segmentation data node", MRSegmentation.IsNotNull());
722 CPPUNIT_ASSERT_MESSAGE(
"Segmentation data is empty", MRSegmentation->GetData() !=
nullptr);
732 CPPUNIT_ASSERT_MESSAGE(
"Two lesions should be stored", allLesions.size() == 2);
738 CPPUNIT_ASSERT_MESSAGE(
"Two lesions should be stored", allLesions.size() == 2);
741 CPPUNIT_ASSERT_MESSAGE(
"Lesion should be removed", emptyLesion.UID.empty());
745 CPPUNIT_ASSERT_MESSAGE(
"Two lesions should be stored", allLesions.size() == 2);
748 CPPUNIT_ASSERT_THROW_MESSAGE(
"Semantic relation exception not thrown: RemoveLesion",
749 semanticRelationsIntegration.
RemoveLesion(caseID, CTLesion),
753 semanticRelationsIntegration.
RemoveLesion(caseID, CTLesion);
756 CPPUNIT_ASSERT_MESSAGE(
"One lesions should be stored since one has been removed", allLesions.size() == 1);
759 CPPUNIT_ASSERT_MESSAGE(
"Lesion should be removed", CTLesion.UID.empty());
762 void RemoveImagesAndSegmentation()
764 MITK_INFO <<
"=== RemoveImagesAndSegmentation";
771 CPPUNIT_ASSERT_MESSAGE(
"One CaseID should be stored", allCaseIDs.size() == 1);
772 auto caseID = allCaseIDs.front();
774 auto allImages = semanticRelationsDataStorageAccess.GetAllImagesOfCase(caseID);
775 CPPUNIT_ASSERT_MESSAGE(
"Two images should be stored", allImages.size() == 2);
777 auto allSegmentations = semanticRelationsDataStorageAccess.GetAllSegmentationsOfCase(caseID);
778 CPPUNIT_ASSERT_MESSAGE(
"Two segmentations should be stored", allSegmentations.size() == 2);
780 for (
const auto& image : allImages)
785 for (
const auto& segmentation : allSegmentations)
790 allImages = semanticRelationsDataStorageAccess.GetAllImagesOfCase(caseID);
791 CPPUNIT_ASSERT_MESSAGE(
"No images should be stored", allImages.size() == 0);
793 allSegmentations = semanticRelationsDataStorageAccess.GetAllSegmentationsOfCase(caseID);
794 CPPUNIT_ASSERT_MESSAGE(
"No segmentations should be stored", allSegmentations.size() == 0);
797 CPPUNIT_ASSERT_MESSAGE(
"No control point should be stored", allControlPoints.size() == 0);
800 CPPUNIT_ASSERT_MESSAGE(
"No information type should be stored", allInformationTypes.size() == 0);
803 CPPUNIT_ASSERT_MESSAGE(
"One lesions should be stored", allLesions.size() == 1);
DataNode::Pointer GetPatientTwoSegmentation()
void AddSegmentation(const DataNode *segmentationNode, const DataNode *parentNode)
Add a segmentation instance to the set of already existing segmentations - with no connection to a sp...
void RemoveSegmentation(const DataNode *segmentationNode)
Remove the given segmentation from the set of already existing segmentations.
MITKSEMANTICRELATIONS_EXPORT bool IsLesionPresent(const SemanticTypes::Lesion &lesion, const DataNode *dataNode)
Check if the given lesion is present on the given data node. The function receives the case- and the ...
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::InformationType GetInformationTypeOfImage(const DataNode *imageNode)
Return the information type of the given image. If the image does not contain any information type...
MITK_TEST_SUITE_REGISTRATION(mitkImageToItk)
DataNode::Pointer GetPatientOneCTImage()
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::Lesion GenerateNewLesion(const std::string &lesionClassType="")
Generate a new lesion and lesion class with UIDs and the given string as lesion class type...
DataNode::Pointer GetInvalidCaseID()
CaseID is 0x0010, 0x0010 (PatientName)
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::LesionVector GetAllLesionsOfControlPoint(const SemanticTypes::CaseID &caseID, const SemanticTypes::ControlPoint &controlPoint)
Returns a vector of all lesions that are valid for the given case, given a specific control point...
void ClearRelationStorage()
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ControlPointVector GetAllControlPointsOfLesion(const SemanticTypes::CaseID &caseID, const SemanticTypes::Lesion &lesion)
Return a vector of all control points that are valid for the given case, given a specific lesion...
std::string MITKCORE_EXPORT GeneratePropertyNameForDICOMTag(unsigned int group, unsigned int element)
#define MITK_TEST(TESTMETHOD)
Adds a test to the current test suite.
DataNode::Pointer GetInvalidModality()
Modality is 0x0008, 0x0060(Modality)
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ControlPointVector GetAllControlPointsOfInformationType(const SemanticTypes::CaseID &caseID, const SemanticTypes::InformationType &informationType)
Return a vector of all control points that are valid for the given case, given a specific information...
void UnlinkImageFromControlPoint(const DataNode *imageNode)
Unlink the given image from the linked control point. If an image is unlinked from a control point...
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::LesionVector GetAllLesionsOfImage(const DataNode *imageNode)
Returns a vector of all lesions that are currently available for the current case and are connected t...
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::InformationTypeVector GetAllInformationTypesOfCase(const SemanticTypes::CaseID &caseID)
MITKSEMANTICRELATIONS_EXPORT bool IsRepresentingALesion(const DataNode *segmentationNode)
Check if the given segmentation refers to an existing lesion instance. This function can be used befo...
DataNode::Pointer GetInvalidID()
ID is 0x0020, 0x000e (SeriesInstanceUID)
DataNode::Pointer GetPatientThreeMRImage()
void SetInformationType(const DataNode *imageNode, const SemanticTypes::InformationType &informationType)
Set (and possibly overwrite) the information type of the given image. An already associated informati...
The API provides functions to manipulate image relations and instances that are helpful during follow...
DataNode::Pointer GetPatientOneMRImage()
boost::gregorian::date date
MITKSEMANTICRELATIONS_EXPORT bool SpecificImageExists(const SemanticTypes::CaseID &caseID, const SemanticTypes::Lesion &lesion, const SemanticTypes::InformationType &informationType)
Determine if the given information type contains images, which are connected to segmentations that re...
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ControlPoint GetControlPointOfImage(const DataNode *dataNode)
Return the control point of a data node. If the data node is not linked to a control point or the dat...
MITKSEMANTICRELATIONS_EXPORT bool IsLesionPresentOnImage(const SemanticTypes::CaseID &caseID, const SemanticTypes::Lesion &lesion, const SemanticTypes::ID &imageID)
Check if the given lesion is related to the image identified by the given image ID. Each lesion is represented by a segmentation which is connected to its parent image.
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::CaseID GetCaseIDFromDataNode(const mitk::DataNode *dataNode)
void RemoveImage(const DataNode *imageNode)
Remove the given image from the set of already existing images.
void RemoveLesion(const SemanticTypes::CaseID &caseID, const SemanticTypes::Lesion &lesion)
Remove the given lesion from the set of already existing lesions.
mitk::DataStorage::Pointer m_DataStorage
DataNode::Pointer GetInvalidDate()
Date is 0x0008, 0x0022 (AcquisitionDate)
DataNode::Pointer GetPatientTwoPETImage()
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::IDVector GetAllImageIDsOfInformationType(const SemanticTypes::CaseID &caseID, const SemanticTypes::InformationType &informationType)
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ID GetIDFromDataNode(const mitk::DataNode *dataNode)
Test fixture for parameterized tests.
DataNode::Pointer GetPatientThreeCTImage()
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ControlPoint GenerateControlPoint(const mitk::DataNode *datanode)
Provides helper functions that are needed to work with control points.
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::LesionVector GetAllLesionsOfCase(const SemanticTypes::CaseID &caseID)
mitk::Image::Pointer image
void UnlinkSegmentationFromLesion(const DataNode *segmentationNode)
Unlink the given segmentation instance from the linked lesion instance. The lesion may stay unlinked ...
void AddImage(const DataNode *imageNode)
Add the given image to the set of already existing images. The date is extracted from the DICOM data ...
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::IDVector GetAllImageIDsOfControlPoint(const SemanticTypes::CaseID &caseID, const SemanticTypes::ControlPoint &controlPoint)
MITKSEMANTICRELATIONS_EXPORT bool IsLesionPresentOnSegmentation(const SemanticTypes::CaseID &caseID, const SemanticTypes::Lesion &lesion, const SemanticTypes::ID &segmentationID)
Check if the given lesion is present on the segmentation identified by the given segmentation ID...
DataNode::Pointer GetPatientThreeMRSegmentation()
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ExaminationPeriodVector GetAllExaminationPeriodsOfCase(const SemanticTypes::CaseID &caseID)
MITKSEMANTICRELATIONS_EXPORT std::vector< SemanticTypes::CaseID > GetAllCaseIDs()
void AddLesionAndLinkSegmentation(const DataNode *segmentationNode, const SemanticTypes::Lesion &lesion)
Add a newly created lesion to the set of already existing lesions. The lesion is added and a referenc...
The API provides functions to query and manipulate image relations and instances, that are helpful du...
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::IDVector GetAllImageIDsOfCase(const SemanticTypes::CaseID &caseID)
void SetControlPointOfImage(const DataNode *imageNode, const SemanticTypes::ControlPoint &controlPoint)
Set the control point for the given image.
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::InformationTypeVector GetAllInformationTypesOfControlPoint(const SemanticTypes::CaseID &caseID, const SemanticTypes::ControlPoint &controlPoint)
Return a vector of all information types that are valid for the given case, given a specific control ...
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::Lesion GetLesionOfSegmentation(const DataNode *segmentationNode)
Return the lesion that is defined by the given segmentation.
DataNode::Pointer GetPatientThreeCTSegmentation()
MITKSEMANTICRELATIONS_EXPORT bool IsLesionPresentAtControlPoint(const SemanticTypes::CaseID &caseID, const SemanticTypes::Lesion &lesion, const SemanticTypes::ControlPoint &controlPoint)
Check if the given lesion is present at the given control point.
void LinkSegmentationToLesion(const DataNode *segmentationNode, const SemanticTypes::Lesion &lesion)
Link the given segmentation instance to an an already existing lesion instance. If the segmentation i...
DataNode::Pointer GetPatientOneOtherCTImage()
MITKSEMANTICRELATIONS_EXPORT std::string GenerateUID()
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ControlPointVector GetAllControlPointsOfCase(const SemanticTypes::CaseID &caseID)
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::IDVector GetAllImageIDsOfLesion(const SemanticTypes::CaseID &caseID, const SemanticTypes::Lesion &lesion)
Return a vector of all image IDs that identify images that are related to the given lesion...
MITKSEMANTICRELATIONS_EXPORT bool InstanceExists(const DataNode *dataNode)
Check if the given data node exists in the relation storage. The function receives the case- and the ...