Mercurial > hg > orthanc-dicomweb
changeset 174:ac2adc1afd3c
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 29 Nov 2016 13:46:27 +0100 |
parents | 2144ad176183 |
children | 8d306c53f547 |
files | Plugin/Configuration.cpp Plugin/Dicom.cpp Plugin/DicomResults.cpp Plugin/DicomWebClient.cpp Plugin/DicomWebServers.cpp Plugin/Plugin.cpp Plugin/QidoRs.cpp Plugin/WadoRs.cpp Plugin/WadoRsRetrieveFrames.cpp Plugin/WadoUri.cpp |
diffstat | 10 files changed, 82 insertions(+), 88 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugin/Configuration.cpp Tue Nov 29 13:22:28 2016 +0100 +++ b/Plugin/Configuration.cpp Tue Nov 29 13:46:27 2016 +0100 @@ -153,7 +153,7 @@ if (!boost::regex_match(start, end, what, MULTIPART_HEADERS_ENDING, boost::match_perl)) { // Cannot find the HTTP headers of this multipart item - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NetworkProtocol); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } // Some aliases for more clarity @@ -175,7 +175,7 @@ startBody + length != separator[1].first) { // Cannot find the separator after skipping the "Content-Length" bytes - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NetworkProtocol); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } } else @@ -183,7 +183,7 @@ if (!boost::regex_match(startBody, end, separator, nextSeparator, boost::match_perl)) { // No more occurrence of the boundary separator - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NetworkProtocol); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } } @@ -251,7 +251,7 @@ if (value.type() != Json::objectValue) { OrthancPlugins::Configuration::LogError("This is not a JSON object"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadFileFormat); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); } if (!value.isMember(key)) @@ -265,7 +265,7 @@ { OrthancPlugins::Configuration::LogError("The field \"" + key + "\" of a JSON object is " "not a JSON associative array as expected"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadFileFormat); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); } Json::Value::Members names = tmp.getMemberNames(); @@ -276,7 +276,7 @@ { OrthancPlugins::Configuration::LogError("Some value in the associative array \"" + key + "\" is not a string as expected"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadFileFormat); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); } else {
--- a/Plugin/Dicom.cpp Tue Nov 29 13:22:28 2016 +0100 +++ b/Plugin/Dicom.cpp Tue Nov 29 13:46:27 2016 +0100 @@ -176,7 +176,7 @@ { OrthancPlugins::Configuration::LogError("GDCM cannot decode this DICOM instance of length " + boost::lexical_cast<std::string>(dicom.size())); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadFileFormat); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); } } @@ -253,7 +253,7 @@ { if (!GetDataSet().FindDataElement(tag)) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_InexistentTag); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InexistentTag); } const gdcm::DataElement& element = GetDataSet().GetDataElement(tag); @@ -700,7 +700,7 @@ if (key.find('.') != std::string::npos) { OrthancPlugins::Configuration::LogError("This DICOMweb plugin does not support hierarchical queries: " + key); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NotImplemented); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); } if (key.size() == 8 && // This is the DICOMweb convention @@ -740,12 +740,12 @@ if (key.find('.') != std::string::npos) { OrthancPlugins::Configuration::LogError("This QIDO-RS implementation does not support search over sequences: " + key); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NotImplemented); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); } else { OrthancPlugins::Configuration::LogError("Illegal tag name in QIDO-RS: " + key); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_UnknownDicomTag); + throw Orthanc::OrthancException(Orthanc::ErrorCode_UnknownDicomTag); } }
--- a/Plugin/DicomResults.cpp Tue Nov 29 13:22:28 2016 +0100 +++ b/Plugin/DicomResults.cpp Tue Nov 29 13:46:27 2016 +0100 @@ -47,7 +47,7 @@ OrthancPluginStartMultipartAnswer(context_, output_, "related", "application/dicom+xml") != 0) { OrthancPlugins::Configuration::LogError("Unable to create a multipart stream of DICOM+XML answers"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NetworkProtocol); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } jsonWriter_.AddChunk("[\n"); @@ -61,7 +61,7 @@ if (OrthancPluginSendMultipartItem(context_, output_, item.c_str(), item.size()) != 0) { OrthancPlugins::Configuration::LogError("Unable to create a multipart stream of DICOM+XML answers"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NetworkProtocol); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } } else @@ -120,7 +120,7 @@ { if (source.type() != Json::objectValue) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_InternalError); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } Json::Value::Members members = source.getMemberNames(); @@ -133,7 +133,7 @@ !source[members[i]].isMember("Type") || source[members[i]]["Type"].type() != Json::stringValue) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_InternalError); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } const Json::Value& value = source[members[i]]["Value"]; @@ -213,7 +213,7 @@ if (type != "Sequence" || value.type() != Json::arrayValue) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_InternalError); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } node["Value"] = Json::arrayValue; @@ -222,7 +222,7 @@ { if (value[i].type() != Json::objectValue) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_InternalError); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } Json::Value child; @@ -307,14 +307,14 @@ if (type != "Sequence" || value.type() != Json::arrayValue) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_InternalError); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } for (Json::Value::ArrayIndex i = 0; i < value.size(); i++) { if (value[i].type() != Json::objectValue) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_InternalError); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } pugi::xml_node child = node.append_child("Item");
--- a/Plugin/DicomWebClient.cpp Tue Nov 29 13:22:28 2016 +0100 +++ b/Plugin/DicomWebClient.cpp Tue Nov 29 13:46:27 2016 +0100 @@ -39,7 +39,7 @@ !instance.isMember("ID") || instance["ID"].type() != Json::stringValue) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_InternalError); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } else { @@ -72,7 +72,7 @@ { OrthancPlugins::Configuration::LogError("The STOW-RS JSON response from DICOMweb server " + server + " does not contain the mandatory tag " + upper); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NetworkProtocol); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } else { @@ -84,7 +84,7 @@ (*value) ["Value"].type() != Json::arrayValue) { OrthancPlugins::Configuration::LogError("Unable to parse STOW-RS JSON response from DICOMweb server " + server); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NetworkProtocol); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } result = (*value) ["Value"].size(); @@ -112,7 +112,7 @@ OrthancPlugins::Configuration::LogError("A request to the DICOMweb STOW-RS client must provide a JSON object " "with the field \"" + std::string(RESOURCES) + "\" containing an array of resources to be sent"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadFileFormat); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); } OrthancPlugins::ParseAssociativeArray(httpHeaders, body, HTTP_HEADERS); @@ -124,13 +124,13 @@ { if (resources[i].type() != Json::stringValue) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadFileFormat); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); } std::string resource = resources[i].asString(); if (resource.empty()) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_UnknownResource); + throw Orthanc::OrthancException(Orthanc::ErrorCode_UnknownResource); } // Test whether this resource is an instance @@ -149,7 +149,7 @@ { if (tmp.type() != Json::arrayValue) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_InternalError); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } for (Json::Value::ArrayIndex j = 0; j < tmp.size(); j++) @@ -159,7 +159,7 @@ } else { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_UnknownResource); + throw Orthanc::OrthancException(Orthanc::ErrorCode_UnknownResource); } } } @@ -200,7 +200,7 @@ !response.isMember("00081199")) { OrthancPlugins::Configuration::LogError("Unable to parse STOW-RS JSON response from DICOMweb server " + server.GetUrl()); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NetworkProtocol); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } size_t size; @@ -210,7 +210,7 @@ OrthancPlugins::Configuration::LogError("The STOW-RS server was only able to receive " + boost::lexical_cast<std::string>(size) + " instances out of " + boost::lexical_cast<std::string>(countInstances)); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NetworkProtocol); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } if (GetSequenceSize(size, response, "00081198", false, server.GetUrl()) && @@ -219,7 +219,7 @@ OrthancPlugins::Configuration::LogError("The response from the STOW-RS server contains " + boost::lexical_cast<std::string>(size) + " items in its Failed SOP Sequence (0008,1198) tag"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NetworkProtocol); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } if (GetSequenceSize(size, response, "0008119A", false, server.GetUrl()) && @@ -228,7 +228,7 @@ OrthancPlugins::Configuration::LogError("The response from the STOW-RS server contains " + boost::lexical_cast<std::string>(size) + " items in its Other Failures Sequence (0008,119A) tag"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NetworkProtocol); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } countInstances = 0; @@ -244,7 +244,7 @@ if (request->groupsCount != 1) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadRequest); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadRequest); } if (request->method != OrthancPluginHttpMethod_Post) @@ -266,7 +266,7 @@ catch (...) { OrthancPluginFreeString(context, uuid); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NotEnoughMemory); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotEnoughMemory); } OrthancPluginFreeString(context, uuid); @@ -317,7 +317,7 @@ { if (json.type() != Json::objectValue) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadFileFormat); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); } else if (!json.isMember(key)) { @@ -327,7 +327,7 @@ else if (json[key].type() != Json::stringValue) { OrthancPlugins::Configuration::LogError("The field \"" + key + "\" in a JSON object should be a string"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadFileFormat); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); } else { @@ -364,7 +364,7 @@ { OrthancPlugins::Configuration::LogError("A request to the DICOMweb STOW-RS client must provide a JSON object " "with the field \"Uri\" containing the URI of interest"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadFileFormat); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); } std::map<std::string, std::string> getArguments; @@ -426,7 +426,7 @@ { OrthancPlugins::Configuration::LogError("Resources of interest for the DICOMweb WADO-RS Retrieve client " "must be provided as a JSON object"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadFileFormat); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); } std::string study, series, instance; @@ -435,7 +435,7 @@ { OrthancPlugins::Configuration::LogError("A non-empty \"" + STUDY + "\" field is mandatory for the " "DICOMweb WADO-RS Retrieve client"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadFileFormat); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); } GetStringValue(series, resource, SERIES); @@ -446,7 +446,7 @@ { OrthancPlugins::Configuration::LogError("When specifying a \"" + INSTANCE + "\" field in a call to DICOMweb " "WADO-RS Retrieve client, the \"" + SERIES + "\" field is mandatory"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadFileFormat); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); } std::string uri = "studies/" + study; @@ -479,7 +479,7 @@ if (contentType.empty()) { OrthancPlugins::Configuration::LogError("No Content-Type provided by the remote WADO-RS server"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NetworkProtocol); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } Orthanc::Toolbox::ToLowerCase(contentType[0]); @@ -487,7 +487,7 @@ { OrthancPlugins::Configuration::LogError("The remote WADO-RS server answers with a \"" + contentType[0] + "\" Content-Type, but \"" + MULTIPART_RELATED + "\" is expected"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NetworkProtocol); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } std::string type, boundary; @@ -517,13 +517,13 @@ { OrthancPlugins::Configuration::LogError("The remote WADO-RS server answers with a \"" + type + "\" multipart Content-Type, but \"" + APPLICATION_DICOM + "\" is expected"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NetworkProtocol); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } if (boundary.empty()) { OrthancPlugins::Configuration::LogError("The remote WADO-RS server does not provide a boundary for its multipart answer"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NetworkProtocol); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } std::vector<OrthancPlugins::MultipartItem> parts; @@ -540,7 +540,7 @@ if (parts[i].contentType_ != APPLICATION_DICOM) { OrthancPlugins::Configuration::LogError("The remote WADO-RS server has provided a non-DICOM file in its multipart answer"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NetworkProtocol); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } OrthancPlugins::MemoryBuffer tmp(context); @@ -553,7 +553,7 @@ !result.isMember("ID") || result["ID"].type() != Json::stringValue) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_InternalError); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } else { @@ -590,7 +590,7 @@ { OrthancPlugins::Configuration::LogError("A request to the DICOMweb WADO-RS Retrieve client must provide a JSON object " "with the field \"" + RESOURCES + "\" containing an array of resources"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadFileFormat); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); } std::map<std::string, std::string> httpHeaders;
--- a/Plugin/DicomWebServers.cpp Tue Nov 29 13:22:28 2016 +0100 +++ b/Plugin/DicomWebServers.cpp Tue Nov 29 13:46:27 2016 +0100 @@ -71,7 +71,7 @@ if (!ok) { OrthancPlugins::Configuration::LogError("Cannot parse the \"DicomWeb.Servers\" section of the configuration file"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadFileFormat); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); } } @@ -92,7 +92,7 @@ server->second == NULL) { OrthancPlugins::Configuration::LogError("Inexistent server: " + name); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_InexistentItem); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InexistentItem); } else { @@ -206,7 +206,7 @@ { OrthancPlugins::Configuration::LogError("Cannot issue an HTTP query to " + url + " (HTTP status: " + boost::lexical_cast<std::string>(status) + ")"); - throw PluginException(code); + throw Orthanc::OrthancException(static_cast<Orthanc::ErrorCode>(code)); } Json::Value json; @@ -215,7 +215,7 @@ if (json.type() != Json::objectValue) { - throw PluginException(OrthancPluginErrorCode_InternalError); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } Json::Value::Members members = json.getMemberNames(); @@ -225,7 +225,7 @@ if (json[key].type() != Json::stringValue) { - throw PluginException(OrthancPluginErrorCode_InternalError); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } else { @@ -243,7 +243,7 @@ { OrthancPlugins::Configuration::LogError("The GET arguments must be provided in a separate field " "(explicit \"?\" is disallowed): " + resource); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadFileFormat); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); } uri = resource;
--- a/Plugin/Plugin.cpp Tue Nov 29 13:22:28 2016 +0100 +++ b/Plugin/Plugin.cpp Tue Nov 29 13:46:27 2016 +0100 @@ -226,12 +226,6 @@ OrthancPlugins::Configuration::LogWarning("WADO-URI support is disabled"); } } - catch (OrthancPlugins::PluginException& e) - { - OrthancPlugins::Configuration::LogError("Exception while initializing the DICOMweb plugin: " + - std::string(e.GetErrorDescription(context))); - return -1; - } catch (Orthanc::OrthancException& e) { OrthancPlugins::Configuration::LogError("Exception while initializing the DICOMweb plugin: " +
--- a/Plugin/QidoRs.cpp Tue Nov 29 13:22:28 2016 +0100 +++ b/Plugin/QidoRs.cpp Tue Nov 29 13:46:27 2016 +0100 @@ -150,7 +150,7 @@ break; default: - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_InternalError); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } } @@ -188,7 +188,7 @@ else { OrthancPlugins::Configuration::LogError("Not a proper value for fuzzy matching (true or false): " + value); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadRequest); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadRequest); } } else if (key == "includefield") @@ -260,7 +260,7 @@ break; default: - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_InternalError); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } result["Expand"] = false; @@ -510,7 +510,7 @@ if (!OrthancPlugins::RestApiPost(resources, context, "/tools/find", body, false) || resources.type() != Json::arrayValue) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_InternalError); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } typedef std::list< std::pair<std::string, std::string> > ResourcesAndInstances;
--- a/Plugin/WadoRs.cpp Tue Nov 29 13:22:28 2016 +0100 +++ b/Plugin/WadoRs.cpp Tue Nov 29 13:46:27 2016 +0100 @@ -183,7 +183,7 @@ if (OrthancPluginStartMultipartAnswer(context, output, "related", "application/dicom")) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NetworkProtocol); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } for (Json::Value::ArrayIndex i = 0; i < instances.size(); i++) @@ -194,7 +194,7 @@ if (dicom.RestApiGet(uri, false) && OrthancPluginSendMultipartItem(context, output, dicom.GetData(), dicom.GetSize()) != 0) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_InternalError); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } } } @@ -436,14 +436,14 @@ { if (OrthancPluginStartMultipartAnswer(context, output, "related", "application/dicom")) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NetworkProtocol); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } OrthancPlugins::MemoryBuffer dicom(context); if (dicom.RestApiGet(uri + "/file", false) && OrthancPluginSendMultipartItem(context, output, dicom.GetData(), dicom.GetSize()) != 0) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NetworkProtocol); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } } } @@ -612,7 +612,7 @@ if (OrthancPluginStartMultipartAnswer(context, output, "related", "application/octet-stream") != 0 || OrthancPluginSendMultipartItem(context, output, result.c_str(), result.size()) != 0) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_Plugin); + throw Orthanc::OrthancException(Orthanc::ErrorCode_Plugin); } } else
--- a/Plugin/WadoRsRetrieveFrames.cpp Tue Nov 29 13:22:28 2016 +0100 +++ b/Plugin/WadoRsRetrieveFrames.cpp Tue Nov 29 13:46:27 2016 +0100 @@ -68,7 +68,7 @@ if (tokens[0] != "multipart/related") { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_ParameterOutOfRange); + throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); } std::string type("application/octet-stream"); @@ -81,7 +81,7 @@ if (parsed.size() != 2) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadRequest); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadRequest); } if (parsed[0] == "type") @@ -105,7 +105,7 @@ { OrthancPlugins::Configuration::LogError("DICOMweb RetrieveFrames: Cannot specify a transfer syntax (" + transferSyntax + ") for default Little Endian uncompressed pixel data"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadRequest); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadRequest); } } else @@ -164,7 +164,7 @@ { OrthancPlugins::Configuration::LogError("DICOMweb RetrieveFrames: Transfer syntax \"" + transferSyntax + "\" is incompatible with media type \"" + type + "\""); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadRequest); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadRequest); } } } @@ -199,7 +199,7 @@ if (frame <= 0) { OrthancPlugins::Configuration::LogError("Invalid frame number (must be > 0): " + tokens[i]); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_ParameterOutOfRange); + throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); } frames.push_back(static_cast<unsigned int>(frame - 1)); @@ -249,7 +249,7 @@ return "image/dicom+jpx; transfer-syntax=1.2.840.10008.1.2.4.93"; default: - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_InternalError); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } } @@ -275,7 +275,7 @@ if (error != OrthancPluginErrorCode_Success) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NetworkProtocol); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); } } @@ -289,7 +289,7 @@ { if (!dicom.GetDataSet().FindDataElement(OrthancPlugins::DICOM_TAG_PIXEL_DATA)) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_IncompatibleImageFormat); + throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat); } const gdcm::DataElement& pixelData = dicom.GetDataSet().GetDataElement(OrthancPlugins::DICOM_TAG_PIXEL_DATA); @@ -308,7 +308,7 @@ if (pixelData.GetByteValue() == NULL) { OrthancPlugins::Configuration::LogError("Image was not properly decoded"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_InternalError); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } int width, height, bits; @@ -317,14 +317,14 @@ !dicom.GetIntegerTag(width, *dictionary_, OrthancPlugins::DICOM_TAG_COLUMNS) || !dicom.GetIntegerTag(bits, *dictionary_, OrthancPlugins::DICOM_TAG_BITS_ALLOCATED)) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadFileFormat); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); } size_t frameSize = height * width * bits / 8; if (pixelData.GetByteValue()->GetLength() % frameSize != 0) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_InternalError); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } size_t framesCount = pixelData.GetByteValue()->GetLength() / frameSize; @@ -348,7 +348,7 @@ { OrthancPlugins::Configuration::LogError("Trying to access frame number " + boost::lexical_cast<std::string>(*frame + 1) + " of an image with " + boost::lexical_cast<std::string>(framesCount) + " frames"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_ParameterOutOfRange); + throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); } else { @@ -381,7 +381,7 @@ " of an image with " + boost::lexical_cast<std::string>(fragments->GetNumberOfFragments()) + " frames"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_ParameterOutOfRange); + throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); } else { @@ -476,14 +476,14 @@ if (!reader.Read()) { OrthancPlugins::Configuration::LogError("Cannot decode the image"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadFileFormat); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); } change.SetInput(reader.GetImage()); if (!change.Change()) { OrthancPlugins::Configuration::LogError("Cannot change the transfer syntax of the image"); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_InternalError); + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } gdcm::ImageWriter writer; @@ -494,7 +494,7 @@ writer.SetStream(ss); if (!writer.Write()) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_NotEnoughMemory); + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotEnoughMemory); } OrthancPlugins::ParsedDicomFile transcoded(ss.str());
--- a/Plugin/WadoUri.cpp Tue Nov 29 13:22:28 2016 +0100 +++ b/Plugin/WadoUri.cpp Tue Nov 29 13:46:27 2016 +0100 @@ -165,7 +165,7 @@ else { OrthancPlugins::Configuration::LogError("WADO-URI: Unable to retrieve DICOM file from " + uri); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_Plugin); + throw Orthanc::OrthancException(Orthanc::ErrorCode_Plugin); } } @@ -200,7 +200,7 @@ } else { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_Plugin); + throw Orthanc::OrthancException(Orthanc::ErrorCode_Plugin); } } @@ -214,7 +214,7 @@ OrthancPlugins::MemoryBuffer png(context); if (!RetrievePngPreview(png, instance)) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_Plugin); + throw Orthanc::OrthancException(Orthanc::ErrorCode_Plugin); } OrthancPlugins::OrthancImage image(context); @@ -237,7 +237,7 @@ std::string contentType = "image/jpg"; // By default, JPEG image will be returned if (!LocateInstance(instance, contentType, request)) { - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_UnknownResource); + throw Orthanc::OrthancException(Orthanc::ErrorCode_UnknownResource); } if (contentType == "application/dicom") @@ -256,6 +256,6 @@ else { OrthancPlugins::Configuration::LogError("WADO-URI: Unsupported content type: \"" + contentType + "\""); - throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadRequest); + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadRequest); } }