Skip to content

Commit

Permalink
only copy the correct segmented pixels
Browse files Browse the repository at this point in the history
  • Loading branch information
spalte committed Jan 31, 2024
1 parent 7507a76 commit d30215c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libsrc/Dicom2ItkConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ itk::SmartPointer<ShortImageType> 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++)
Expand All @@ -220,7 +221,7 @@ itk::SmartPointer<ShortImageType> 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;
Expand Down

0 comments on commit d30215c

Please sign in to comment.