31 for (
const auto& lesion : allLesionsOfCase)
33 allLesionClassesOfCase.push_back(lesion.lesionClass);
39 return lesionClassLeft.
UID < lesionClassRight.UID;
44 return lesionClassLeft.
UID == lesionClassRight.UID;
47 std::sort(allLesionClassesOfCase.begin(), allLesionClassesOfCase.end(), lessThan);
48 allLesionClassesOfCase.erase(std::unique(allLesionClassesOfCase.begin(), allLesionClassesOfCase.end(), equal), allLesionClassesOfCase.end());
50 return allLesionClassesOfCase;
55 if (
nullptr == segmentationNode)
69 mitkReThrow(e) <<
"Cannot get the lesion of the given segmentation data node.";
77 if (
nullptr == imageNode)
91 mitkReThrow(e) <<
"Cannot get all lesions of the given image data node.";
99 for (
const auto& segmentationID : allSegmentationIDsOfImage)
103 if (!representedLesion.
UID.empty())
105 allLesionsOfImage.push_back(representedLesion);
112 return lesionLeft.
UID < lesionRight.UID;
117 return lesionLeft.
UID == lesionRight.UID;
120 std::sort(allLesionsOfImage.begin(), allLesionsOfImage.end(), lessThan);
121 allLesionsOfImage.erase(std::unique(allLesionsOfImage.begin(), allLesionsOfImage.end(), equal), allLesionsOfImage.end());
123 return allLesionsOfImage;
136 allLesions.erase(std::remove_if(allLesions.begin(), allLesions.end(), lambda), allLesions.end());
151 allLesions.erase(std::remove_if(allLesions.begin(), allLesions.end(), lambda), allLesions.end());
164 return lesionLeft.
UID < lesionRight.UID;
169 return lesionLeft.
UID == lesionRight.UID;
172 std::sort(allLesionsOfControlPoint.begin(), allLesionsOfControlPoint.end(), lessThan);
173 std::sort(allLesionsOfInformationType.begin(), allLesionsOfInformationType.end(), lessThan);
176 std::set_intersection(allLesionsOfControlPoint.begin(), allLesionsOfControlPoint.end(),
177 allLesionsOfInformationType.begin(), allLesionsOfInformationType.end(),
178 std::back_inserter(allLesionsIntersection), equal);
180 return allLesionsIntersection;
195 return !representedLesion.
UID.empty();
201 return !representedLesion.
UID.empty();
240 mitkReThrow(e) <<
"Cannot get all image IDs of the given lesion to determine the lesion presence.";
243 for (
const auto& imageIDOfLesion : allImageIDsOfLesion)
245 if (imageIDOfLesion == imageID)
257 return lesion.
UID == representedLesion.UID;
269 mitkReThrow(e) <<
"Cannot get all image IDs of the given lesion to determine the lesion presence.";
272 for (
const auto& imageIDOfLesion : allImageIDsOfLesion)
275 if (imageControlPoint.date == controlPoint.
date)
301 return std::find(allImageIDsOfCase.begin(), allImageIDsOfCase.end(), dataNodeID) != allImageIDsOfCase.end();
307 return std::find(allSegmentationIDsOfCase.begin(), allSegmentationIDsOfCase.end(), dataNodeID) != allSegmentationIDsOfCase.end();
320 return currentLesion.UID == lesion.
UID;
323 const auto existingLesion = std::find_if(allLesions.begin(), allLesions.end(), lambda);
325 return existingLesion != allLesions.end();
340 for (
const auto& segmentationID : allSegmentationIDsOfLesion)
346 allImageIDsOfLesion.push_back(imageID);
350 std::sort(allImageIDsOfLesion.begin(), allImageIDsOfLesion.end());
351 allImageIDsOfLesion.erase(std::unique(allImageIDsOfLesion.begin(), allImageIDsOfLesion.end()), allImageIDsOfLesion.end());
353 return allImageIDsOfLesion;
371 allImageIDsOfExaminationPeriod.insert(allImageIDsOfExaminationPeriod.end(), allImageIDsOfControlPoint.begin(), allImageIDsOfControlPoint.end());
374 return allImageIDsOfExaminationPeriod;
379 if (
nullptr == imageNode)
393 mitkReThrow(e) <<
"Cannot get the control point of the given image data node.";
409 allControlPoints.erase(std::remove_if(allControlPoints.begin(), allControlPoints.end(), lambda), allControlPoints.end());
411 return allControlPoints;
424 allControlPoints.erase(std::remove_if(allControlPoints.begin(), allControlPoints.end(), lambda), allControlPoints.end());
426 return allControlPoints;
435 const auto existingControlPoint = std::find_if(allControlPoints.begin(), allControlPoints.end(), lambda);
437 if (existingControlPoint != allControlPoints.end())
453 const auto existingExaminationPeriod = std::find_if(allExaminationPeriods.begin(), allExaminationPeriods.end(), lambda);
455 if (existingExaminationPeriod != allExaminationPeriods.end())
467 if (
nullptr == imageNode)
481 mitkReThrow(e) <<
"Cannot get the information type of the given image data node.";
497 allInformationTypes.erase(std::remove_if(allInformationTypes.begin(), allInformationTypes.end(), lambda), allInformationTypes.end());
499 return allInformationTypes;
507 auto lambda = [&informationType](
const SemanticTypes::InformationType& currentInformationType) {
return currentInformationType == informationType; };
508 const auto existingInformationType = std::find_if(allInformationTypes.begin(), allInformationTypes.end(), lambda);
510 if (existingInformationType != allInformationTypes.end())
534 std::sort(allImageIDsOfLesion.begin(), allImageIDsOfLesion.end());
535 std::sort(allImageIDsOfInformationType.begin(), allImageIDsOfInformationType.end());
538 std::set_intersection(allImageIDsOfLesion.begin(), allImageIDsOfLesion.end(),
539 allImageIDsOfInformationType.begin(), allImageIDsOfInformationType.end(),
540 std::back_inserter(allImageIDsIntersection));
543 return !allImageIDsIntersection.empty();
560 std::sort(allImageIDsOfLesion.begin(), allImageIDsOfLesion.end());
561 std::sort(allImageIDsOfControlPoint.begin(), allImageIDsOfControlPoint.end());
564 std::set_intersection(allImageIDsOfLesion.begin(), allImageIDsOfLesion.end(),
565 allImageIDsOfControlPoint.begin(), allImageIDsOfControlPoint.end(),
566 std::back_inserter(allImageIDsIntersection));
569 return !allImageIDsIntersection.empty();
577 std::sort(allImageIDsOfInformationType.begin(), allImageIDsOfInformationType.end());
578 std::sort(allImageIDsOfControlPoint.begin(), allImageIDsOfControlPoint.end());
581 std::set_intersection(allImageIDsOfInformationType.begin(), allImageIDsOfInformationType.end(),
582 allImageIDsOfControlPoint.begin(), allImageIDsOfControlPoint.end(),
583 std::back_inserter(allImageIDsIntersection));
586 return !allImageIDsIntersection.empty();
SemanticTypes::InformationType GetInformationTypeOfImage(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &imageID)
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...
std::vector< ID > IDVector
std::vector< ID > controlPointUIDs
std::vector< LesionClass > LesionClassVector
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::LesionClassVector GetAllLesionClassesOfCase(const SemanticTypes::CaseID &caseID)
Return a vector of lesion classes that are currently available for the given case.
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...
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::LesionVector GetAllLesionsOfInformationType(const SemanticTypes::CaseID &caseID, const SemanticTypes::InformationType &informationType)
Returns a vector of all lesions that are valid for the given case, given a specific information type...
MITKSEMANTICRELATIONS_EXPORT NodePredicateAnd::Pointer GetImagePredicate()
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...
MITKSEMANTICRELATIONS_EXPORT bool InstanceExists(const SemanticTypes::CaseID &caseID)
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...
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)
#define mitkReThrow(mitkexception)
MITKSEMANTICRELATIONS_EXPORT bool IsRepresentingALesion(const DataNode *segmentationNode)
Check if the given segmentation refers to an existing lesion instance. This function can be used befo...
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::IDVector GetAllSegmentationIDsOfImage(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &imageID)
std::vector< Lesion > LesionVector
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.
SemanticTypes::ControlPoint GetControlPointOfImage(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &imageID)
MITKSEMANTICRELATIONS_EXPORT NodePredicateAnd::Pointer GetSegmentationPredicate()
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::CaseID GetCaseIDFromDataNode(const mitk::DataNode *dataNode)
std::vector< ControlPoint > ControlPointVector
SemanticTypes::Lesion GetLesionOfSegmentation(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &segmentationID)
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::IDVector GetAllImageIDsOfExaminationPeriod(const SemanticTypes::CaseID &caseID, const SemanticTypes::ExaminationPeriod &examinationPeriod)
Return a vector of all image IDs that identify images that are related to the given examination perio...
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::ID GetIDFromDataNode(const mitk::DataNode *dataNode)
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::LesionVector GetAllSpecificLesions(const SemanticTypes::CaseID &caseID, const SemanticTypes::ControlPoint &controlPoint, const SemanticTypes::InformationType &informationType)
Returns a vector of all lesions that are valid for the given case, given a specific control point and...
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::LesionVector GetAllLesionsOfCase(const SemanticTypes::CaseID &caseID)
#define mitkThrowException(classname)
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...
std::string InformationType
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ExaminationPeriodVector GetAllExaminationPeriodsOfCase(const SemanticTypes::CaseID &caseID)
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::IDVector GetAllSegmentationIDsOfCase(const SemanticTypes::CaseID &caseID)
std::vector< InformationType > InformationTypeVector
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::IDVector GetAllImageIDsOfCase(const SemanticTypes::CaseID &caseID)
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.
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.
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ControlPoint GetControlPointByUID(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &controlPointUID)
Find and return a whole control point including its date given a specific control point UID...
std::vector< ExaminationPeriod > ExaminationPeriodVector
SemanticTypes::ID GetImageIDOfSegmentation(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &segmentationID)
Class for nodes of the DataTree.
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 ...