From 35f5b170e3aeb6940f188a5eebcc24536530963b Mon Sep 17 00:00:00 2001 From: sdk-team Date: Mon, 25 Jul 2022 07:51:19 +0000 Subject: [PATCH] Update SegmentOAR. --- CHANGELOG | 3 + VERSION | 2 +- imageprocess/CMakeLists.txt | 4 + .../imageprocess/ImageprocessClient.h | 8 ++ .../imageprocess/model/SegmentOARRequest.h | 66 ++++++++++++ .../imageprocess/model/SegmentOARResult.h | 59 ++++++++++ imageprocess/src/ImageprocessClient.cc | 36 +++++++ imageprocess/src/model/SegmentOARRequest.cc | 102 ++++++++++++++++++ imageprocess/src/model/SegmentOARResult.cc | 66 ++++++++++++ 9 files changed, 345 insertions(+), 1 deletion(-) create mode 100644 imageprocess/include/alibabacloud/imageprocess/model/SegmentOARRequest.h create mode 100644 imageprocess/include/alibabacloud/imageprocess/model/SegmentOARResult.h create mode 100644 imageprocess/src/model/SegmentOARRequest.cc create mode 100644 imageprocess/src/model/SegmentOARResult.cc diff --git a/CHANGELOG b/CHANGELOG index dea15c65d..42b3bde8a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2022-07-25 Version: 1.36.1200 +- Update SegmentOAR. + 2022-07-25 Version: 1.36.1199 - Change ListCheckInstanceResult GetCheckDetail Public. diff --git a/VERSION b/VERSION index 9d91116b3..f8b77f298 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1199 \ No newline at end of file +1.36.1200 \ No newline at end of file diff --git a/imageprocess/CMakeLists.txt b/imageprocess/CMakeLists.txt index 7ff38c24a..e1b697fbb 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/SegmentOARRequest.h + include/alibabacloud/imageprocess/model/SegmentOARResult.h include/alibabacloud/imageprocess/model/TranslateMedRequest.h include/alibabacloud/imageprocess/model/TranslateMedResult.h ) @@ -98,6 +100,8 @@ set(imageprocess_src src/model/RunMedQAResult.cc src/model/ScreenChestCTRequest.cc src/model/ScreenChestCTResult.cc + src/model/SegmentOARRequest.cc + src/model/SegmentOARResult.cc src/model/TranslateMedRequest.cc src/model/TranslateMedResult.cc ) diff --git a/imageprocess/include/alibabacloud/imageprocess/ImageprocessClient.h b/imageprocess/include/alibabacloud/imageprocess/ImageprocessClient.h index 19111ae3d..ef305a77a 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/SegmentOARRequest.h" +#include "model/SegmentOARResult.h" #include "model/TranslateMedRequest.h" #include "model/TranslateMedResult.h" @@ -123,6 +125,9 @@ namespace AlibabaCloud typedef Outcome ScreenChestCTOutcome; typedef std::future ScreenChestCTOutcomeCallable; typedef std::function&)> ScreenChestCTAsyncHandler; + typedef Outcome SegmentOAROutcome; + typedef std::future SegmentOAROutcomeCallable; + typedef std::function&)> SegmentOARAsyncHandler; typedef Outcome TranslateMedOutcome; typedef std::future TranslateMedOutcomeCallable; typedef std::function&)> TranslateMedAsyncHandler; @@ -185,6 +190,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; + 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; TranslateMedOutcome translateMed(const Model::TranslateMedRequest &request)const; void translateMedAsync(const Model::TranslateMedRequest& request, const TranslateMedAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; TranslateMedOutcomeCallable translateMedCallable(const Model::TranslateMedRequest& request) const; diff --git a/imageprocess/include/alibabacloud/imageprocess/model/SegmentOARRequest.h b/imageprocess/include/alibabacloud/imageprocess/model/SegmentOARRequest.h new file mode 100644 index 000000000..b27cacad4 --- /dev/null +++ b/imageprocess/include/alibabacloud/imageprocess/model/SegmentOARRequest.h @@ -0,0 +1,66 @@ +/* + * 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_SEGMENTOARREQUEST_H_ +#define ALIBABACLOUD_IMAGEPROCESS_MODEL_SEGMENTOARREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Imageprocess { +namespace Model { +class ALIBABACLOUD_IMAGEPROCESS_EXPORT SegmentOARRequest : public RpcServiceRequest { +public: + struct URLList { + std::string uRL; + }; + SegmentOARRequest(); + ~SegmentOARRequest(); + std::string getOrgName() const; + void setOrgName(const std::string &orgName); + std::string getBodyPart() const; + void setBodyPart(const std::string &bodyPart); + std::string getDataFormat() const; + void setDataFormat(const std::string &dataFormat); + std::vector getURLList() const; + void setURLList(const std::vector &uRLList); + std::string getOrgId() const; + void setOrgId(const std::string &orgId); + bool getAsync() const; + void setAsync(bool async); + bool getContrast() const; + void setContrast(bool contrast); + std::vector getMaskList() const; + void setMaskList(const std::vector &maskList); + +private: + std::string orgName_; + std::string bodyPart_; + std::string dataFormat_; + std::vector uRLList_; + std::string orgId_; + bool async_; + bool contrast_; + std::vector maskList_; +}; +} // namespace Model +} // namespace Imageprocess +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_IMAGEPROCESS_MODEL_SEGMENTOARREQUEST_H_ diff --git a/imageprocess/include/alibabacloud/imageprocess/model/SegmentOARResult.h b/imageprocess/include/alibabacloud/imageprocess/model/SegmentOARResult.h new file mode 100644 index 000000000..c48295271 --- /dev/null +++ b/imageprocess/include/alibabacloud/imageprocess/model/SegmentOARResult.h @@ -0,0 +1,59 @@ +/* + * 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_SEGMENTOARRESULT_H_ +#define ALIBABACLOUD_IMAGEPROCESS_MODEL_SEGMENTOARRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Imageprocess + { + namespace Model + { + class ALIBABACLOUD_IMAGEPROCESS_EXPORT SegmentOARResult : public ServiceResult + { + public: + struct Data + { + std::string resultURL; + }; + + + SegmentOARResult(); + explicit SegmentOARResult(const std::string &payload); + ~SegmentOARResult(); + 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_SEGMENTOARRESULT_H_ \ No newline at end of file diff --git a/imageprocess/src/ImageprocessClient.cc b/imageprocess/src/ImageprocessClient.cc index 6b59fe65e..a8f7a5769 100644 --- a/imageprocess/src/ImageprocessClient.cc +++ b/imageprocess/src/ImageprocessClient.cc @@ -699,6 +699,42 @@ ImageprocessClient::ScreenChestCTOutcomeCallable ImageprocessClient::screenChest return task->get_future(); } +ImageprocessClient::SegmentOAROutcome ImageprocessClient::segmentOAR(const SegmentOARRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return SegmentOAROutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return SegmentOAROutcome(SegmentOARResult(outcome.result())); + else + return SegmentOAROutcome(outcome.error()); +} + +void ImageprocessClient::segmentOARAsync(const SegmentOARRequest& request, const SegmentOARAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, segmentOAR(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ImageprocessClient::SegmentOAROutcomeCallable ImageprocessClient::segmentOARCallable(const SegmentOARRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->segmentOAR(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + ImageprocessClient::TranslateMedOutcome ImageprocessClient::translateMed(const TranslateMedRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/imageprocess/src/model/SegmentOARRequest.cc b/imageprocess/src/model/SegmentOARRequest.cc new file mode 100644 index 000000000..c152969bb --- /dev/null +++ b/imageprocess/src/model/SegmentOARRequest.cc @@ -0,0 +1,102 @@ +/* + * 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::SegmentOARRequest; + +SegmentOARRequest::SegmentOARRequest() + : RpcServiceRequest("imageprocess", "2020-03-20", "SegmentOAR") { + setMethod(HttpRequest::Method::Post); +} + +SegmentOARRequest::~SegmentOARRequest() {} + +std::string SegmentOARRequest::getOrgName() const { + return orgName_; +} + +void SegmentOARRequest::setOrgName(const std::string &orgName) { + orgName_ = orgName; + setBodyParameter(std::string("OrgName"), orgName); +} + +std::string SegmentOARRequest::getBodyPart() const { + return bodyPart_; +} + +void SegmentOARRequest::setBodyPart(const std::string &bodyPart) { + bodyPart_ = bodyPart; + setBodyParameter(std::string("BodyPart"), bodyPart); +} + +std::string SegmentOARRequest::getDataFormat() const { + return dataFormat_; +} + +void SegmentOARRequest::setDataFormat(const std::string &dataFormat) { + dataFormat_ = dataFormat; + setBodyParameter(std::string("DataFormat"), dataFormat); +} + +std::vector SegmentOARRequest::getURLList() const { + return uRLList_; +} + +void SegmentOARRequest::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); + } +} + +std::string SegmentOARRequest::getOrgId() const { + return orgId_; +} + +void SegmentOARRequest::setOrgId(const std::string &orgId) { + orgId_ = orgId; + setBodyParameter(std::string("OrgId"), orgId); +} + +bool SegmentOARRequest::getAsync() const { + return async_; +} + +void SegmentOARRequest::setAsync(bool async) { + async_ = async; + setBodyParameter(std::string("Async"), async ? "true" : "false"); +} + +bool SegmentOARRequest::getContrast() const { + return contrast_; +} + +void SegmentOARRequest::setContrast(bool contrast) { + contrast_ = contrast; + setBodyParameter(std::string("Contrast"), contrast ? "true" : "false"); +} + +std::vector SegmentOARRequest::getMaskList() const { + return maskList_; +} + +void SegmentOARRequest::setMaskList(const std::vector &maskList) { + maskList_ = maskList; +} + diff --git a/imageprocess/src/model/SegmentOARResult.cc b/imageprocess/src/model/SegmentOARResult.cc new file mode 100644 index 000000000..46b5a76ac --- /dev/null +++ b/imageprocess/src/model/SegmentOARResult.cc @@ -0,0 +1,66 @@ +/* + * 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; + +SegmentOARResult::SegmentOARResult() : + ServiceResult() +{} + +SegmentOARResult::SegmentOARResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +SegmentOARResult::~SegmentOARResult() +{} + +void SegmentOARResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto dataNode = value["Data"]; + if(!dataNode["ResultURL"].isNull()) + data_.resultURL = dataNode["ResultURL"].asString(); + if(!value["Code"].isNull()) + code_ = value["Code"].asString(); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +std::string SegmentOARResult::getMessage()const +{ + return message_; +} + +SegmentOARResult::Data SegmentOARResult::getData()const +{ + return data_; +} + +std::string SegmentOARResult::getCode()const +{ + return code_; +} +