comparison Core/DicomFormat/DicomMap.cpp @ 562:f64e3838d6e1 find-move-scp

refactoring enumerations
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 18 Sep 2013 16:49:48 +0200
parents aa50783f9550
children c2be0a0e049e
comparison
equal deleted inserted replaced
559:e0cfb413c86b 562:f64e3838d6e1
278 if (source.HasTag(tag)) 278 if (source.HasTag(tag))
279 { 279 {
280 SetValue(tag, source.GetValue(tag)); 280 SetValue(tag, source.GetValue(tag));
281 } 281 }
282 } 282 }
283
284
285 bool DicomMap::IsMainDicomTag(const DicomTag& tag, ResourceType level)
286 {
287 DicomTag *tags = NULL;
288 size_t size;
289
290 switch (level)
291 {
292 case ResourceType_Patient:
293 tags = patientTags;
294 size = sizeof(patientTags) / sizeof(DicomTag);
295 break;
296
297 case ResourceType_Study:
298 tags = studyTags;
299 size = sizeof(studyTags) / sizeof(DicomTag);
300 break;
301
302 case ResourceType_Series:
303 tags = seriesTags;
304 size = sizeof(seriesTags) / sizeof(DicomTag);
305 break;
306
307 case ResourceType_Instance:
308 tags = instanceTags;
309 size = sizeof(instanceTags) / sizeof(DicomTag);
310 break;
311
312 default:
313 throw OrthancException(ErrorCode_ParameterOutOfRange);
314 }
315
316 for (size_t i = 0; i < size; i++)
317 {
318 if (tags[i] == tag)
319 {
320 return true;
321 }
322 }
323
324 return false;
325 }
326
327 bool DicomMap::IsMainDicomTag(const DicomTag& tag)
328 {
329 return (IsMainDicomTag(tag, ResourceType_Patient) ||
330 IsMainDicomTag(tag, ResourceType_Study) ||
331 IsMainDicomTag(tag, ResourceType_Series) ||
332 IsMainDicomTag(tag, ResourceType_Instance));
333 }
283 } 334 }