Mercurial > hg > orthanc
comparison OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.cpp @ 4734:b51c08bd5c38
added ITagVisitor::Action_Remove
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 05 Jul 2021 16:12:10 +0200 |
parents | 4e81412ead0a |
children | 979ae3ea3381 |
comparison
equal
deleted
inserted
replaced
4733:1db3b79d97bd | 4734:b51c08bd5c38 |
---|---|
369 Toolbox::XmlToString(target, doc); | 369 Toolbox::XmlToString(target, doc); |
370 } | 370 } |
371 #endif | 371 #endif |
372 | 372 |
373 | 373 |
374 void DicomWebJsonVisitor::VisitNotSupported(const std::vector<DicomTag> &parentTags, | 374 ITagVisitor::Action |
375 const std::vector<size_t> &parentIndexes, | 375 DicomWebJsonVisitor::VisitNotSupported(const std::vector<DicomTag> &parentTags, |
376 const DicomTag &tag, | 376 const std::vector<size_t> &parentIndexes, |
377 ValueRepresentation vr) | 377 const DicomTag &tag, |
378 { | 378 ValueRepresentation vr) |
379 } | 379 { |
380 | 380 return Action_None; |
381 | 381 } |
382 void DicomWebJsonVisitor::VisitEmptySequence(const std::vector<DicomTag>& parentTags, | 382 |
383 const std::vector<size_t>& parentIndexes, | 383 |
384 const DicomTag& tag) | 384 ITagVisitor::Action |
385 DicomWebJsonVisitor::VisitEmptySequence(const std::vector<DicomTag>& parentTags, | |
386 const std::vector<size_t>& parentIndexes, | |
387 const DicomTag& tag) | |
385 { | 388 { |
386 if (tag.GetElement() != 0x0000) | 389 if (tag.GetElement() != 0x0000) |
387 { | 390 { |
388 Json::Value& node = CreateNode(parentTags, parentIndexes, tag); | 391 Json::Value& node = CreateNode(parentTags, parentIndexes, tag); |
389 node[KEY_VR] = EnumerationToString(ValueRepresentation_Sequence); | 392 node[KEY_VR] = EnumerationToString(ValueRepresentation_Sequence); |
390 } | 393 } |
394 | |
395 return Action_None; | |
391 } | 396 } |
392 | 397 |
393 | 398 |
394 void DicomWebJsonVisitor::VisitBinary(const std::vector<DicomTag>& parentTags, | 399 ITagVisitor::Action |
395 const std::vector<size_t>& parentIndexes, | 400 DicomWebJsonVisitor::VisitBinary(const std::vector<DicomTag>& parentTags, |
396 const DicomTag& tag, | 401 const std::vector<size_t>& parentIndexes, |
397 ValueRepresentation vr, | 402 const DicomTag& tag, |
398 const void* data, | 403 ValueRepresentation vr, |
399 size_t size) | 404 const void* data, |
405 size_t size) | |
400 { | 406 { |
401 assert(vr == ValueRepresentation_OtherByte || | 407 assert(vr == ValueRepresentation_OtherByte || |
402 vr == ValueRepresentation_OtherDouble || | 408 vr == ValueRepresentation_OtherDouble || |
403 vr == ValueRepresentation_OtherFloat || | 409 vr == ValueRepresentation_OtherFloat || |
404 vr == ValueRepresentation_OtherLong || | 410 vr == ValueRepresentation_OtherLong || |
454 throw OrthancException(ErrorCode_ParameterOutOfRange); | 460 throw OrthancException(ErrorCode_ParameterOutOfRange); |
455 } | 461 } |
456 } | 462 } |
457 } | 463 } |
458 } | 464 } |
459 } | 465 |
460 | 466 return Action_None; |
461 | 467 } |
462 void DicomWebJsonVisitor::VisitIntegers(const std::vector<DicomTag>& parentTags, | 468 |
463 const std::vector<size_t>& parentIndexes, | 469 |
464 const DicomTag& tag, | 470 ITagVisitor::Action |
465 ValueRepresentation vr, | 471 DicomWebJsonVisitor::VisitIntegers(const std::vector<DicomTag>& parentTags, |
466 const std::vector<int64_t>& values) | 472 const std::vector<size_t>& parentIndexes, |
473 const DicomTag& tag, | |
474 ValueRepresentation vr, | |
475 const std::vector<int64_t>& values) | |
467 { | 476 { |
468 if (tag.GetElement() != 0x0000 && | 477 if (tag.GetElement() != 0x0000 && |
469 vr != ValueRepresentation_NotSupported) | 478 vr != ValueRepresentation_NotSupported) |
470 { | 479 { |
471 Json::Value& node = CreateNode(parentTags, parentIndexes, tag); | 480 Json::Value& node = CreateNode(parentTags, parentIndexes, tag); |
480 } | 489 } |
481 | 490 |
482 node[KEY_VALUE] = content; | 491 node[KEY_VALUE] = content; |
483 } | 492 } |
484 } | 493 } |
485 } | 494 |
486 | 495 return Action_None; |
487 void DicomWebJsonVisitor::VisitDoubles(const std::vector<DicomTag>& parentTags, | 496 } |
488 const std::vector<size_t>& parentIndexes, | 497 |
489 const DicomTag& tag, | 498 ITagVisitor::Action |
490 ValueRepresentation vr, | 499 DicomWebJsonVisitor::VisitDoubles(const std::vector<DicomTag>& parentTags, |
491 const std::vector<double>& values) | 500 const std::vector<size_t>& parentIndexes, |
501 const DicomTag& tag, | |
502 ValueRepresentation vr, | |
503 const std::vector<double>& values) | |
492 { | 504 { |
493 if (tag.GetElement() != 0x0000 && | 505 if (tag.GetElement() != 0x0000 && |
494 vr != ValueRepresentation_NotSupported) | 506 vr != ValueRepresentation_NotSupported) |
495 { | 507 { |
496 Json::Value& node = CreateNode(parentTags, parentIndexes, tag); | 508 Json::Value& node = CreateNode(parentTags, parentIndexes, tag); |
505 } | 517 } |
506 | 518 |
507 node[KEY_VALUE] = content; | 519 node[KEY_VALUE] = content; |
508 } | 520 } |
509 } | 521 } |
522 | |
523 return Action_None; | |
510 } | 524 } |
511 | 525 |
512 | 526 |
513 void DicomWebJsonVisitor::VisitAttributes(const std::vector<DicomTag>& parentTags, | 527 ITagVisitor::Action |
514 const std::vector<size_t>& parentIndexes, | 528 DicomWebJsonVisitor::VisitAttributes(const std::vector<DicomTag>& parentTags, |
515 const DicomTag& tag, | 529 const std::vector<size_t>& parentIndexes, |
516 const std::vector<DicomTag>& values) | 530 const DicomTag& tag, |
531 const std::vector<DicomTag>& values) | |
517 { | 532 { |
518 if (tag.GetElement() != 0x0000) | 533 if (tag.GetElement() != 0x0000) |
519 { | 534 { |
520 Json::Value& node = CreateNode(parentTags, parentIndexes, tag); | 535 Json::Value& node = CreateNode(parentTags, parentIndexes, tag); |
521 node[KEY_VR] = EnumerationToString(ValueRepresentation_AttributeTag); | 536 node[KEY_VR] = EnumerationToString(ValueRepresentation_AttributeTag); |
529 } | 544 } |
530 | 545 |
531 node[KEY_VALUE] = content; | 546 node[KEY_VALUE] = content; |
532 } | 547 } |
533 } | 548 } |
549 | |
550 return Action_None; | |
534 } | 551 } |
535 | 552 |
536 | 553 |
537 ITagVisitor::Action | 554 ITagVisitor::Action |
538 DicomWebJsonVisitor::VisitString(std::string& newValue, | 555 DicomWebJsonVisitor::VisitString(std::string& newValue, |