From 645557908f713320feaa8e8d463027bd8375f2dd Mon Sep 17 00:00:00 2001 From: kradchen Date: Fri, 13 Jun 2025 14:27:46 +0800 Subject: [PATCH] fix: fix a thumbnail render bug --- src/src/IO/DICOM/DICOMPixelDataHelper.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/src/IO/DICOM/DICOMPixelDataHelper.cpp b/src/src/IO/DICOM/DICOMPixelDataHelper.cpp index 631d011..c3c233e 100644 --- a/src/src/IO/DICOM/DICOMPixelDataHelper.cpp +++ b/src/src/IO/DICOM/DICOMPixelDataHelper.cpp @@ -37,6 +37,7 @@ void DICOMPixelDataHelper::FinalizeCodecs() { void DICOMPixelDataHelper::GetThumbnailData(ExtendMedicalImageProperties *property, void*& data, unsigned long& length, int & sample) { + double *wlww = property->GetNthWindowLevelPreset(0); int ww = wlww ? ((int) wlww[0]) : (512); int wl = wlww ? ((int) wlww[1]) : (256); @@ -46,9 +47,8 @@ void DICOMPixelDataHelper::GetThumbnailData(ExtendMedicalImageProperties *proper DcmDataset *dset = fileFormat.getDataset(); DicomImage dcmImage(&fileFormat, dset->getOriginalXfer(), CIF_MayDetachPixelData); dcmImage.setWindow(wl, ww); - length = dcmImage.getOutputDataSize(8); - data = new unsigned char[length]; - dcmImage.getOutputData(data, length, 8);//按8位的位宽取数据 + length = dcmImage.getWidth() * dcmImage.getHeight(); + dcmImage.createWindowsDIB(data, length, 0, 8); } }