comparison Framework/Toolbox/OrthancSlicesLoader.cpp @ 693:9a474e90e832

Fixed a bunch of truncation warnings in various parts of the library
author Benjamin Golinvaux <bgo@osimis.io>
date Fri, 17 May 2019 08:49:55 +0200
parents 1088d4c4d78c
children d2c0e347ddc2
comparison
equal deleted inserted replaced
692:10910827f235 693:9a474e90e832
769 default: 769 default:
770 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); 770 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
771 } 771 }
772 772
773 orthanc_.GetBinaryAsync(uri, "image/png", 773 orthanc_.GetBinaryAsync(uri, "image/png",
774 new Callable<OrthancSlicesLoader, OrthancApiClient::BinaryResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseSliceImagePng), 774 new Callable<OrthancSlicesLoader,
775 new Callable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(*this, &OrthancSlicesLoader::OnSliceImageError), 775 OrthancApiClient::BinaryResponseReadyMessage>
776 Operation::DownloadSliceImage(index, slice, SliceImageQuality_FullPng)); 776 (*this, &OrthancSlicesLoader::ParseSliceImagePng),
777 } 777 new Callable<OrthancSlicesLoader,
778 IWebService::HttpRequestErrorMessage>
779 (*this, &OrthancSlicesLoader::OnSliceImageError),
780 Operation::DownloadSliceImage(
781 static_cast<unsigned int>(index), slice, SliceImageQuality_FullPng));
782 }
778 783
779 void OrthancSlicesLoader::ScheduleSliceImagePam(const Slice& slice, 784 void OrthancSlicesLoader::ScheduleSliceImagePam(const Slice& slice,
780 size_t index) 785 size_t index)
781 { 786 {
782 std::string uri = ("/instances/" + slice.GetOrthancInstanceId() + "/frames/" + 787 std::string uri =
783 boost::lexical_cast<std::string>(slice.GetFrame())); 788 ("/instances/" + slice.GetOrthancInstanceId() + "/frames/" +
789 boost::lexical_cast<std::string>(slice.GetFrame()));
784 790
785 switch (slice.GetConverter().GetExpectedPixelFormat()) 791 switch (slice.GetConverter().GetExpectedPixelFormat())
786 { 792 {
787 case Orthanc::PixelFormat_RGB24: 793 case Orthanc::PixelFormat_RGB24:
788 uri += "/preview"; 794 uri += "/preview";
799 default: 805 default:
800 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); 806 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
801 } 807 }
802 808
803 orthanc_.GetBinaryAsync(uri, "image/x-portable-arbitrarymap", 809 orthanc_.GetBinaryAsync(uri, "image/x-portable-arbitrarymap",
804 new Callable<OrthancSlicesLoader, OrthancApiClient::BinaryResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseSliceImagePam), 810 new Callable<OrthancSlicesLoader,
805 new Callable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(*this, &OrthancSlicesLoader::OnSliceImageError), 811 OrthancApiClient::BinaryResponseReadyMessage>
806 Operation::DownloadSliceImage(index, slice, SliceImageQuality_FullPam)); 812 (*this, &OrthancSlicesLoader::ParseSliceImagePam),
813 new Callable<OrthancSlicesLoader,
814 IWebService::HttpRequestErrorMessage>
815 (*this, &OrthancSlicesLoader::OnSliceImageError),
816 Operation::DownloadSliceImage(static_cast<unsigned int>(index),
817 slice, SliceImageQuality_FullPam));
807 } 818 }
808 819
809 820
810 821
811 void OrthancSlicesLoader::ScheduleSliceImageJpeg(const Slice& slice, 822 void OrthancSlicesLoader::ScheduleSliceImageJpeg(const Slice& slice,
837 boost::lexical_cast<std::string>(value) + 848 boost::lexical_cast<std::string>(value) +
838 "-" + slice.GetOrthancInstanceId() + "_" + 849 "-" + slice.GetOrthancInstanceId() + "_" +
839 boost::lexical_cast<std::string>(slice.GetFrame())); 850 boost::lexical_cast<std::string>(slice.GetFrame()));
840 851
841 orthanc_.GetJsonAsync(uri, 852 orthanc_.GetJsonAsync(uri,
842 new Callable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseSliceImageJpeg), 853 new Callable<OrthancSlicesLoader,
843 new Callable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(*this, &OrthancSlicesLoader::OnSliceImageError), 854 OrthancApiClient::JsonResponseReadyMessage>
844 Operation::DownloadSliceImage(index, slice, quality)); 855 (*this, &OrthancSlicesLoader::ParseSliceImageJpeg),
856 new Callable<OrthancSlicesLoader,
857 IWebService::HttpRequestErrorMessage>
858 (*this, &OrthancSlicesLoader::OnSliceImageError),
859 Operation::DownloadSliceImage(
860 static_cast<unsigned int>(index), slice, quality));
845 } 861 }
846 862
847 863
848 864
849 void OrthancSlicesLoader::ScheduleLoadSliceImage(size_t index, 865 void OrthancSlicesLoader::ScheduleLoadSliceImage(size_t index,
873 else 889 else
874 { 890 {
875 std::string uri = ("/instances/" + slice.GetOrthancInstanceId() + "/frames/" + 891 std::string uri = ("/instances/" + slice.GetOrthancInstanceId() + "/frames/" +
876 boost::lexical_cast<std::string>(slice.GetFrame()) + "/raw.gz"); 892 boost::lexical_cast<std::string>(slice.GetFrame()) + "/raw.gz");
877 orthanc_.GetBinaryAsync(uri, IWebService::HttpHeaders(), 893 orthanc_.GetBinaryAsync(uri, IWebService::HttpHeaders(),
878 new Callable<OrthancSlicesLoader, OrthancApiClient::BinaryResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseSliceRawImage), 894 new Callable<OrthancSlicesLoader,
879 new Callable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(*this, &OrthancSlicesLoader::OnSliceImageError), 895 OrthancApiClient::BinaryResponseReadyMessage>
880 Operation::DownloadSliceRawImage(index, slice)); 896 (*this, &OrthancSlicesLoader::ParseSliceRawImage),
897 new Callable<OrthancSlicesLoader,
898 IWebService::HttpRequestErrorMessage>
899 (*this, &OrthancSlicesLoader::OnSliceImageError),
900 Operation::DownloadSliceRawImage(
901 static_cast<unsigned int>(index), slice));
881 } 902 }
882 } 903 }
883 } 904 }