Mercurial > hg > orthanc-stone
comparison Framework/Toolbox/OrthancSlicesLoader.cpp @ 382:dd4c7e82b4be
removed class OrthancApiClient::HttpErrorMessage, redundant with IWebService::HttpRequestErrorMessage
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 06 Nov 2018 19:36:32 +0100 |
parents | 814fa32e2fcc |
children | 5d359b115b29 |
comparison
equal
deleted
inserted
replaced
381:19bd222283ae | 382:dd4c7e82b4be |
---|---|
215 LOG(ERROR) << "This series is empty"; | 215 LOG(ERROR) << "This series is empty"; |
216 EmitMessage(SliceGeometryErrorMessage(*this)); | 216 EmitMessage(SliceGeometryErrorMessage(*this)); |
217 } | 217 } |
218 } | 218 } |
219 | 219 |
220 void OrthancSlicesLoader::OnGeometryError(const OrthancApiClient::HttpErrorMessage& message) | 220 void OrthancSlicesLoader::OnGeometryError(const IWebService::HttpRequestErrorMessage& message) |
221 { | 221 { |
222 EmitMessage(SliceGeometryErrorMessage(*this)); | 222 EmitMessage(SliceGeometryErrorMessage(*this)); |
223 state_ = State_Error; | 223 state_ = State_Error; |
224 } | 224 } |
225 | 225 |
226 void OrthancSlicesLoader::OnSliceImageError(const OrthancApiClient::HttpErrorMessage& message) | 226 void OrthancSlicesLoader::OnSliceImageError(const IWebService::HttpRequestErrorMessage& message) |
227 { | 227 { |
228 NotifySliceImageError(dynamic_cast<const Operation&>(message.GetPayload())); | 228 NotifySliceImageError(dynamic_cast<const Operation&>(message.GetPayload())); |
229 state_ = State_Error; | 229 state_ = State_Error; |
230 } | 230 } |
231 | 231 |
663 else | 663 else |
664 { | 664 { |
665 state_ = State_LoadingGeometry; | 665 state_ = State_LoadingGeometry; |
666 orthanc_.GetJsonAsync("/series/" + seriesId + "/instances-tags", | 666 orthanc_.GetJsonAsync("/series/" + seriesId + "/instances-tags", |
667 new Callable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseSeriesGeometry), | 667 new Callable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseSeriesGeometry), |
668 new Callable<OrthancSlicesLoader, OrthancApiClient::HttpErrorMessage>(*this, &OrthancSlicesLoader::OnGeometryError), | 668 new Callable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(*this, &OrthancSlicesLoader::OnGeometryError), |
669 NULL); | 669 NULL); |
670 } | 670 } |
671 } | 671 } |
672 | 672 |
673 void OrthancSlicesLoader::ScheduleLoadInstance(const std::string& instanceId) | 673 void OrthancSlicesLoader::ScheduleLoadInstance(const std::string& instanceId) |
682 | 682 |
683 // Tag "3004-000c" is "Grid Frame Offset Vector", which is | 683 // Tag "3004-000c" is "Grid Frame Offset Vector", which is |
684 // mandatory to read RT DOSE, but is too long to be returned by default | 684 // mandatory to read RT DOSE, but is too long to be returned by default |
685 orthanc_.GetJsonAsync("/instances/" + instanceId + "/tags?ignore-length=3004-000c", | 685 orthanc_.GetJsonAsync("/instances/" + instanceId + "/tags?ignore-length=3004-000c", |
686 new Callable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseInstanceGeometry), | 686 new Callable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseInstanceGeometry), |
687 new Callable<OrthancSlicesLoader, OrthancApiClient::HttpErrorMessage>(*this, &OrthancSlicesLoader::OnGeometryError), | 687 new Callable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(*this, &OrthancSlicesLoader::OnGeometryError), |
688 Operation::DownloadInstanceGeometry(instanceId)); | 688 Operation::DownloadInstanceGeometry(instanceId)); |
689 } | 689 } |
690 } | 690 } |
691 | 691 |
692 | 692 |
701 { | 701 { |
702 state_ = State_LoadingGeometry; | 702 state_ = State_LoadingGeometry; |
703 | 703 |
704 orthanc_.GetJsonAsync("/instances/" + instanceId + "/tags", | 704 orthanc_.GetJsonAsync("/instances/" + instanceId + "/tags", |
705 new Callable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseFrameGeometry), | 705 new Callable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseFrameGeometry), |
706 new Callable<OrthancSlicesLoader, OrthancApiClient::HttpErrorMessage>(*this, &OrthancSlicesLoader::OnGeometryError), | 706 new Callable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(*this, &OrthancSlicesLoader::OnGeometryError), |
707 Operation::DownloadFrameGeometry(instanceId, frame)); | 707 Operation::DownloadFrameGeometry(instanceId, frame)); |
708 } | 708 } |
709 } | 709 } |
710 | 710 |
711 | 711 |
773 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | 773 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
774 } | 774 } |
775 | 775 |
776 orthanc_.GetBinaryAsync(uri, "image/png", | 776 orthanc_.GetBinaryAsync(uri, "image/png", |
777 new Callable<OrthancSlicesLoader, OrthancApiClient::BinaryResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseSliceImagePng), | 777 new Callable<OrthancSlicesLoader, OrthancApiClient::BinaryResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseSliceImagePng), |
778 new Callable<OrthancSlicesLoader, OrthancApiClient::HttpErrorMessage>(*this, &OrthancSlicesLoader::OnSliceImageError), | 778 new Callable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(*this, &OrthancSlicesLoader::OnSliceImageError), |
779 Operation::DownloadSliceImage(index, slice, SliceImageQuality_FullPng)); | 779 Operation::DownloadSliceImage(index, slice, SliceImageQuality_FullPng)); |
780 } | 780 } |
781 | 781 |
782 void OrthancSlicesLoader::ScheduleSliceImagePam(const Slice& slice, | 782 void OrthancSlicesLoader::ScheduleSliceImagePam(const Slice& slice, |
783 size_t index) | 783 size_t index) |
803 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | 803 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
804 } | 804 } |
805 | 805 |
806 orthanc_.GetBinaryAsync(uri, "image/x-portable-arbitrarymap", | 806 orthanc_.GetBinaryAsync(uri, "image/x-portable-arbitrarymap", |
807 new Callable<OrthancSlicesLoader, OrthancApiClient::BinaryResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseSliceImagePam), | 807 new Callable<OrthancSlicesLoader, OrthancApiClient::BinaryResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseSliceImagePam), |
808 new Callable<OrthancSlicesLoader, OrthancApiClient::HttpErrorMessage>(*this, &OrthancSlicesLoader::OnSliceImageError), | 808 new Callable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(*this, &OrthancSlicesLoader::OnSliceImageError), |
809 Operation::DownloadSliceImage(index, slice, SliceImageQuality_FullPam)); | 809 Operation::DownloadSliceImage(index, slice, SliceImageQuality_FullPam)); |
810 } | 810 } |
811 | 811 |
812 | 812 |
813 | 813 |
841 "-" + slice.GetOrthancInstanceId() + "_" + | 841 "-" + slice.GetOrthancInstanceId() + "_" + |
842 boost::lexical_cast<std::string>(slice.GetFrame())); | 842 boost::lexical_cast<std::string>(slice.GetFrame())); |
843 | 843 |
844 orthanc_.GetJsonAsync(uri, | 844 orthanc_.GetJsonAsync(uri, |
845 new Callable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseSliceImageJpeg), | 845 new Callable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseSliceImageJpeg), |
846 new Callable<OrthancSlicesLoader, OrthancApiClient::HttpErrorMessage>(*this, &OrthancSlicesLoader::OnSliceImageError), | 846 new Callable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(*this, &OrthancSlicesLoader::OnSliceImageError), |
847 Operation::DownloadSliceImage(index, slice, quality)); | 847 Operation::DownloadSliceImage(index, slice, quality)); |
848 } | 848 } |
849 | 849 |
850 | 850 |
851 | 851 |
877 { | 877 { |
878 std::string uri = ("/instances/" + slice.GetOrthancInstanceId() + "/frames/" + | 878 std::string uri = ("/instances/" + slice.GetOrthancInstanceId() + "/frames/" + |
879 boost::lexical_cast<std::string>(slice.GetFrame()) + "/raw.gz"); | 879 boost::lexical_cast<std::string>(slice.GetFrame()) + "/raw.gz"); |
880 orthanc_.GetBinaryAsync(uri, IWebService::Headers(), | 880 orthanc_.GetBinaryAsync(uri, IWebService::Headers(), |
881 new Callable<OrthancSlicesLoader, OrthancApiClient::BinaryResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseSliceRawImage), | 881 new Callable<OrthancSlicesLoader, OrthancApiClient::BinaryResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseSliceRawImage), |
882 new Callable<OrthancSlicesLoader, OrthancApiClient::HttpErrorMessage>(*this, &OrthancSlicesLoader::OnSliceImageError), | 882 new Callable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(*this, &OrthancSlicesLoader::OnSliceImageError), |
883 Operation::DownloadSliceRawImage(index, slice)); | 883 Operation::DownloadSliceRawImage(index, slice)); |
884 } | 884 } |
885 } | 885 } |
886 } | 886 } |