comparison Core/DicomParsing/DicomDirWriter.cpp @ 2571:a84ce82fd55b

Fix generation of DICOMDIR if PatientID is empty
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 08 May 2018 20:48:49 +0200
parents 8cc3ca64a534
children d386abc18133
comparison
equal deleted inserted replaced
2561:b2f57399b067 2571:a84ce82fd55b
162 DcmItem& source, 162 DcmItem& source,
163 Encoding encoding, 163 Encoding encoding,
164 const DcmTagKey& key) 164 const DcmTagKey& key)
165 { 165 {
166 DcmElement* element = NULL; 166 DcmElement* element = NULL;
167 result.clear();
167 168
168 if (source.findAndGetElement(key, element).good()) 169 if (source.findAndGetElement(key, element).good())
169 { 170 {
170 char* s = NULL; 171 char* s = NULL;
171 if (element->isLeaf() && 172 if (element->isLeaf() &&
172 element->getString(s).good() && 173 element->getString(s).good())
173 s != NULL)
174 { 174 {
175 result = Toolbox::ConvertToUtf8(s, encoding); 175 if (s != NULL)
176 {
177 result = Toolbox::ConvertToUtf8(s, encoding);
178 }
179
176 return true; 180 return true;
177 } 181 }
178 } 182 }
179 183
180 result.clear();
181 return false; 184 return false;
182 } 185 }
183 186
184 187
185 static void SetTagValue(DcmDirectoryRecord& target, 188 static void SetTagValue(DcmDirectoryRecord& target,