comparison OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp @ 4205:d962a2996637

cppcheck
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 17 Sep 2020 17:58:19 +0200
parents 0ddc5297a8ab
children 1661544ea94d
comparison
equal deleted inserted replaced
4204:318c16cfccab 4205:d962a2996637
407 ImageToEncode(std::unique_ptr<ImageAccessor>& image, 407 ImageToEncode(std::unique_ptr<ImageAccessor>& image,
408 ImageExtractionMode mode, 408 ImageExtractionMode mode,
409 bool invert) : 409 bool invert) :
410 image_(image), 410 image_(image),
411 mode_(mode), 411 mode_(mode),
412 invert_(invert) 412 invert_(invert),
413 format_(MimeType_Binary)
413 { 414 {
414 } 415 }
415 416
416 void Answer(RestApiOutput& output) 417 void Answer(RestApiOutput& output)
417 { 418 {
441 { 442 {
442 private: 443 private:
443 ImageToEncode& image_; 444 ImageToEncode& image_;
444 445
445 public: 446 public:
446 EncodePng(ImageToEncode& image) : image_(image) 447 explicit EncodePng(ImageToEncode& image) : image_(image)
447 { 448 {
448 } 449 }
449 450
450 virtual void Handle(const std::string& type, 451 virtual void Handle(const std::string& type,
451 const std::string& subtype) 452 const std::string& subtype) ORTHANC_OVERRIDE
452 { 453 {
453 assert(type == "image"); 454 assert(type == "image");
454 assert(subtype == "png"); 455 assert(subtype == "png");
455 image_.EncodeUsingPng(); 456 image_.EncodeUsingPng();
456 } 457 }
460 { 461 {
461 private: 462 private:
462 ImageToEncode& image_; 463 ImageToEncode& image_;
463 464
464 public: 465 public:
465 EncodePam(ImageToEncode& image) : image_(image) 466 explicit EncodePam(ImageToEncode& image) : image_(image)
466 { 467 {
467 } 468 }
468 469
469 virtual void Handle(const std::string& type, 470 virtual void Handle(const std::string& type,
470 const std::string& subtype) 471 const std::string& subtype) ORTHANC_OVERRIDE
471 { 472 {
472 assert(type == "image"); 473 assert(type == "image");
473 assert(subtype == "x-portable-arbitrarymap"); 474 assert(subtype == "x-portable-arbitrarymap");
474 image_.EncodeUsingPam(); 475 image_.EncodeUsingPam();
475 } 476 }
505 "Bad quality for a JPEG encoding (must be a number between 0 and 100): " + v); 506 "Bad quality for a JPEG encoding (must be a number between 0 and 100): " + v);
506 } 507 }
507 } 508 }
508 509
509 virtual void Handle(const std::string& type, 510 virtual void Handle(const std::string& type,
510 const std::string& subtype) 511 const std::string& subtype) ORTHANC_OVERRIDE
511 { 512 {
512 assert(type == "image"); 513 assert(type == "image");
513 assert(subtype == "jpeg"); 514 assert(subtype == "jpeg");
514 image_.EncodeUsingJpeg(quality_); 515 image_.EncodeUsingJpeg(quality_);
515 } 516 }
629 { 630 {
630 private: 631 private:
631 ImageExtractionMode mode_; 632 ImageExtractionMode mode_;
632 633
633 public: 634 public:
634 GetImageHandler(ImageExtractionMode mode) : 635 explicit GetImageHandler(ImageExtractionMode mode) :
635 mode_(mode) 636 mode_(mode)
636 { 637 {
637 } 638 }
638 639
639 virtual void Handle(RestApiGetCall& call, 640 virtual void Handle(RestApiGetCall& call,
696 static void GetUserArguments(float& windowWidth /* inout */, 697 static void GetUserArguments(float& windowWidth /* inout */,
697 float& windowCenter /* inout */, 698 float& windowCenter /* inout */,
698 unsigned int& argWidth, 699 unsigned int& argWidth,
699 unsigned int& argHeight, 700 unsigned int& argHeight,
700 bool& smooth, 701 bool& smooth,
701 RestApiGetCall& call) 702 const RestApiGetCall& call)
702 { 703 {
703 static const char* ARG_WINDOW_CENTER = "window-center"; 704 static const char* ARG_WINDOW_CENTER = "window-center";
704 static const char* ARG_WINDOW_WIDTH = "window-width"; 705 static const char* ARG_WINDOW_WIDTH = "window-width";
705 static const char* ARG_WIDTH = "width"; 706 static const char* ARG_WIDTH = "width";
706 static const char* ARG_HEIGHT = "height"; 707 static const char* ARG_HEIGHT = "height";
1061 1062
1062 1063
1063 1064
1064 // Handling of metadata ----------------------------------------------------- 1065 // Handling of metadata -----------------------------------------------------
1065 1066
1066 static void CheckValidResourceType(RestApiCall& call) 1067 static void CheckValidResourceType(const RestApiCall& call)
1067 { 1068 {
1068 std::string resourceType = call.GetUriComponent("resourceType", ""); 1069 std::string resourceType = call.GetUriComponent("resourceType", "");
1069 StringToResourceType(resourceType.c_str()); 1070 StringToResourceType(resourceType.c_str());
1070 } 1071 }
1071 1072
1683 public: 1684 public:
1684 FindVisitor() : 1685 FindVisitor() :
1685 isComplete_(false) 1686 isComplete_(false)
1686 { 1687 {
1687 } 1688 }
1688 1689
1689 virtual bool IsDicomAsJsonNeeded() const 1690 virtual bool IsDicomAsJsonNeeded() const ORTHANC_OVERRIDE
1690 { 1691 {
1691 return false; // (*) 1692 return false; // (*)
1692 } 1693 }
1693 1694
1694 virtual void MarkAsComplete() 1695 virtual void MarkAsComplete() ORTHANC_OVERRIDE
1695 { 1696 {
1696 isComplete_ = true; // Unused information as of Orthanc 1.5.0 1697 isComplete_ = true; // Unused information as of Orthanc 1.5.0
1697 } 1698 }
1698 1699
1699 virtual void Visit(const std::string& publicId, 1700 virtual void Visit(const std::string& publicId,
1700 const std::string& instanceId /* unused */, 1701 const std::string& instanceId /* unused */,
1701 const DicomMap& mainDicomTags /* unused */, 1702 const DicomMap& mainDicomTags /* unused */,
1702 const Json::Value* dicomAsJson /* unused (*) */) 1703 const Json::Value* dicomAsJson /* unused (*) */) ORTHANC_OVERRIDE
1703 { 1704 {
1704 resources_.push_back(publicId); 1705 resources_.push_back(publicId);
1705 } 1706 }
1706 1707
1707 void Answer(RestApiOutput& output, 1708 void Answer(RestApiOutput& output,