Mercurial > hg > orthanc-dicomweb
changeset 450:00a018f4ec05
sharing code in RetrieveDicomInstance()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 22 Jun 2020 14:55:53 +0200 |
parents | 18d87eda1714 |
children | f9abaad46bba |
files | Plugin/WadoRs.cpp Plugin/WadoRsRetrieveFrames.cpp |
diffstat | 2 files changed, 25 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugin/WadoRs.cpp Mon Jun 22 11:06:34 2020 +0200 +++ b/Plugin/WadoRs.cpp Mon Jun 22 14:55:53 2020 +0200 @@ -225,7 +225,8 @@ const std::string& publicId) { if (level != Orthanc::ResourceType_Study && - level != Orthanc::ResourceType_Series) + level != Orthanc::ResourceType_Series && + level != Orthanc::ResourceType_Instance) { throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); } @@ -233,11 +234,23 @@ OrthancPluginContext* context = OrthancPlugins::GetGlobalContext(); Json::Value instances; - if (!OrthancPlugins::RestApiGet(instances, GetResourceUri(level, publicId) + "/instances", false)) + + if (level == Orthanc::ResourceType_Instance) { - // Internal error - OrthancPluginSendHttpStatusCode(context, output, 400); - return; + Json::Value tmp = Json::objectValue; + tmp["ID"] = publicId; + + instances = Json::arrayValue; + instances.append(tmp); + } + else + { + if (!OrthancPlugins::RestApiGet(instances, GetResourceUri(level, publicId) + "/instances", false)) + { + // Internal error + OrthancPluginSendHttpStatusCode(context, output, 400); + return; + } } if (OrthancPluginStartMultipartAnswer(context, output, "related", "application/dicom")) @@ -904,17 +917,7 @@ std::string orthancId, studyInstanceUid, seriesInstanceUid, sopInstanceUid; if (LocateInstance(output, orthancId, studyInstanceUid, seriesInstanceUid, sopInstanceUid, request)) { - if (OrthancPluginStartMultipartAnswer(context, output, "related", "application/dicom")) - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); - } - - OrthancPlugins::MemoryBuffer dicom; - if (dicom.RestApiGet("/instances/" + orthancId + "/file", false) && - OrthancPluginSendMultipartItem(context, output, dicom.GetData(), dicom.GetSize()) != 0) - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); - } + AnswerListOfDicomInstances(output, Orthanc::ResourceType_Instance, orthancId); } } }
--- a/Plugin/WadoRsRetrieveFrames.cpp Mon Jun 22 11:06:34 2020 +0200 +++ b/Plugin/WadoRsRetrieveFrames.cpp Mon Jun 22 14:55:53 2020 +0200 @@ -120,9 +120,14 @@ syntax = Orthanc::DicomTransferSyntax_LittleEndianImplicit; return true; } + else if (transferSyntax == "1.2.840.10008.1.2.2") // New in 1.3 + { + syntax = Orthanc::DicomTransferSyntax_BigEndianExplicit; + return false; + } else if (transferSyntax == "*") { - // New in DICOMweb plugin 1.1.0 + // New in DICOMweb plugin 1.1 return false; } else