diff --git a/CHANGELOG b/CHANGELOG index 52ce5a128..75eed29a4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2020-12-22 Version: patch +- Release DetectRibFracture. + 2020-12-22 Version: patch - Minor chagnes. diff --git a/imageprocess/CMakeLists.txt b/imageprocess/CMakeLists.txt index fdfd83902..951caed26 100644 --- a/imageprocess/CMakeLists.txt +++ b/imageprocess/CMakeLists.txt @@ -35,6 +35,8 @@ set(imageprocess_public_header_model include/alibabacloud/imageprocess/model/DetectKneeXRayResult.h include/alibabacloud/imageprocess/model/DetectLungNoduleRequest.h include/alibabacloud/imageprocess/model/DetectLungNoduleResult.h + include/alibabacloud/imageprocess/model/DetectRibFractureRequest.h + include/alibabacloud/imageprocess/model/DetectRibFractureResult.h include/alibabacloud/imageprocess/model/DetectSkinDiseaseRequest.h include/alibabacloud/imageprocess/model/DetectSkinDiseaseResult.h include/alibabacloud/imageprocess/model/DetectSpineMRIRequest.h @@ -45,6 +47,8 @@ set(imageprocess_public_header_model include/alibabacloud/imageprocess/model/RunCTRegistrationResult.h include/alibabacloud/imageprocess/model/RunMedQARequest.h include/alibabacloud/imageprocess/model/RunMedQAResult.h + include/alibabacloud/imageprocess/model/ScreenChestCTRequest.h + include/alibabacloud/imageprocess/model/ScreenChestCTResult.h include/alibabacloud/imageprocess/model/TranslateMedRequest.h include/alibabacloud/imageprocess/model/TranslateMedResult.h ) @@ -64,6 +68,8 @@ set(imageprocess_src src/model/DetectKneeXRayResult.cc src/model/DetectLungNoduleRequest.cc src/model/DetectLungNoduleResult.cc + src/model/DetectRibFractureRequest.cc + src/model/DetectRibFractureResult.cc src/model/DetectSkinDiseaseRequest.cc src/model/DetectSkinDiseaseResult.cc src/model/DetectSpineMRIRequest.cc @@ -74,6 +80,8 @@ set(imageprocess_src src/model/RunCTRegistrationResult.cc src/model/RunMedQARequest.cc src/model/RunMedQAResult.cc + src/model/ScreenChestCTRequest.cc + src/model/ScreenChestCTResult.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 07e3e00ea..6027abf7e 100644 --- a/imageprocess/include/alibabacloud/imageprocess/ImageprocessClient.h +++ b/imageprocess/include/alibabacloud/imageprocess/ImageprocessClient.h @@ -36,6 +36,8 @@ #include "model/DetectKneeXRayResult.h" #include "model/DetectLungNoduleRequest.h" #include "model/DetectLungNoduleResult.h" +#include "model/DetectRibFractureRequest.h" +#include "model/DetectRibFractureResult.h" #include "model/DetectSkinDiseaseRequest.h" #include "model/DetectSkinDiseaseResult.h" #include "model/DetectSpineMRIRequest.h" @@ -46,6 +48,8 @@ #include "model/RunCTRegistrationResult.h" #include "model/RunMedQARequest.h" #include "model/RunMedQAResult.h" +#include "model/ScreenChestCTRequest.h" +#include "model/ScreenChestCTResult.h" #include "model/TranslateMedRequest.h" #include "model/TranslateMedResult.h" @@ -78,6 +82,9 @@ namespace AlibabaCloud typedef Outcome DetectLungNoduleOutcome; typedef std::future DetectLungNoduleOutcomeCallable; typedef std::function&)> DetectLungNoduleAsyncHandler; + typedef Outcome DetectRibFractureOutcome; + typedef std::future DetectRibFractureOutcomeCallable; + typedef std::function&)> DetectRibFractureAsyncHandler; typedef Outcome DetectSkinDiseaseOutcome; typedef std::future DetectSkinDiseaseOutcomeCallable; typedef std::function&)> DetectSkinDiseaseAsyncHandler; @@ -93,6 +100,9 @@ namespace AlibabaCloud typedef Outcome RunMedQAOutcome; typedef std::future RunMedQAOutcomeCallable; typedef std::function&)> RunMedQAAsyncHandler; + typedef Outcome ScreenChestCTOutcome; + typedef std::future ScreenChestCTOutcomeCallable; + typedef std::function&)> ScreenChestCTAsyncHandler; typedef Outcome TranslateMedOutcome; typedef std::future TranslateMedOutcomeCallable; typedef std::function&)> TranslateMedAsyncHandler; @@ -122,6 +132,9 @@ namespace AlibabaCloud DetectLungNoduleOutcome detectLungNodule(const Model::DetectLungNoduleRequest &request)const; void detectLungNoduleAsync(const Model::DetectLungNoduleRequest& request, const DetectLungNoduleAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DetectLungNoduleOutcomeCallable detectLungNoduleCallable(const Model::DetectLungNoduleRequest& request) const; + DetectRibFractureOutcome detectRibFracture(const Model::DetectRibFractureRequest &request)const; + void detectRibFractureAsync(const Model::DetectRibFractureRequest& request, const DetectRibFractureAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + DetectRibFractureOutcomeCallable detectRibFractureCallable(const Model::DetectRibFractureRequest& request) const; DetectSkinDiseaseOutcome detectSkinDisease(const Model::DetectSkinDiseaseRequest &request)const; void detectSkinDiseaseAsync(const Model::DetectSkinDiseaseRequest& request, const DetectSkinDiseaseAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DetectSkinDiseaseOutcomeCallable detectSkinDiseaseCallable(const Model::DetectSkinDiseaseRequest& request) const; @@ -137,6 +150,9 @@ namespace AlibabaCloud RunMedQAOutcome runMedQA(const Model::RunMedQARequest &request)const; void runMedQAAsync(const Model::RunMedQARequest& request, const RunMedQAAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; RunMedQAOutcomeCallable runMedQACallable(const Model::RunMedQARequest& request) const; + 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; 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/DetectRibFractureRequest.h b/imageprocess/include/alibabacloud/imageprocess/model/DetectRibFractureRequest.h new file mode 100644 index 000000000..0fba36892 --- /dev/null +++ b/imageprocess/include/alibabacloud/imageprocess/model/DetectRibFractureRequest.h @@ -0,0 +1,68 @@ +/* + * 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_DETECTRIBFRACTUREREQUEST_H_ +#define ALIBABACLOUD_IMAGEPROCESS_MODEL_DETECTRIBFRACTUREREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Imageprocess + { + namespace Model + { + class ALIBABACLOUD_IMAGEPROCESS_EXPORT DetectRibFractureRequest : public RpcServiceRequest + { + public: + struct URLList + { + std::string uRL; + }; + + public: + DetectRibFractureRequest(); + ~DetectRibFractureRequest(); + + 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); + std::string getOrgName()const; + void setOrgName(const std::string& orgName); + std::string getSourceType()const; + void setSourceType(const std::string& sourceType); + + private: + std::string dataFormat_; + std::vector uRLList_; + std::string orgId_; + bool async_; + std::string orgName_; + std::string sourceType_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IMAGEPROCESS_MODEL_DETECTRIBFRACTUREREQUEST_H_ \ No newline at end of file diff --git a/imageprocess/include/alibabacloud/imageprocess/model/DetectRibFractureResult.h b/imageprocess/include/alibabacloud/imageprocess/model/DetectRibFractureResult.h new file mode 100644 index 000000000..82c98a884 --- /dev/null +++ b/imageprocess/include/alibabacloud/imageprocess/model/DetectRibFractureResult.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_DETECTRIBFRACTURERESULT_H_ +#define ALIBABACLOUD_IMAGEPROCESS_MODEL_DETECTRIBFRACTURERESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Imageprocess + { + namespace Model + { + class ALIBABACLOUD_IMAGEPROCESS_EXPORT DetectRibFractureResult : public ServiceResult + { + public: + struct Data + { + struct DetectionsItem + { + float fractureConfidence; + std::string fractureCategory; + std::vector coordinateImage; + std::vector coordinates; + int fractureId; + }; + std::vector origin; + std::vector spacing; + std::vector detections; + std::string resultURL; + }; + + + DetectRibFractureResult(); + explicit DetectRibFractureResult(const std::string &payload); + ~DetectRibFractureResult(); + Data getData()const; + + protected: + void parse(const std::string &payload); + private: + Data data_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IMAGEPROCESS_MODEL_DETECTRIBFRACTURERESULT_H_ \ No newline at end of file diff --git a/imageprocess/include/alibabacloud/imageprocess/model/ScreenChestCTRequest.h b/imageprocess/include/alibabacloud/imageprocess/model/ScreenChestCTRequest.h new file mode 100644 index 000000000..8c08cc179 --- /dev/null +++ b/imageprocess/include/alibabacloud/imageprocess/model/ScreenChestCTRequest.h @@ -0,0 +1,65 @@ +/* + * 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_SCREENCHESTCTREQUEST_H_ +#define ALIBABACLOUD_IMAGEPROCESS_MODEL_SCREENCHESTCTREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Imageprocess + { + namespace Model + { + class ALIBABACLOUD_IMAGEPROCESS_EXPORT ScreenChestCTRequest : public RpcServiceRequest + { + public: + struct URLList + { + std::string uRL; + }; + + public: + ScreenChestCTRequest(); + ~ScreenChestCTRequest(); + + 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); + std::string getOrgName()const; + void setOrgName(const std::string& orgName); + + private: + std::string dataFormat_; + std::vector uRLList_; + std::string orgId_; + bool async_; + std::string orgName_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IMAGEPROCESS_MODEL_SCREENCHESTCTREQUEST_H_ \ No newline at end of file diff --git a/imageprocess/include/alibabacloud/imageprocess/model/ScreenChestCTResult.h b/imageprocess/include/alibabacloud/imageprocess/model/ScreenChestCTResult.h new file mode 100644 index 000000000..0f6727e70 --- /dev/null +++ b/imageprocess/include/alibabacloud/imageprocess/model/ScreenChestCTResult.h @@ -0,0 +1,99 @@ +/* + * 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_SCREENCHESTCTRESULT_H_ +#define ALIBABACLOUD_IMAGEPROCESS_MODEL_SCREENCHESTCTRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Imageprocess + { + namespace Model + { + class ALIBABACLOUD_IMAGEPROCESS_EXPORT ScreenChestCTResult : public ServiceResult + { + public: + struct Data + { + struct LungNodule + { + struct Serie + { + struct Element + { + float imageZ; + float imageY; + std::string lobe; + float imageX; + std::string category; + std::string lung; + float meanValue; + float confidence; + float volume; + float x; + float y; + float z; + std::string sOPInstanceUID; + float diameter; + }; + std::vector origin; + std::string report; + std::vector spacing; + std::vector elements; + std::string seriesInstanceUid; + }; + std::vector series; + }; + struct CACS + { + std::string score; + std::string resultUrl; + }; + struct Covid + { + std::string newProbability; + std::string otherProbability; + std::string normalProbability; + std::string mask; + std::string lesionRatio; + }; + LungNodule lungNodule; + CACS cACS; + Covid covid; + }; + + + ScreenChestCTResult(); + explicit ScreenChestCTResult(const std::string &payload); + ~ScreenChestCTResult(); + Data getData()const; + + protected: + void parse(const std::string &payload); + private: + Data data_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IMAGEPROCESS_MODEL_SCREENCHESTCTRESULT_H_ \ No newline at end of file diff --git a/imageprocess/src/ImageprocessClient.cc b/imageprocess/src/ImageprocessClient.cc index 610280ab6..d0ff8d600 100644 --- a/imageprocess/src/ImageprocessClient.cc +++ b/imageprocess/src/ImageprocessClient.cc @@ -303,6 +303,42 @@ ImageprocessClient::DetectLungNoduleOutcomeCallable ImageprocessClient::detectLu return task->get_future(); } +ImageprocessClient::DetectRibFractureOutcome ImageprocessClient::detectRibFracture(const DetectRibFractureRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DetectRibFractureOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DetectRibFractureOutcome(DetectRibFractureResult(outcome.result())); + else + return DetectRibFractureOutcome(outcome.error()); +} + +void ImageprocessClient::detectRibFractureAsync(const DetectRibFractureRequest& request, const DetectRibFractureAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, detectRibFracture(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ImageprocessClient::DetectRibFractureOutcomeCallable ImageprocessClient::detectRibFractureCallable(const DetectRibFractureRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->detectRibFracture(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + ImageprocessClient::DetectSkinDiseaseOutcome ImageprocessClient::detectSkinDisease(const DetectSkinDiseaseRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); @@ -483,6 +519,42 @@ ImageprocessClient::RunMedQAOutcomeCallable ImageprocessClient::runMedQACallable return task->get_future(); } +ImageprocessClient::ScreenChestCTOutcome ImageprocessClient::screenChestCT(const ScreenChestCTRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return ScreenChestCTOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ScreenChestCTOutcome(ScreenChestCTResult(outcome.result())); + else + return ScreenChestCTOutcome(outcome.error()); +} + +void ImageprocessClient::screenChestCTAsync(const ScreenChestCTRequest& request, const ScreenChestCTAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, screenChestCT(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ImageprocessClient::ScreenChestCTOutcomeCallable ImageprocessClient::screenChestCTCallable(const ScreenChestCTRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->screenChestCT(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/DetectRibFractureRequest.cc b/imageprocess/src/model/DetectRibFractureRequest.cc new file mode 100644 index 000000000..2445c5006 --- /dev/null +++ b/imageprocess/src/model/DetectRibFractureRequest.cc @@ -0,0 +1,99 @@ +/* + * 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::DetectRibFractureRequest; + +DetectRibFractureRequest::DetectRibFractureRequest() : + RpcServiceRequest("imageprocess", "2020-03-20", "DetectRibFracture") +{ + setMethod(HttpRequest::Method::Post); +} + +DetectRibFractureRequest::~DetectRibFractureRequest() +{} + +std::string DetectRibFractureRequest::getDataFormat()const +{ + return dataFormat_; +} + +void DetectRibFractureRequest::setDataFormat(const std::string& dataFormat) +{ + dataFormat_ = dataFormat; + setBodyParameter("DataFormat", dataFormat); +} + +std::vector DetectRibFractureRequest::getURLList()const +{ + return uRLList_; +} + +void DetectRibFractureRequest::setURLList(const std::vector& uRLList) +{ + uRLList_ = uRLList; + for(int dep1 = 0; dep1!= uRLList.size(); dep1++) { + auto uRLListObj = uRLList.at(dep1); + std::string uRLListObjStr = "URLList." + std::to_string(dep1 + 1); + setParameter(uRLListObjStr + ".URL", uRLListObj.uRL); + } +} + +std::string DetectRibFractureRequest::getOrgId()const +{ + return orgId_; +} + +void DetectRibFractureRequest::setOrgId(const std::string& orgId) +{ + orgId_ = orgId; + setBodyParameter("OrgId", orgId); +} + +bool DetectRibFractureRequest::getAsync()const +{ + return async_; +} + +void DetectRibFractureRequest::setAsync(bool async) +{ + async_ = async; + setBodyParameter("Async", async ? "true" : "false"); +} + +std::string DetectRibFractureRequest::getOrgName()const +{ + return orgName_; +} + +void DetectRibFractureRequest::setOrgName(const std::string& orgName) +{ + orgName_ = orgName; + setBodyParameter("OrgName", orgName); +} + +std::string DetectRibFractureRequest::getSourceType()const +{ + return sourceType_; +} + +void DetectRibFractureRequest::setSourceType(const std::string& sourceType) +{ + sourceType_ = sourceType; + setBodyParameter("SourceType", sourceType); +} + diff --git a/imageprocess/src/model/DetectRibFractureResult.cc b/imageprocess/src/model/DetectRibFractureResult.cc new file mode 100644 index 000000000..87140f772 --- /dev/null +++ b/imageprocess/src/model/DetectRibFractureResult.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; + +DetectRibFractureResult::DetectRibFractureResult() : + ServiceResult() +{} + +DetectRibFractureResult::DetectRibFractureResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +DetectRibFractureResult::~DetectRibFractureResult() +{} + +void DetectRibFractureResult::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["FractureId"].isNull()) + detectionsItemObject.fractureId = std::stoi(dataNodeDetectionsDetectionsItem["FractureId"].asString()); + if(!dataNodeDetectionsDetectionsItem["FractureConfidence"].isNull()) + detectionsItemObject.fractureConfidence = std::stof(dataNodeDetectionsDetectionsItem["FractureConfidence"].asString()); + if(!dataNodeDetectionsDetectionsItem["FractureCategory"].isNull()) + detectionsItemObject.fractureCategory = dataNodeDetectionsDetectionsItem["FractureCategory"].asString(); + auto allCoordinates = value["Coordinates"]["Coordinates"]; + for (auto value : allCoordinates) + detectionsItemObject.coordinates.push_back(value.asString()); + auto allCoordinateImage = value["CoordinateImage"]["CoordinateImage"]; + for (auto value : allCoordinateImage) + detectionsItemObject.coordinateImage.push_back(value.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()); + +} + +DetectRibFractureResult::Data DetectRibFractureResult::getData()const +{ + return data_; +} + diff --git a/imageprocess/src/model/ScreenChestCTRequest.cc b/imageprocess/src/model/ScreenChestCTRequest.cc new file mode 100644 index 000000000..c3507938a --- /dev/null +++ b/imageprocess/src/model/ScreenChestCTRequest.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 + +using AlibabaCloud::Imageprocess::Model::ScreenChestCTRequest; + +ScreenChestCTRequest::ScreenChestCTRequest() : + RpcServiceRequest("imageprocess", "2020-03-20", "ScreenChestCT") +{ + setMethod(HttpRequest::Method::Post); +} + +ScreenChestCTRequest::~ScreenChestCTRequest() +{} + +std::string ScreenChestCTRequest::getDataFormat()const +{ + return dataFormat_; +} + +void ScreenChestCTRequest::setDataFormat(const std::string& dataFormat) +{ + dataFormat_ = dataFormat; + setBodyParameter("DataFormat", dataFormat); +} + +std::vector ScreenChestCTRequest::getURLList()const +{ + return uRLList_; +} + +void ScreenChestCTRequest::setURLList(const std::vector& uRLList) +{ + uRLList_ = uRLList; + for(int dep1 = 0; dep1!= uRLList.size(); dep1++) { + auto uRLListObj = uRLList.at(dep1); + std::string uRLListObjStr = "URLList." + std::to_string(dep1 + 1); + setParameter(uRLListObjStr + ".URL", uRLListObj.uRL); + } +} + +std::string ScreenChestCTRequest::getOrgId()const +{ + return orgId_; +} + +void ScreenChestCTRequest::setOrgId(const std::string& orgId) +{ + orgId_ = orgId; + setBodyParameter("OrgId", orgId); +} + +bool ScreenChestCTRequest::getAsync()const +{ + return async_; +} + +void ScreenChestCTRequest::setAsync(bool async) +{ + async_ = async; + setBodyParameter("Async", async ? "true" : "false"); +} + +std::string ScreenChestCTRequest::getOrgName()const +{ + return orgName_; +} + +void ScreenChestCTRequest::setOrgName(const std::string& orgName) +{ + orgName_ = orgName; + setBodyParameter("OrgName", orgName); +} + diff --git a/imageprocess/src/model/ScreenChestCTResult.cc b/imageprocess/src/model/ScreenChestCTResult.cc new file mode 100644 index 000000000..a39146b92 --- /dev/null +++ b/imageprocess/src/model/ScreenChestCTResult.cc @@ -0,0 +1,117 @@ +/* + * 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; + +ScreenChestCTResult::ScreenChestCTResult() : + ServiceResult() +{} + +ScreenChestCTResult::ScreenChestCTResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +ScreenChestCTResult::~ScreenChestCTResult() +{} + +void ScreenChestCTResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto dataNode = value["Data"]; + auto lungNoduleNode = dataNode["LungNodule"]; + auto allSeriesNode = lungNoduleNode["Series"]["Serie"]; + for (auto lungNoduleNodeSeriesSerie : allSeriesNode) + { + Data::LungNodule::Serie serieObject; + if(!lungNoduleNodeSeriesSerie["SeriesInstanceUid"].isNull()) + serieObject.seriesInstanceUid = lungNoduleNodeSeriesSerie["SeriesInstanceUid"].asString(); + if(!lungNoduleNodeSeriesSerie["Report"].isNull()) + serieObject.report = lungNoduleNodeSeriesSerie["Report"].asString(); + auto allElementsNode = lungNoduleNodeSeriesSerie["Elements"]["Element"]; + for (auto lungNoduleNodeSeriesSerieElementsElement : allElementsNode) + { + Data::LungNodule::Serie::Element elementsObject; + if(!lungNoduleNodeSeriesSerieElementsElement["Category"].isNull()) + elementsObject.category = lungNoduleNodeSeriesSerieElementsElement["Category"].asString(); + if(!lungNoduleNodeSeriesSerieElementsElement["Confidence"].isNull()) + elementsObject.confidence = std::stof(lungNoduleNodeSeriesSerieElementsElement["Confidence"].asString()); + if(!lungNoduleNodeSeriesSerieElementsElement["Diameter"].isNull()) + elementsObject.diameter = std::stof(lungNoduleNodeSeriesSerieElementsElement["Diameter"].asString()); + if(!lungNoduleNodeSeriesSerieElementsElement["Lobe"].isNull()) + elementsObject.lobe = lungNoduleNodeSeriesSerieElementsElement["Lobe"].asString(); + if(!lungNoduleNodeSeriesSerieElementsElement["Lung"].isNull()) + elementsObject.lung = lungNoduleNodeSeriesSerieElementsElement["Lung"].asString(); + if(!lungNoduleNodeSeriesSerieElementsElement["X"].isNull()) + elementsObject.x = std::stof(lungNoduleNodeSeriesSerieElementsElement["X"].asString()); + if(!lungNoduleNodeSeriesSerieElementsElement["Z"].isNull()) + elementsObject.z = std::stof(lungNoduleNodeSeriesSerieElementsElement["Z"].asString()); + if(!lungNoduleNodeSeriesSerieElementsElement["Y"].isNull()) + elementsObject.y = std::stof(lungNoduleNodeSeriesSerieElementsElement["Y"].asString()); + if(!lungNoduleNodeSeriesSerieElementsElement["ImageX"].isNull()) + elementsObject.imageX = std::stof(lungNoduleNodeSeriesSerieElementsElement["ImageX"].asString()); + if(!lungNoduleNodeSeriesSerieElementsElement["ImageY"].isNull()) + elementsObject.imageY = std::stof(lungNoduleNodeSeriesSerieElementsElement["ImageY"].asString()); + if(!lungNoduleNodeSeriesSerieElementsElement["ImageZ"].isNull()) + elementsObject.imageZ = std::stof(lungNoduleNodeSeriesSerieElementsElement["ImageZ"].asString()); + if(!lungNoduleNodeSeriesSerieElementsElement["SOPInstanceUID"].isNull()) + elementsObject.sOPInstanceUID = lungNoduleNodeSeriesSerieElementsElement["SOPInstanceUID"].asString(); + if(!lungNoduleNodeSeriesSerieElementsElement["Volume"].isNull()) + elementsObject.volume = std::stof(lungNoduleNodeSeriesSerieElementsElement["Volume"].asString()); + if(!lungNoduleNodeSeriesSerieElementsElement["MeanValue"].isNull()) + elementsObject.meanValue = std::stof(lungNoduleNodeSeriesSerieElementsElement["MeanValue"].asString()); + serieObject.elements.push_back(elementsObject); + } + auto allOrigin = value["Origin"]["Origin"]; + for (auto value : allOrigin) + serieObject.origin.push_back(value.asString()); + auto allSpacing = value["Spacing"]["Spacing"]; + for (auto value : allSpacing) + serieObject.spacing.push_back(value.asString()); + data_.lungNodule.series.push_back(serieObject); + } + auto cACSNode = dataNode["CACS"]; + if(!cACSNode["Score"].isNull()) + data_.cACS.score = cACSNode["Score"].asString(); + if(!cACSNode["ResultUrl"].isNull()) + data_.cACS.resultUrl = cACSNode["ResultUrl"].asString(); + auto covidNode = dataNode["Covid"]; + if(!covidNode["NewProbability"].isNull()) + data_.covid.newProbability = covidNode["NewProbability"].asString(); + if(!covidNode["NormalProbability"].isNull()) + data_.covid.normalProbability = covidNode["NormalProbability"].asString(); + if(!covidNode["OtherProbability"].isNull()) + data_.covid.otherProbability = covidNode["OtherProbability"].asString(); + if(!covidNode["LesionRatio"].isNull()) + data_.covid.lesionRatio = covidNode["LesionRatio"].asString(); + if(!covidNode["Mask"].isNull()) + data_.covid.mask = covidNode["Mask"].asString(); + +} + +ScreenChestCTResult::Data ScreenChestCTResult::getData()const +{ + return data_; +} +