# HG changeset patch # User amazy # Date 1539603900 -7200 # Node ID f3c1eda54e47d0aaf9ba27a07b57ae6c97918621 # Parent 61a5667f37d9cdf4ed4d5aac6077d1369c2bae2f Allow creation of MONOCHROME1 greyscale images in tools/create-dicom diff -r 61a5667f37d9 -r f3c1eda54e47 Core/DicomParsing/ParsedDicomFile.cpp --- a/Core/DicomParsing/ParsedDicomFile.cpp Sat Oct 13 12:17:16 2018 +0200 +++ b/Core/DicomParsing/ParsedDicomFile.cpp Mon Oct 15 13:45:00 2018 +0200 @@ -1174,7 +1174,7 @@ } ReplacePlainString(DICOM_TAG_PLANAR_CONFIGURATION, "0"); // Color channels are interleaved - ReplacePlainString(DICOM_TAG_PHOTOMETRIC_INTERPRETATION, "MONOCHROME2"); + SetIfAbsent(DICOM_TAG_PHOTOMETRIC_INTERPRETATION, "MONOCHROME2"); // by default, greyscale images are in MONOCHROME2 unsigned int bytesPerPixel = 0; diff -r 61a5667f37d9 -r f3c1eda54e47 Core/DicomParsing/ParsedDicomFile.h --- a/Core/DicomParsing/ParsedDicomFile.h Sat Oct 13 12:17:16 2018 +0200 +++ b/Core/DicomParsing/ParsedDicomFile.h Mon Oct 15 13:45:00 2018 +0200 @@ -147,6 +147,16 @@ Replace(tag, utf8Value, false, DicomReplaceMode_InsertIfAbsent); } + void SetIfAbsent(const DicomTag& tag, + const std::string& utf8Value) + { + std::string currentValue; + if (!GetTagValue(currentValue, tag)) + { + ReplacePlainString(tag, utf8Value); + } + } + void RemovePrivateTags() { RemovePrivateTagsInternal(NULL); diff -r 61a5667f37d9 -r f3c1eda54e47 NEWS --- a/NEWS Sat Oct 13 12:17:16 2018 +0200 +++ b/NEWS Mon Oct 15 13:45:00 2018 +0200 @@ -25,7 +25,7 @@ * New modality manufacturer: "GE" for GE Healthcare EA and AW * Executing a query/retrieve from the REST API now creates a job * Fix: Closing DICOM associations after running query/retrieve from REST API - +* Fix: Allow creation of MONOCHROME1 greyscale images in tools/create-dicom Version 1.4.2 (2018-09-20) ==========================