diff --git a/libsrc/ImageSEGConverter.cpp b/libsrc/ImageSEGConverter.cpp index 5e4005a2..3f8e8bcb 100644 --- a/libsrc/ImageSEGConverter.cpp +++ b/libsrc/ImageSEGConverter.cpp @@ -563,7 +563,7 @@ namespace dcmqi { // ImagePositionPatient, set non-zero pixels to the segment number. Notify // about pixels that are initialized more than once. - DcmIODTypes::Frame *unpackedFrame = NULL; + const DcmIODTypes::Frame *unpackedFrame = NULL; JSONSegmentationMetaInformationHandler metaInfo; @@ -735,12 +735,15 @@ namespace dcmqi { unsigned slice = frameOriginIndex[2]; + bool deleteFrame(true); if(segdoc->getSegmentationType() == DcmSegTypes::ST_BINARY) unpackedFrame = DcmSegUtils::unpackBinaryFrame(frame, imageSize[1], // Rows imageSize[0]); // Cols - else - unpackedFrame = new DcmIODTypes::Frame(*frame); + else { + unpackedFrame = frame; + deleteFrame = false; + } // initialize slice with the frame content for(unsigned row=0;row