From 3d05a2f21a76f71e4f897396d5c2a898e5c537f1 Mon Sep 17 00:00:00 2001 From: sdk-team Date: Wed, 21 Sep 2022 01:55:20 +0000 Subject: [PATCH] Release ScreenEC. --- VERSION | 2 +- imageprocess/CMakeLists.txt | 4 + .../imageprocess/ImageprocessClient.h | 8 ++ .../imageprocess/model/ScreenECRequest.h | 51 +++++++++++++ .../imageprocess/model/ScreenECResult.h | 67 ++++++++++++++++ imageprocess/src/ImageprocessClient.cc | 36 +++++++++ imageprocess/src/model/ScreenECRequest.cc | 58 ++++++++++++++ imageprocess/src/model/ScreenECResult.cc | 76 +++++++++++++++++++ 8 files changed, 301 insertions(+), 1 deletion(-) create mode 100644 imageprocess/include/alibabacloud/imageprocess/model/ScreenECRequest.h create mode 100644 imageprocess/include/alibabacloud/imageprocess/model/ScreenECResult.h create mode 100644 imageprocess/src/model/ScreenECRequest.cc create mode 100644 imageprocess/src/model/ScreenECResult.cc diff --git a/VERSION b/VERSION index ccc7b0e0a..161018b15 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1269 \ No newline at end of file +1.36.1270 \ No newline at end of file diff --git a/imageprocess/CMakeLists.txt b/imageprocess/CMakeLists.txt index e1b697fbb..3aa81d588 100644 --- a/imageprocess/CMakeLists.txt +++ b/imageprocess/CMakeLists.txt @@ -57,6 +57,8 @@ set(imageprocess_public_header_model include/alibabacloud/imageprocess/model/RunMedQAResult.h include/alibabacloud/imageprocess/model/ScreenChestCTRequest.h include/alibabacloud/imageprocess/model/ScreenChestCTResult.h + include/alibabacloud/imageprocess/model/ScreenECRequest.h + include/alibabacloud/imageprocess/model/ScreenECResult.h include/alibabacloud/imageprocess/model/SegmentOARRequest.h include/alibabacloud/imageprocess/model/SegmentOARResult.h include/alibabacloud/imageprocess/model/TranslateMedRequest.h @@ -100,6 +102,8 @@ set(imageprocess_src src/model/RunMedQAResult.cc src/model/ScreenChestCTRequest.cc src/model/ScreenChestCTResult.cc + src/model/ScreenECRequest.cc + src/model/ScreenECResult.cc src/model/SegmentOARRequest.cc src/model/SegmentOARResult.cc src/model/TranslateMedRequest.cc diff --git a/imageprocess/include/alibabacloud/imageprocess/ImageprocessClient.h b/imageprocess/include/alibabacloud/imageprocess/ImageprocessClient.h index ef305a77a..11c7580c2 100644 --- a/imageprocess/include/alibabacloud/imageprocess/ImageprocessClient.h +++ b/imageprocess/include/alibabacloud/imageprocess/ImageprocessClient.h @@ -58,6 +58,8 @@ #include "model/RunMedQAResult.h" #include "model/ScreenChestCTRequest.h" #include "model/ScreenChestCTResult.h" +#include "model/ScreenECRequest.h" +#include "model/ScreenECResult.h" #include "model/SegmentOARRequest.h" #include "model/SegmentOARResult.h" #include "model/TranslateMedRequest.h" @@ -125,6 +127,9 @@ namespace AlibabaCloud typedef Outcome ScreenChestCTOutcome; typedef std::future ScreenChestCTOutcomeCallable; typedef std::function&)> ScreenChestCTAsyncHandler; + typedef Outcome ScreenECOutcome; + typedef std::future ScreenECOutcomeCallable; + typedef std::function&)> ScreenECAsyncHandler; typedef Outcome SegmentOAROutcome; typedef std::future SegmentOAROutcomeCallable; typedef std::function&)> SegmentOARAsyncHandler; @@ -190,6 +195,9 @@ namespace AlibabaCloud ScreenChestCTOutcome screenChestCT(const Model::ScreenChestCTRequest &request)const; void screenChestCTAsync(const Model::ScreenChestCTRequest& request, const ScreenChestCTAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; ScreenChestCTOutcomeCallable screenChestCTCallable(const Model::ScreenChestCTRequest& request) const; + ScreenECOutcome screenEC(const Model::ScreenECRequest &request)const; + void screenECAsync(const Model::ScreenECRequest& request, const ScreenECAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ScreenECOutcomeCallable screenECCallable(const Model::ScreenECRequest& request) const; SegmentOAROutcome segmentOAR(const Model::SegmentOARRequest &request)const; void segmentOARAsync(const Model::SegmentOARRequest& request, const SegmentOARAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; SegmentOAROutcomeCallable segmentOARCallable(const Model::SegmentOARRequest& request) const; diff --git a/imageprocess/include/alibabacloud/imageprocess/model/ScreenECRequest.h b/imageprocess/include/alibabacloud/imageprocess/model/ScreenECRequest.h new file mode 100644 index 000000000..f7bfa17db --- /dev/null +++ b/imageprocess/include/alibabacloud/imageprocess/model/ScreenECRequest.h @@ -0,0 +1,51 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_IMAGEPROCESS_MODEL_SCREENECREQUEST_H_ +#define ALIBABACLOUD_IMAGEPROCESS_MODEL_SCREENECREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Imageprocess { +namespace Model { +class ALIBABACLOUD_IMAGEPROCESS_EXPORT ScreenECRequest : public RpcServiceRequest { +public: + struct URLList { + std::string uRL; + }; + ScreenECRequest(); + ~ScreenECRequest(); + std::string getDataSourceType() const; + void setDataSourceType(const std::string &dataSourceType); + std::vector getURLList() const; + void setURLList(const std::vector &uRLList); + bool getAsync() const; + void setAsync(bool async); + +private: + std::string dataSourceType_; + std::vector uRLList_; + bool async_; +}; +} // namespace Model +} // namespace Imageprocess +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_IMAGEPROCESS_MODEL_SCREENECREQUEST_H_ diff --git a/imageprocess/include/alibabacloud/imageprocess/model/ScreenECResult.h b/imageprocess/include/alibabacloud/imageprocess/model/ScreenECResult.h new file mode 100644 index 000000000..150000e63 --- /dev/null +++ b/imageprocess/include/alibabacloud/imageprocess/model/ScreenECResult.h @@ -0,0 +1,67 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_IMAGEPROCESS_MODEL_SCREENECRESULT_H_ +#define ALIBABACLOUD_IMAGEPROCESS_MODEL_SCREENECRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Imageprocess + { + namespace Model + { + class ALIBABACLOUD_IMAGEPROCESS_EXPORT ScreenECResult : public ServiceResult + { + public: + struct Data + { + struct Lesion + { + std::string ecVolume; + std::string benignVolume; + std::string esoVolume; + std::string mask; + std::vector possibilities; + }; + Lesion lesion; + }; + + + ScreenECResult(); + explicit ScreenECResult(const std::string &payload); + ~ScreenECResult(); + std::string getMessage()const; + Data getData()const; + std::string getCode()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + Data data_; + std::string code_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IMAGEPROCESS_MODEL_SCREENECRESULT_H_ \ No newline at end of file diff --git a/imageprocess/src/ImageprocessClient.cc b/imageprocess/src/ImageprocessClient.cc index a8f7a5769..e380194d0 100644 --- a/imageprocess/src/ImageprocessClient.cc +++ b/imageprocess/src/ImageprocessClient.cc @@ -699,6 +699,42 @@ ImageprocessClient::ScreenChestCTOutcomeCallable ImageprocessClient::screenChest return task->get_future(); } +ImageprocessClient::ScreenECOutcome ImageprocessClient::screenEC(const ScreenECRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return ScreenECOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ScreenECOutcome(ScreenECResult(outcome.result())); + else + return ScreenECOutcome(outcome.error()); +} + +void ImageprocessClient::screenECAsync(const ScreenECRequest& request, const ScreenECAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, screenEC(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ImageprocessClient::ScreenECOutcomeCallable ImageprocessClient::screenECCallable(const ScreenECRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->screenEC(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + ImageprocessClient::SegmentOAROutcome ImageprocessClient::segmentOAR(const SegmentOARRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/imageprocess/src/model/ScreenECRequest.cc b/imageprocess/src/model/ScreenECRequest.cc new file mode 100644 index 000000000..8f61930f7 --- /dev/null +++ b/imageprocess/src/model/ScreenECRequest.cc @@ -0,0 +1,58 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +using AlibabaCloud::Imageprocess::Model::ScreenECRequest; + +ScreenECRequest::ScreenECRequest() + : RpcServiceRequest("imageprocess", "2020-03-20", "ScreenEC") { + setMethod(HttpRequest::Method::Post); +} + +ScreenECRequest::~ScreenECRequest() {} + +std::string ScreenECRequest::getDataSourceType() const { + return dataSourceType_; +} + +void ScreenECRequest::setDataSourceType(const std::string &dataSourceType) { + dataSourceType_ = dataSourceType; + setBodyParameter(std::string("DataSourceType"), dataSourceType); +} + +std::vector ScreenECRequest::getURLList() const { + return uRLList_; +} + +void ScreenECRequest::setURLList(const std::vector &uRLList) { + uRLList_ = uRLList; + for(int dep1 = 0; dep1 != uRLList.size(); dep1++) { + auto uRLListObj = uRLList.at(dep1); + std::string uRLListObjStr = std::string("URLList") + "." + std::to_string(dep1 + 1); + setBodyParameter(uRLListObjStr + ".URL", uRLListObj.uRL); + } +} + +bool ScreenECRequest::getAsync() const { + return async_; +} + +void ScreenECRequest::setAsync(bool async) { + async_ = async; + setBodyParameter(std::string("Async"), async ? "true" : "false"); +} + diff --git a/imageprocess/src/model/ScreenECResult.cc b/imageprocess/src/model/ScreenECResult.cc new file mode 100644 index 000000000..8e57cd969 --- /dev/null +++ b/imageprocess/src/model/ScreenECResult.cc @@ -0,0 +1,76 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +using namespace AlibabaCloud::Imageprocess; +using namespace AlibabaCloud::Imageprocess::Model; + +ScreenECResult::ScreenECResult() : + ServiceResult() +{} + +ScreenECResult::ScreenECResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +ScreenECResult::~ScreenECResult() +{} + +void ScreenECResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto dataNode = value["Data"]; + auto lesionNode = dataNode["Lesion"]; + if(!lesionNode["EsoVolume"].isNull()) + data_.lesion.esoVolume = lesionNode["EsoVolume"].asString(); + if(!lesionNode["EcVolume"].isNull()) + data_.lesion.ecVolume = lesionNode["EcVolume"].asString(); + if(!lesionNode["BenignVolume"].isNull()) + data_.lesion.benignVolume = lesionNode["BenignVolume"].asString(); + if(!lesionNode["Mask"].isNull()) + data_.lesion.mask = lesionNode["Mask"].asString(); + auto allPossibilities = lesionNode["Possibilities"]["possibilities"]; + for (auto value : allPossibilities) + data_.lesion.possibilities.push_back(value.asString()); + if(!value["Code"].isNull()) + code_ = value["Code"].asString(); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +std::string ScreenECResult::getMessage()const +{ + return message_; +} + +ScreenECResult::Data ScreenECResult::getData()const +{ + return data_; +} + +std::string ScreenECResult::getCode()const +{ + return code_; +} +