comparison OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp @ 5318:68e15471b408

added ParsedDicomFile::InjectEmptyPixelData()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 23 Jun 2023 18:01:55 +0200
parents 0ea402b4d901
children f2e1ad71e49c
comparison
equal deleted inserted replaced
5317:9875e1f24394 5318:68e15471b408
2119 2119
2120 return result.release(); 2120 return result.release();
2121 } 2121 }
2122 } 2122 }
2123 2123
2124
2125 void ParsedDicomFile::InjectEmptyPixelData(ValueRepresentation vr)
2126 {
2127 DcmTag k(DICOM_TAG_PIXEL_DATA.GetGroup(),
2128 DICOM_TAG_PIXEL_DATA.GetElement());
2129
2130 DcmItem& dataset = *GetDcmtkObjectConst().getDataset();
2131
2132 DcmElement *element = NULL;
2133 if (!dataset.findAndGetElement(k, element).good() ||
2134 element == NULL)
2135 {
2136 // The pixel data is indeed nonexistent, insert it now
2137 switch (vr)
2138 {
2139 case ValueRepresentation_OtherByte:
2140 if (!dataset.putAndInsertUint8Array(k, NULL, 0).good())
2141 {
2142 throw OrthancException(ErrorCode_InternalError);
2143 }
2144 break;
2145
2146 case ValueRepresentation_OtherWord:
2147 if (!dataset.putAndInsertUint16Array(k, NULL, 0).good())
2148 {
2149 throw OrthancException(ErrorCode_InternalError);
2150 }
2151 break;
2152
2153 default:
2154 throw OrthancException(ErrorCode_ParameterOutOfRange);
2155 }
2156 }
2157 }
2158
2124 2159
2125 #if ORTHANC_BUILDING_FRAMEWORK_LIBRARY == 1 2160 #if ORTHANC_BUILDING_FRAMEWORK_LIBRARY == 1
2126 // Alias for binary compatibility with Orthanc Framework 1.7.2 => don't use it anymore 2161 // Alias for binary compatibility with Orthanc Framework 1.7.2 => don't use it anymore
2127 void ParsedDicomFile::DatasetToJson(Json::Value& target, 2162 void ParsedDicomFile::DatasetToJson(Json::Value& target,
2128 DicomToJsonFormat format, 2163 DicomToJsonFormat format,