diff --git a/VERSION b/VERSION index 8386e4bc8..c1e1a081f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1521 \ No newline at end of file +1.36.1522 \ No newline at end of file diff --git a/imageprocess/CMakeLists.txt b/imageprocess/CMakeLists.txt index 00f64d7af..3db1eeb26 100644 --- a/imageprocess/CMakeLists.txt +++ b/imageprocess/CMakeLists.txt @@ -23,6 +23,8 @@ set(imageprocess_public_header set(imageprocess_public_header_model include/alibabacloud/imageprocess/model/AnalyzeChestVesselRequest.h include/alibabacloud/imageprocess/model/AnalyzeChestVesselResult.h + include/alibabacloud/imageprocess/model/CalcBMDRequest.h + include/alibabacloud/imageprocess/model/CalcBMDResult.h include/alibabacloud/imageprocess/model/CalcCACSRequest.h include/alibabacloud/imageprocess/model/CalcCACSResult.h include/alibabacloud/imageprocess/model/ClassifyFNFRequest.h @@ -72,6 +74,8 @@ set(imageprocess_src src/ImageprocessClient.cc src/model/AnalyzeChestVesselRequest.cc src/model/AnalyzeChestVesselResult.cc + src/model/CalcBMDRequest.cc + src/model/CalcBMDResult.cc src/model/CalcCACSRequest.cc src/model/CalcCACSResult.cc src/model/ClassifyFNFRequest.cc diff --git a/imageprocess/include/alibabacloud/imageprocess/ImageprocessClient.h b/imageprocess/include/alibabacloud/imageprocess/ImageprocessClient.h index 005482bed..fd94f0d63 100644 --- a/imageprocess/include/alibabacloud/imageprocess/ImageprocessClient.h +++ b/imageprocess/include/alibabacloud/imageprocess/ImageprocessClient.h @@ -24,6 +24,8 @@ #include "ImageprocessExport.h" #include "model/AnalyzeChestVesselRequest.h" #include "model/AnalyzeChestVesselResult.h" +#include "model/CalcBMDRequest.h" +#include "model/CalcBMDResult.h" #include "model/CalcCACSRequest.h" #include "model/CalcCACSResult.h" #include "model/ClassifyFNFRequest.h" @@ -80,6 +82,9 @@ namespace AlibabaCloud typedef Outcome AnalyzeChestVesselOutcome; typedef std::future AnalyzeChestVesselOutcomeCallable; typedef std::function&)> AnalyzeChestVesselAsyncHandler; + typedef Outcome CalcBMDOutcome; + typedef std::future CalcBMDOutcomeCallable; + typedef std::function&)> CalcBMDAsyncHandler; typedef Outcome CalcCACSOutcome; typedef std::future CalcCACSOutcomeCallable; typedef std::function&)> CalcCACSAsyncHandler; @@ -154,6 +159,9 @@ namespace AlibabaCloud AnalyzeChestVesselOutcome analyzeChestVessel(const Model::AnalyzeChestVesselRequest &request)const; void analyzeChestVesselAsync(const Model::AnalyzeChestVesselRequest& request, const AnalyzeChestVesselAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; AnalyzeChestVesselOutcomeCallable analyzeChestVesselCallable(const Model::AnalyzeChestVesselRequest& request) const; + CalcBMDOutcome calcBMD(const Model::CalcBMDRequest &request)const; + void calcBMDAsync(const Model::CalcBMDRequest& request, const CalcBMDAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + CalcBMDOutcomeCallable calcBMDCallable(const Model::CalcBMDRequest& request) const; CalcCACSOutcome calcCACS(const Model::CalcCACSRequest &request)const; void calcCACSAsync(const Model::CalcCACSRequest& request, const CalcCACSAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; CalcCACSOutcomeCallable calcCACSCallable(const Model::CalcCACSRequest& request) const; diff --git a/imageprocess/include/alibabacloud/imageprocess/model/CalcBMDRequest.h b/imageprocess/include/alibabacloud/imageprocess/model/CalcBMDRequest.h new file mode 100644 index 000000000..d7b751d2f --- /dev/null +++ b/imageprocess/include/alibabacloud/imageprocess/model/CalcBMDRequest.h @@ -0,0 +1,60 @@ +/* + * 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_CALCBMDREQUEST_H_ +#define ALIBABACLOUD_IMAGEPROCESS_MODEL_CALCBMDREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Imageprocess { +namespace Model { +class ALIBABACLOUD_IMAGEPROCESS_EXPORT CalcBMDRequest : public RpcServiceRequest { +public: + struct URLList { + std::string uRL; + }; + CalcBMDRequest(); + ~CalcBMDRequest(); + std::string getOrgName() const; + void setOrgName(const std::string &orgName); + std::string getSourceType() const; + void setSourceType(const std::string &sourceType); + 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); + +private: + std::string orgName_; + std::string sourceType_; + std::string dataFormat_; + std::vector uRLList_; + std::string orgId_; + bool async_; +}; +} // namespace Model +} // namespace Imageprocess +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_IMAGEPROCESS_MODEL_CALCBMDREQUEST_H_ diff --git a/imageprocess/include/alibabacloud/imageprocess/model/CalcBMDResult.h b/imageprocess/include/alibabacloud/imageprocess/model/CalcBMDResult.h new file mode 100644 index 000000000..9bb4c8986 --- /dev/null +++ b/imageprocess/include/alibabacloud/imageprocess/model/CalcBMDResult.h @@ -0,0 +1,70 @@ +/* + * 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_CALCBMDRESULT_H_ +#define ALIBABACLOUD_IMAGEPROCESS_MODEL_CALCBMDRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Imageprocess + { + namespace Model + { + class ALIBABACLOUD_IMAGEPROCESS_EXPORT CalcBMDResult : public ServiceResult + { + public: + struct Data + { + struct DetectionsItem + { + float vertZScore; + float vertTScore; + float vertCategory; + float vertBMD; + std::string vertId; + }; + std::vector origin; + std::vector spacing; + std::vector detections; + std::string resultURL; + }; + + + CalcBMDResult(); + explicit CalcBMDResult(const std::string &payload); + ~CalcBMDResult(); + 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_CALCBMDRESULT_H_ \ No newline at end of file diff --git a/imageprocess/src/ImageprocessClient.cc b/imageprocess/src/ImageprocessClient.cc index de395ce3b..573a4ffd2 100644 --- a/imageprocess/src/ImageprocessClient.cc +++ b/imageprocess/src/ImageprocessClient.cc @@ -87,6 +87,42 @@ ImageprocessClient::AnalyzeChestVesselOutcomeCallable ImageprocessClient::analyz return task->get_future(); } +ImageprocessClient::CalcBMDOutcome ImageprocessClient::calcBMD(const CalcBMDRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return CalcBMDOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return CalcBMDOutcome(CalcBMDResult(outcome.result())); + else + return CalcBMDOutcome(outcome.error()); +} + +void ImageprocessClient::calcBMDAsync(const CalcBMDRequest& request, const CalcBMDAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, calcBMD(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ImageprocessClient::CalcBMDOutcomeCallable ImageprocessClient::calcBMDCallable(const CalcBMDRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->calcBMD(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + ImageprocessClient::CalcCACSOutcome ImageprocessClient::calcCACS(const CalcCACSRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/imageprocess/src/model/CalcBMDRequest.cc b/imageprocess/src/model/CalcBMDRequest.cc new file mode 100644 index 000000000..5b6b711e3 --- /dev/null +++ b/imageprocess/src/model/CalcBMDRequest.cc @@ -0,0 +1,85 @@ +/* + * 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::CalcBMDRequest; + +CalcBMDRequest::CalcBMDRequest() + : RpcServiceRequest("imageprocess", "2020-03-20", "CalcBMD") { + setMethod(HttpRequest::Method::Post); +} + +CalcBMDRequest::~CalcBMDRequest() {} + +std::string CalcBMDRequest::getOrgName() const { + return orgName_; +} + +void CalcBMDRequest::setOrgName(const std::string &orgName) { + orgName_ = orgName; + setBodyParameter(std::string("OrgName"), orgName); +} + +std::string CalcBMDRequest::getSourceType() const { + return sourceType_; +} + +void CalcBMDRequest::setSourceType(const std::string &sourceType) { + sourceType_ = sourceType; + setBodyParameter(std::string("SourceType"), sourceType); +} + +std::string CalcBMDRequest::getDataFormat() const { + return dataFormat_; +} + +void CalcBMDRequest::setDataFormat(const std::string &dataFormat) { + dataFormat_ = dataFormat; + setBodyParameter(std::string("DataFormat"), dataFormat); +} + +std::vector CalcBMDRequest::getURLList() const { + return uRLList_; +} + +void CalcBMDRequest::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 CalcBMDRequest::getOrgId() const { + return orgId_; +} + +void CalcBMDRequest::setOrgId(const std::string &orgId) { + orgId_ = orgId; + setBodyParameter(std::string("OrgId"), orgId); +} + +bool CalcBMDRequest::getAsync() const { + return async_; +} + +void CalcBMDRequest::setAsync(bool async) { + async_ = async; + setBodyParameter(std::string("Async"), async ? "true" : "false"); +} + diff --git a/imageprocess/src/model/CalcBMDResult.cc b/imageprocess/src/model/CalcBMDResult.cc new file mode 100644 index 000000000..6421756f4 --- /dev/null +++ b/imageprocess/src/model/CalcBMDResult.cc @@ -0,0 +1,88 @@ +/* + * 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; + +CalcBMDResult::CalcBMDResult() : + ServiceResult() +{} + +CalcBMDResult::CalcBMDResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +CalcBMDResult::~CalcBMDResult() +{} + +void CalcBMDResult::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(); + auto allDetectionsNode = dataNode["Detections"]["DetectionsItem"]; + for (auto dataNodeDetectionsDetectionsItem : allDetectionsNode) + { + Data::DetectionsItem detectionsItemObject; + if(!dataNodeDetectionsDetectionsItem["VertId"].isNull()) + detectionsItemObject.vertId = dataNodeDetectionsDetectionsItem["VertId"].asString(); + if(!dataNodeDetectionsDetectionsItem["VertBMD"].isNull()) + detectionsItemObject.vertBMD = std::stof(dataNodeDetectionsDetectionsItem["VertBMD"].asString()); + if(!dataNodeDetectionsDetectionsItem["VertTScore"].isNull()) + detectionsItemObject.vertTScore = std::stof(dataNodeDetectionsDetectionsItem["VertTScore"].asString()); + if(!dataNodeDetectionsDetectionsItem["VertZScore"].isNull()) + detectionsItemObject.vertZScore = std::stof(dataNodeDetectionsDetectionsItem["VertZScore"].asString()); + if(!dataNodeDetectionsDetectionsItem["VertCategory"].isNull()) + detectionsItemObject.vertCategory = std::stof(dataNodeDetectionsDetectionsItem["VertCategory"].asString()); + data_.detections.push_back(detectionsItemObject); + } + auto allSpacing = dataNode["Spacing"]["Spacing"]; + for (auto value : allSpacing) + data_.spacing.push_back(value.asString()); + auto allOrigin = dataNode["Origin"]["Origin"]; + for (auto value : allOrigin) + data_.origin.push_back(value.asString()); + if(!value["Code"].isNull()) + code_ = value["Code"].asString(); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +std::string CalcBMDResult::getMessage()const +{ + return message_; +} + +CalcBMDResult::Data CalcBMDResult::getData()const +{ + return data_; +} + +std::string CalcBMDResult::getCode()const +{ + return code_; +} +