comparison Framework/Deprecated/Toolbox/OrthancSlicesLoader.cpp @ 1222:21c2b0eee53c broker

deprecating MessageHandler
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 07 Dec 2019 18:18:07 +0100
parents 04a95ee91327
children 0ca50d275b9a
comparison
equal deleted inserted replaced
1218:6f3f1ef347a3 1222:21c2b0eee53c
654 } 654 }
655 else 655 else
656 { 656 {
657 state_ = State_LoadingGeometry; 657 state_ = State_LoadingGeometry;
658 orthanc_->GetJsonAsync("/series/" + seriesId + "/instances-tags", 658 orthanc_->GetJsonAsync("/series/" + seriesId + "/instances-tags",
659 new OrthancStone::Callable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(GetSharedObserver(), &OrthancSlicesLoader::ParseSeriesGeometry), 659 new DeprecatedCallable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(GetSharedObserver(), &OrthancSlicesLoader::ParseSeriesGeometry),
660 new OrthancStone::Callable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(GetSharedObserver(), &OrthancSlicesLoader::OnGeometryError), 660 new DeprecatedCallable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(GetSharedObserver(), &OrthancSlicesLoader::OnGeometryError),
661 NULL); 661 NULL);
662 } 662 }
663 } 663 }
664 664
665 void OrthancSlicesLoader::ScheduleLoadInstance(const std::string& instanceId) 665 void OrthancSlicesLoader::ScheduleLoadInstance(const std::string& instanceId)
673 state_ = State_LoadingGeometry; 673 state_ = State_LoadingGeometry;
674 674
675 // Tag "3004-000c" is "Grid Frame Offset Vector", which is 675 // Tag "3004-000c" is "Grid Frame Offset Vector", which is
676 // mandatory to read RT DOSE, but is too long to be returned by default 676 // mandatory to read RT DOSE, but is too long to be returned by default
677 orthanc_->GetJsonAsync("/instances/" + instanceId + "/tags?ignore-length=3004-000c", 677 orthanc_->GetJsonAsync("/instances/" + instanceId + "/tags?ignore-length=3004-000c",
678 new OrthancStone::Callable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(GetSharedObserver(), &OrthancSlicesLoader::ParseInstanceGeometry), 678 new DeprecatedCallable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(GetSharedObserver(), &OrthancSlicesLoader::ParseInstanceGeometry),
679 new OrthancStone::Callable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(GetSharedObserver(), &OrthancSlicesLoader::OnGeometryError), 679 new DeprecatedCallable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(GetSharedObserver(), &OrthancSlicesLoader::OnGeometryError),
680 Operation::DownloadInstanceGeometry(instanceId)); 680 Operation::DownloadInstanceGeometry(instanceId));
681 } 681 }
682 } 682 }
683 683
684 684
692 else 692 else
693 { 693 {
694 state_ = State_LoadingGeometry; 694 state_ = State_LoadingGeometry;
695 695
696 orthanc_->GetJsonAsync("/instances/" + instanceId + "/tags", 696 orthanc_->GetJsonAsync("/instances/" + instanceId + "/tags",
697 new OrthancStone::Callable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(GetSharedObserver(), &OrthancSlicesLoader::ParseFrameGeometry), 697 new DeprecatedCallable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(GetSharedObserver(), &OrthancSlicesLoader::ParseFrameGeometry),
698 new OrthancStone::Callable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(GetSharedObserver(), &OrthancSlicesLoader::OnGeometryError), 698 new DeprecatedCallable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(GetSharedObserver(), &OrthancSlicesLoader::OnGeometryError),
699 Operation::DownloadFrameGeometry(instanceId, frame)); 699 Operation::DownloadFrameGeometry(instanceId, frame));
700 } 700 }
701 } 701 }
702 702
703 703
766 default: 766 default:
767 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); 767 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
768 } 768 }
769 769
770 orthanc_->GetBinaryAsync(uri, "image/png", 770 orthanc_->GetBinaryAsync(uri, "image/png",
771 new OrthancStone::Callable<OrthancSlicesLoader, 771 new DeprecatedCallable<OrthancSlicesLoader,
772 OrthancApiClient::BinaryResponseReadyMessage> 772 OrthancApiClient::BinaryResponseReadyMessage>
773 (GetSharedObserver(), &OrthancSlicesLoader::ParseSliceImagePng), 773 (GetSharedObserver(), &OrthancSlicesLoader::ParseSliceImagePng),
774 new OrthancStone::Callable<OrthancSlicesLoader, 774 new DeprecatedCallable<OrthancSlicesLoader,
775 IWebService::HttpRequestErrorMessage> 775 IWebService::HttpRequestErrorMessage>
776 (GetSharedObserver(), &OrthancSlicesLoader::OnSliceImageError), 776 (GetSharedObserver(), &OrthancSlicesLoader::OnSliceImageError),
777 Operation::DownloadSliceImage( 777 Operation::DownloadSliceImage(
778 static_cast<unsigned int>(index), slice, SliceImageQuality_FullPng)); 778 static_cast<unsigned int>(index), slice, SliceImageQuality_FullPng));
779 } 779 }
802 default: 802 default:
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 OrthancStone::Callable<OrthancSlicesLoader, 807 new DeprecatedCallable<OrthancSlicesLoader,
808 OrthancApiClient::BinaryResponseReadyMessage> 808 OrthancApiClient::BinaryResponseReadyMessage>
809 (GetSharedObserver(), &OrthancSlicesLoader::ParseSliceImagePam), 809 (GetSharedObserver(), &OrthancSlicesLoader::ParseSliceImagePam),
810 new OrthancStone::Callable<OrthancSlicesLoader, 810 new DeprecatedCallable<OrthancSlicesLoader,
811 IWebService::HttpRequestErrorMessage> 811 IWebService::HttpRequestErrorMessage>
812 (GetSharedObserver(), &OrthancSlicesLoader::OnSliceImageError), 812 (GetSharedObserver(), &OrthancSlicesLoader::OnSliceImageError),
813 Operation::DownloadSliceImage(static_cast<unsigned int>(index), 813 Operation::DownloadSliceImage(static_cast<unsigned int>(index),
814 slice, SliceImageQuality_FullPam)); 814 slice, SliceImageQuality_FullPam));
815 } 815 }
845 boost::lexical_cast<std::string>(value) + 845 boost::lexical_cast<std::string>(value) +
846 "-" + slice.GetOrthancInstanceId() + "_" + 846 "-" + slice.GetOrthancInstanceId() + "_" +
847 boost::lexical_cast<std::string>(slice.GetFrame())); 847 boost::lexical_cast<std::string>(slice.GetFrame()));
848 848
849 orthanc_->GetJsonAsync(uri, 849 orthanc_->GetJsonAsync(uri,
850 new OrthancStone::Callable<OrthancSlicesLoader, 850 new DeprecatedCallable<OrthancSlicesLoader,
851 OrthancApiClient::JsonResponseReadyMessage> 851 OrthancApiClient::JsonResponseReadyMessage>
852 (GetSharedObserver(), &OrthancSlicesLoader::ParseSliceImageJpeg), 852 (GetSharedObserver(), &OrthancSlicesLoader::ParseSliceImageJpeg),
853 new OrthancStone::Callable<OrthancSlicesLoader, 853 new DeprecatedCallable<OrthancSlicesLoader,
854 IWebService::HttpRequestErrorMessage> 854 IWebService::HttpRequestErrorMessage>
855 (GetSharedObserver(), &OrthancSlicesLoader::OnSliceImageError), 855 (GetSharedObserver(), &OrthancSlicesLoader::OnSliceImageError),
856 Operation::DownloadSliceImage( 856 Operation::DownloadSliceImage(
857 static_cast<unsigned int>(index), slice, quality)); 857 static_cast<unsigned int>(index), slice, quality));
858 } 858 }
886 else 886 else
887 { 887 {
888 std::string uri = ("/instances/" + slice.GetOrthancInstanceId() + "/frames/" + 888 std::string uri = ("/instances/" + slice.GetOrthancInstanceId() + "/frames/" +
889 boost::lexical_cast<std::string>(slice.GetFrame()) + "/raw.gz"); 889 boost::lexical_cast<std::string>(slice.GetFrame()) + "/raw.gz");
890 orthanc_->GetBinaryAsync(uri, IWebService::HttpHeaders(), 890 orthanc_->GetBinaryAsync(uri, IWebService::HttpHeaders(),
891 new OrthancStone::Callable<OrthancSlicesLoader, 891 new DeprecatedCallable<OrthancSlicesLoader,
892 OrthancApiClient::BinaryResponseReadyMessage> 892 OrthancApiClient::BinaryResponseReadyMessage>
893 (GetSharedObserver(), &OrthancSlicesLoader::ParseSliceRawImage), 893 (GetSharedObserver(), &OrthancSlicesLoader::ParseSliceRawImage),
894 new OrthancStone::Callable<OrthancSlicesLoader, 894 new DeprecatedCallable<OrthancSlicesLoader,
895 IWebService::HttpRequestErrorMessage> 895 IWebService::HttpRequestErrorMessage>
896 (GetSharedObserver(), &OrthancSlicesLoader::OnSliceImageError), 896 (GetSharedObserver(), &OrthancSlicesLoader::OnSliceImageError),
897 Operation::DownloadSliceRawImage( 897 Operation::DownloadSliceRawImage(
898 static_cast<unsigned int>(index), slice)); 898 static_cast<unsigned int>(index), slice));
899 } 899 }