Mercurial > hg > orthanc
comparison OrthancServer/OrthancRestApi/OrthancRestResources.cpp @ 1172:059391d3f8df db-changes
integration mainline->db-changes
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 22 Sep 2014 13:44:08 +0200 |
parents | 1ea4094d077c a921e3b5e763 |
children | 09aa7c126be9 |
comparison
equal
deleted
inserted
replaced
1162:1ea4094d077c | 1172:059391d3f8df |
---|---|
874 | 874 |
875 call.GetOutput().AnswerJson(result); | 875 call.GetOutput().AnswerJson(result); |
876 } | 876 } |
877 | 877 |
878 | 878 |
879 static void GetChildInstancesTags(RestApiGetCall& call) | |
880 { | |
881 ServerContext& context = OrthancRestApi::GetContext(call); | |
882 std::string publicId = call.GetUriComponent("id", ""); | |
883 bool simplify = call.HasArgument("simplify"); | |
884 | |
885 // Retrieve all the instances of this patient/study/series | |
886 typedef std::list<std::string> Instances; | |
887 Instances instances; | |
888 | |
889 context.GetIndex().GetChildInstances(instances, publicId); // (*) | |
890 | |
891 Json::Value result = Json::arrayValue; | |
892 | |
893 for (Instances::const_iterator it = instances.begin(); | |
894 it != instances.end(); it++) | |
895 { | |
896 Json::Value full; | |
897 context.ReadJson(full, *it); | |
898 | |
899 if (simplify) | |
900 { | |
901 Json::Value simplified; | |
902 SimplifyTags(simplified, full); | |
903 result.append(simplified); | |
904 } | |
905 else | |
906 { | |
907 result.append(full); | |
908 } | |
909 } | |
910 | |
911 call.GetOutput().AnswerJson(result); | |
912 } | |
913 | |
914 | |
879 | 915 |
880 void OrthancRestApi::RegisterResources() | 916 void OrthancRestApi::RegisterResources() |
881 { | 917 { |
882 Register("/instances", ListResources<ResourceType_Instance>); | 918 Register("/instances", ListResources<ResourceType_Instance>); |
883 Register("/patients", ListResources<ResourceType_Patient>); | 919 Register("/patients", ListResources<ResourceType_Patient>); |
952 Register("/patients/{id}/instances", GetChildResources<ResourceType_Patient, ResourceType_Instance>); | 988 Register("/patients/{id}/instances", GetChildResources<ResourceType_Patient, ResourceType_Instance>); |
953 Register("/studies/{id}/series", GetChildResources<ResourceType_Study, ResourceType_Series>); | 989 Register("/studies/{id}/series", GetChildResources<ResourceType_Study, ResourceType_Series>); |
954 Register("/studies/{id}/instances", GetChildResources<ResourceType_Study, ResourceType_Instance>); | 990 Register("/studies/{id}/instances", GetChildResources<ResourceType_Study, ResourceType_Instance>); |
955 Register("/series/{id}/instances", GetChildResources<ResourceType_Series, ResourceType_Instance>); | 991 Register("/series/{id}/instances", GetChildResources<ResourceType_Series, ResourceType_Instance>); |
956 | 992 |
993 Register("/patients/{id}/instances-tags", GetChildInstancesTags); | |
994 Register("/studies/{id}/instances-tags", GetChildInstancesTags); | |
995 Register("/series/{id}/instances-tags", GetChildInstancesTags); | |
996 | |
957 Register("/instances/{id}/content/*", GetRawContent); | 997 Register("/instances/{id}/content/*", GetRawContent); |
958 } | 998 } |
959 } | 999 } |