31 std::vector<mitk::ISemanticRelationsObserver*> mitk::SemanticRelationsIntegration::m_ObserverVector;
35 std::vector<ISemanticRelationsObserver*>::iterator existingObserver = std::find(m_ObserverVector.begin(), m_ObserverVector.end(), observer);
36 if (existingObserver != m_ObserverVector.end())
42 m_ObserverVector.push_back(observer);
47 m_ObserverVector.erase(std::remove(m_ObserverVector.begin(), m_ObserverVector.end(), observer), m_ObserverVector.end());
56 if (
nullptr == imageNode)
75 mitkReThrow(e) <<
"Cannot add the given image data node.";
88 mitkReThrow(e) <<
"Cannot add the given image data node.";
94 if (
nullptr == imageNode)
108 mitkReThrow(e) <<
"Cannot remove the given image data node.";
118 mitkReThrow(e) <<
"Cannot remove the given image data node.";
122 NotifyObserver(caseID);
133 NotifyObserver(caseID);
141 NotifyObserver(caseID);
151 if (
nullptr == segmentationNode)
165 mitkReThrow(e) <<
"Cannot add given lesion and link the given segmentation data node.";
168 NotifyObserver(caseID);
176 if (allSegmentationIDsOfLesion.empty())
181 NotifyObserver(caseID);
196 if (
nullptr == segmentationNode)
201 if (
nullptr == parentNode)
217 mitkReThrow(e) <<
"Cannot add the given segmentation data node.";
221 NotifyObserver(caseID);
226 if (
nullptr == segmentationNode)
240 mitkReThrow(e) <<
"Cannot link the given segmentation data node to the given lesion.";
246 NotifyObserver(caseID);
256 if (
nullptr == segmentationNode)
270 mitkReThrow(e) <<
"Cannot unlink the given segmentation data node from its lesion.";
274 NotifyObserver(caseID);
279 if (
nullptr == segmentationNode)
293 mitkReThrow(e) <<
"Cannot remove the given segmentation data node.";
302 mitkReThrow(e) <<
"Cannot remove the given segmentation data node.";
306 NotifyObserver(caseID);
311 if (
nullptr == imageNode)
323 mitkReThrow(e) <<
"Cannot set the given control point for the given image data node.";
331 if (!existingControlPoint.
UID.empty())
341 if (examinationPeriod.
UID.empty())
346 examinationPeriod.
name =
"New examination period";
358 mitkReThrow(e) <<
"Cannot set the given control point for the given image data node.";
361 ClearControlPoints(caseID);
362 NotifyObserver(caseID);
367 if (
nullptr == imageNode)
379 mitkReThrow(e) <<
"Cannot add the given control point and link the given image data node.";
395 mitkReThrow(e) <<
"Cannot add the given control point and link the given image data node.";
401 if (
nullptr == imageNode)
415 mitkReThrow(e) <<
"Cannot link the image data node to the given control point.";
430 if (
nullptr == imageNode)
444 mitkReThrow(e) <<
"Cannot unlink the given image data node from its control point.";
448 ClearControlPoints(caseID);
468 NotifyObserver(caseID);
503 mitkReThrow(e) <<
"Cannot set the given information type for the given image data node.";
506 NotifyObserver(caseID);
511 if (
nullptr == imageNode)
525 mitkReThrow(e) <<
"Cannot add the given information type to the given image data node.";
533 if (
nullptr == imageNode)
547 mitkReThrow(e) <<
"Cannot remove the information type from the given image data node.";
555 for (
const auto& otherImageID : allImageIDsVectorValue)
558 if (otherInformationType == originalInformationType)
574 for (
auto& observer : m_ObserverVector)
576 observer->Update(caseID);
586 for (
const auto& imageID : allImageIDsVectorValue)
589 referencedControlPoints.push_back(controlPointOfImage);
592 std::sort(allControlPointsOfCase.begin(), allControlPointsOfCase.end());
593 std::sort(referencedControlPoints.begin(), referencedControlPoints.end());
596 std::set_difference(allControlPointsOfCase.begin(), allControlPointsOfCase.end(),
597 referencedControlPoints.begin(), referencedControlPoints.end(),
598 std::inserter(nonReferencedControlPoints, nonReferencedControlPoints.begin()));
600 for (
const auto& controlPoint : nonReferencedControlPoints)
void AddExaminationPeriod(const SemanticTypes::CaseID &caseID, const SemanticTypes::ExaminationPeriod &examinationPeriod)
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 AddInformationTypeToImage(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &imageID, const SemanticTypes::InformationType &informationType)
void RemoveSegmentation(const DataNode *segmentationNode)
Remove the given segmentation from the set of already existing segmentations.
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
void RemoveControlPoint(const SemanticTypes::CaseID &caseID, const SemanticTypes::ControlPoint &controlPoint)
void UnlinkSegmentationFromLesion(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &segmentationID)
void OverwriteLesion(const SemanticTypes::CaseID &caseID, const SemanticTypes::Lesion &lesion)
Overwrite an already existing lesion instance (this may be useful to overwrite the lesion with a diff...
void AddExaminationPeriod(const SemanticTypes::CaseID &caseID, const SemanticTypes::ExaminationPeriod &examinationPeriod)
Add an examination period instance to the set of already existing examination periods - with no conne...
void UnlinkImageFromControlPoint(const DataNode *imageNode)
Unlink the given image from the linked control point. If an image is unlinked from a control point...
#define mitkReThrow(mitkexception)
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ControlPoint FindExistingControlPoint(const SemanticTypes::CaseID &caseID, const SemanticTypes::ControlPoint &controlPoint)
Returns an already existing control point from the given vector of control points. This existing control point has the the same date (year, month, day) as the given single control point. If no existing control point can be found an empty control point is returned.
void SetInformationType(const DataNode *imageNode, const SemanticTypes::InformationType &informationType)
Set (and possibly overwrite) the information type of the given image. An already associated informati...
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)
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.
std::vector< ControlPoint > ControlPointVector
void RemoveLesion(const SemanticTypes::CaseID &caseID, const SemanticTypes::Lesion &lesion)
Remove the given lesion from the set of already existing lesions.
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ControlPoint FindClosestControlPoint(const SemanticTypes::CaseID &caseID, const SemanticTypes::ControlPoint &controlPoint)
Returns an already existing close control point from the given vector of control points. This closest control point has a date that is within a certain distance-in-days to the given control point. If no closest control point can be found within the distance threshold an empty control point is returned.
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::ID GetIDFromDataNode(const mitk::DataNode *dataNode)
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ControlPoint GenerateControlPoint(const mitk::DataNode *datanode)
Provides helper functions that are needed to work with control points.
void UnlinkImageFromControlPoint(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &imageID)
void UnlinkSegmentationFromLesion(const DataNode *segmentationNode)
Unlink the given segmentation instance from the linked lesion instance. The lesion may stay unlinked ...
void OverwriteLesion(const SemanticTypes::CaseID &caseID, const SemanticTypes::Lesion &lesion)
void AddImage(const DataNode *imageNode)
Add the given image to the set of already existing images. The date is extracted from the DICOM data ...
void RemoveInformationTypeFromImage(const DataNode *imageNode)
Remove the information type of the given image. If the information type is removed, the function needs to check whether the information type is referenced by any other image:
void RemoveLesion(const SemanticTypes::CaseID &caseID, const SemanticTypes::Lesion &lesion)
#define mitkThrowException(classname)
void RenameExaminationPeriod(const SemanticTypes::CaseID &caseID, const SemanticTypes::ExaminationPeriod &examinationPeriod)
Rename an already existing examination period instance.
void RemoveInformationTypeFromImage(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &imageID)
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ExaminationPeriod FindContainingExaminationPeriod(const SemanticTypes::CaseID &caseID, const SemanticTypes::ControlPoint &controlPoint)
Returns the examination period to which the given control point belongs. Each examination point holds...
std::string InformationType
void AddInformationTypeToImage(const DataNode *imageNode, const SemanticTypes::InformationType &informationType)
Set the information type of the given image.
void RemoveObserver(ISemanticRelationsObserver *observer) override
Removes the given concrete observer from the vector that holds all currently registered observer...
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::InformationType GetDICOMModalityFromDataNode(const mitk::DataNode *dataNode)
Extracts a specific DICOM tag from the node's base data and returns the tag as a information type (a ...
void AddObserver(ISemanticRelationsObserver *observer) override
Adds the given concrete observer to the vector that holds all currently registered observer...
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...
void AddControlPointAndLinkImage(const DataNode *imageNode, const SemanticTypes::ControlPoint &controlPoint, bool checkConsistence=true)
Add a newly created control point to the set of already existing control points. A reference to the c...
void AddControlPointToExaminationPeriod(const SemanticTypes::CaseID &caseID, const SemanticTypes::ControlPoint &controlPoint, const SemanticTypes::ExaminationPeriod &examinationPeriod)
Add a control point to the vector of control point UIDs of an existing examination period...
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.
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)
Add a newly created lesion to the set of already existing lesions - with no connection to a specific ...
void AddLesion(const SemanticTypes::CaseID &caseID, const SemanticTypes::Lesion &lesion)
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...
void AddSegmentation(const SemanticTypes::CaseID &caseID, const SemanticTypes::ID &segmentationID, const SemanticTypes::ID &parentID)
void LinkImageToControlPoint(const DataNode *imageNode, const SemanticTypes::ControlPoint &controlPoint, bool checkConsistence=true)
Link the given image to an already existing control point.
MITKSEMANTICRELATIONS_EXPORT std::string GenerateUID()
Class for nodes of the DataTree.
void RemoveInformationType(const SemanticTypes::CaseID &caseID, const SemanticTypes::InformationType &informationType)
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ControlPointVector GetAllControlPointsOfCase(const SemanticTypes::CaseID &caseID)
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 ...
void AddCase(const SemanticTypes::CaseID &caseID)