From d30215c4895acb32dfa200b59c5b20ca8f58d753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Spaltenstein?= Date: Wed, 31 Jan 2024 11:14:28 +0000 Subject: [PATCH] only copy the correct segmented pixels --- libsrc/Dicom2ItkConverter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libsrc/Dicom2ItkConverter.cpp b/libsrc/Dicom2ItkConverter.cpp index 16fa8da0..e642e247 100644 --- a/libsrc/Dicom2ItkConverter.cpp +++ b/libsrc/Dicom2ItkConverter.cpp @@ -212,6 +212,7 @@ itk::SmartPointer Dicom2ItkConverter::nextResult() /* WIP */ } + bool labelMapSegmentation = m_segDoc->getSegmentationType() == (DcmSegTypes::E_SegmentationType) 3; // LABELMAP; for (unsigned row = 0; row < m_imageSize[1]; row++) { for (unsigned col = 0; col < m_imageSize[0]; col++) @@ -220,7 +221,7 @@ itk::SmartPointer Dicom2ItkConverter::nextResult() unsigned bitCnt = row * m_imageSize[0] + col; pixel = unpackedFrame->pixData[bitCnt]; ShortImageType::IndexType index; - if (pixel != 0) + if (labelMapSegmentation ? pixel == *segNum : pixel != 0) { index[0] = col; index[1] = row;