Mercurial > hg > orthanc
diff OrthancServer/OrthancRestApi/OrthancRestModalities.cpp @ 3370:872bd3b6ec72
"/modalities/{id}/query": New argument "Normalize"
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 14 May 2019 10:30:43 +0200 |
parents | f687e11aeb13 |
children | d0d6bd633e4c |
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp Tue May 14 10:03:11 2019 +0200 +++ b/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp Tue May 14 10:30:43 2019 +0200 @@ -52,6 +52,7 @@ { static const char* const KEY_LEVEL = "Level"; static const char* const KEY_QUERY = "Query"; + static const char* const KEY_NORMALIZE = "Normalize"; static const char* const KEY_RESOURCES = "Resources"; @@ -131,7 +132,7 @@ // Only keep the filters from "fields" that are related to the patient DicomMap s; fields.ExtractPatientInformation(s); - connection.Find(result, ResourceType_Patient, s); + connection.Find(result, ResourceType_Patient, s, true /* normalize */); } @@ -147,7 +148,7 @@ s.CopyTagIfExists(fields, DICOM_TAG_ACCESSION_NUMBER); s.CopyTagIfExists(fields, DICOM_TAG_MODALITIES_IN_STUDY); - connection.Find(result, ResourceType_Study, s); + connection.Find(result, ResourceType_Study, s, true /* normalize */); } static void FindSeries(DicomFindAnswers& result, @@ -162,7 +163,7 @@ s.CopyTagIfExists(fields, DICOM_TAG_ACCESSION_NUMBER); s.CopyTagIfExists(fields, DICOM_TAG_STUDY_INSTANCE_UID); - connection.Find(result, ResourceType_Series, s); + connection.Find(result, ResourceType_Series, s, true /* normalize */); } static void FindInstance(DicomFindAnswers& result, @@ -178,7 +179,7 @@ s.CopyTagIfExists(fields, DICOM_TAG_STUDY_INSTANCE_UID); s.CopyTagIfExists(fields, DICOM_TAG_SERIES_INSTANCE_UID); - connection.Find(result, ResourceType_Instance, s); + connection.Find(result, ResourceType_Instance, s, true /* normalize */); } @@ -453,6 +454,12 @@ throw OrthancException(ErrorCode_BadFileFormat, "The JSON body must contain field " + std::string(KEY_LEVEL)); } + else if (request.isMember(KEY_NORMALIZE) && + request[KEY_NORMALIZE].type() != Json::booleanValue) + { + throw OrthancException(ErrorCode_BadFileFormat, + "The field " + std::string(KEY_NORMALIZE) + " must contain a Boolean"); + } else if (request.isMember(KEY_QUERY) && request[KEY_QUERY].type() != Json::objectValue) { @@ -462,7 +469,7 @@ else { std::auto_ptr<QueryRetrieveHandler> handler(new QueryRetrieveHandler(context)); - + handler->SetModality(call.GetUriComponent("id", "")); handler->SetLevel(StringToResourceType(request[KEY_LEVEL].asCString())); @@ -478,6 +485,11 @@ } } + if (request.isMember(KEY_NORMALIZE)) + { + handler->SetFindNormalized(request[KEY_NORMALIZE].asBool()); + } + AnswerQueryHandler(call, handler); } } @@ -772,6 +784,7 @@ } else { + handler->SetFindNormalized(parent.GetHandler().IsFindNormalized()); handler->SetModality(parent.GetHandler().GetModalitySymbolicName()); handler->SetLevel(CHILDREN_LEVEL);