diff --git a/Modules/RegistrationOntology/include/mitkSegmentationPropagation.h b/Modules/RegistrationOntology/include/mitkSegmentationPropagation.h index 753f5b81c2..2809473794 100644 --- a/Modules/RegistrationOntology/include/mitkSegmentationPropagation.h +++ b/Modules/RegistrationOntology/include/mitkSegmentationPropagation.h @@ -1,50 +1,57 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITKSEGMENTATIONPROPAGATION_H #define MITKSEGMENTATIONPROPAGATION_H // registration ontology module #include "MitkRegistrationOntologyExports.h" // mitk core #include // matchpoint ontology //#include //#include namespace mitk { /** * @brief * * */ class MITKREGISTRATIONONTOLOGY_EXPORT SegmentationPropagation { public: /** - * @brief + * @brief Propagate a given segmentation mask to the given target image. + * The function creates a new label set image and initializes it with the given segmentation mask. + * DICOM properties are derived from the target image and set for the new segmentation. + * A new series instance UID is created to uniquely identify the new segmentation. + * The new segmentation is set as the data of a new data node which is then returned. * + * @param segmentationMask The base data of the segmentation to propagate + * @param targetImage The data node containing the parent image. + * return The data node containing the new segmentation. */ - DataNode::Pointer PropagateSegmentationMask(BaseData* segmentationMask, DataNode* targetImage); + DataNode::Pointer PropagateSegmentationMask(BaseData* segmentationMask, const DataNode* targetImage); }; } // namespace mitk #endif // MITKSEGMENTATIONPROPAGATION_H diff --git a/Modules/RegistrationOntology/src/mitkSegmentationPropagation.cpp b/Modules/RegistrationOntology/src/mitkSegmentationPropagation.cpp index 1a144b30cc..159b8d2afb 100644 --- a/Modules/RegistrationOntology/src/mitkSegmentationPropagation.cpp +++ b/Modules/RegistrationOntology/src/mitkSegmentationPropagation.cpp @@ -1,69 +1,69 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkSegmentationPropagation.h" // mitk core #include #include // DICOMQI module #include // multilabel module #include -mitk::DataNode::Pointer mitk::SegmentationPropagation::PropagateSegmentationMask(BaseData* segmentationMask, DataNode* targetImage) +mitk::DataNode::Pointer mitk::SegmentationPropagation::PropagateSegmentationMask(BaseData* segmentationMask, const DataNode* targetImage) { if (nullptr == targetImage) { return nullptr; } BaseData* targetImageData = targetImage->GetData(); if (nullptr == targetImageData) { return nullptr; } Image::Pointer segmentation = dynamic_cast(segmentationMask); if (nullptr == segmentation) { return nullptr; } // clone the segmentation image / the base data //auto labelSetImage = segmentation->Clone(); // create new empty segmentation auto labelSetImage = LabelSetImage::New(); // copy image data (e.g. pixel information) labelSetImage->InitializeByLabeledImage(segmentation); // copy DICOM information from the target image to the new segmentation DICOMQIPropertyHandler::DeriveDICOMSourceProperties(targetImageData, labelSetImage); // DICOM tag is "SeriesInstanceUID" - needs to be removed to define a new tag with UID std::string nodeIDPropertyKey = GeneratePropertyNameForDICOMTag(0x0020, 0x000e); labelSetImage->RemoveProperty(nodeIDPropertyKey); auto newSegmentationNode = DataNode::New(); newSegmentationNode->SetData(labelSetImage); newSegmentationNode->SetProperty("name", StringProperty::New("PropagatedLesion")); newSegmentationNode->SetProperty("binary", BoolProperty::New(true)); return newSegmentationNode; }