From d679c2c4c3546cdd8880f498f88ced49d340e5d2 Mon Sep 17 00:00:00 2001 From: Michael Onken Date: Mon, 18 Dec 2023 20:46:12 +0100 Subject: [PATCH] Fix order of pixel spacing converting ITK->DICOM. The order in which the values for pixel spacing in ITK and DICOM are stored is different. In DICOM the first value is the row spacing (i.e. Y axis) while in ITK the first value is spacing along the X axis. Reading asymmetric spacings from DICOM segmentations has already been fixed in 46c6f0. This commit fixes writing DICOM segmentation objects with asymmetric spacings. --- libsrc/Itk2DicomConverter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/Itk2DicomConverter.cpp b/libsrc/Itk2DicomConverter.cpp index 6b011050..713a29dc 100644 --- a/libsrc/Itk2DicomConverter.cpp +++ b/libsrc/Itk2DicomConverter.cpp @@ -88,7 +88,7 @@ namespace dcmqi { ShortImageType::SpacingType labelSpacing = segmentations[0]->GetSpacing(); ostringstream spacingSStream; - spacingSStream << scientific << labelSpacing[0] << "\\" << labelSpacing[1]; + spacingSStream << scientific << labelSpacing[1] << "\\" << labelSpacing[0]; CHECK_COND(pixmsr->setPixelSpacing(spacingSStream.str().c_str())); spacingSStream.clear(); spacingSStream.str("");