diff --git a/Modules/CaPTkInteractiveSegmentation/src/CaPTkInteractiveSegmentation.cpp b/Modules/CaPTkInteractiveSegmentation/src/CaPTkInteractiveSegmentation.cpp index ec39aee..be59c58 100644 --- a/Modules/CaPTkInteractiveSegmentation/src/CaPTkInteractiveSegmentation.cpp +++ b/Modules/CaPTkInteractiveSegmentation/src/CaPTkInteractiveSegmentation.cpp @@ -361,9 +361,12 @@ CaPTkInteractiveSegmentation::RunThread(std::vector &image if (result->ok) { - mitk::Image::Pointer segmNormal; + mitk::Image::Pointer segmNormal = mitk::Image::New(); mitk::CastToMitkImage(result->labelsImage, segmNormal); segm->InitializeByLabeledImage(segmNormal); + segm->CopyInformation(seeds); // This copies metadata to the output segmentation + // It is particularly useful, because it allows + // to save the segmentation as dicom if input is dicom runResult.segmentation = segm; } @@ -449,7 +452,7 @@ CaPTkInteractiveSegmentation::RunThread(std::vector &image if (result->ok) { - mitk::Image::Pointer segmNormal; + mitk::Image::Pointer segmNormal = mitk::Image::New(); // Convert to 3D mitk::CastToMitkImage(result->labelsImage, segmNormal); @@ -460,6 +463,9 @@ CaPTkInteractiveSegmentation::RunThread(std::vector &image segmNormal = filter->GetOutput(); segm->InitializeByLabeledImage(segmNormal); + segm->CopyInformation(seeds); // This copies metadata to the output segmentation + // It is particularly useful, because it allows + // to save the segmentation as dicom if input is dicom runResult.segmentation = segm; } @@ -572,4 +578,4 @@ bool CaPTkInteractiveSegmentation::IsNumber(const std::string &s) { return !s.empty() && std::find_if(s.begin(), s.end(), [](char c) { return !std::isdigit(c); }) == s.end(); -} \ No newline at end of file +}