comparison OrthancServer/OrthancRestApi.cpp @ 701:f9052558eada

fix attachment
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 10 Feb 2014 14:30:56 +0100
parents 2929e17f8447
children 7592a48e97e4
comparison
equal deleted inserted replaced
700:0fe6632864b9 701:f9052558eada
2016 LOG(INFO) << "The attachment " << name << " of resource " << publicId << " has bad MD5!"; 2016 LOG(INFO) << "The attachment " << name << " of resource " << publicId << " has bad MD5!";
2017 } 2017 }
2018 } 2018 }
2019 2019
2020 2020
2021 static void UploadAttachment(RestApi::PostCall& call) 2021 static void UploadAttachment(RestApi::PutCall& call)
2022 { 2022 {
2023 RETRIEVE_CONTEXT(call); 2023 RETRIEVE_CONTEXT(call);
2024 CheckValidResourceType(call); 2024 CheckValidResourceType(call);
2025 2025
2026 std::string publicId = call.GetUriComponent("id", ""); 2026 std::string publicId = call.GetUriComponent("id", "");
2027 std::string name = call.GetUriComponent("name", ""); 2027 std::string name = call.GetUriComponent("name", "");
2028 2028
2029 const void* data = call.GetPostBody().size() ? &call.GetPostBody()[0] : NULL; 2029 const void* data = call.GetPutBody().size() ? &call.GetPutBody()[0] : NULL;
2030 2030
2031 if (context.AddAttachment(publicId, StringToContentType(name), data, call.GetPostBody().size())) 2031 if (context.AddAttachment(publicId, StringToContentType(name), data, call.GetPutBody().size()))
2032 { 2032 {
2033 call.GetOutput().AnswerBuffer("{}", "application/json"); 2033 call.GetOutput().AnswerBuffer("{}", "application/json");
2034 } 2034 }
2035 } 2035 }
2036 2036
2073 2073
2074 Register("/instances/{id}/statistics", GetResourceStatistics); 2074 Register("/instances/{id}/statistics", GetResourceStatistics);
2075 Register("/patients/{id}/statistics", GetResourceStatistics); 2075 Register("/patients/{id}/statistics", GetResourceStatistics);
2076 Register("/studies/{id}/statistics", GetResourceStatistics); 2076 Register("/studies/{id}/statistics", GetResourceStatistics);
2077 Register("/series/{id}/statistics", GetResourceStatistics); 2077 Register("/series/{id}/statistics", GetResourceStatistics);
2078
2079 Register("/patients/{id}/protected", IsProtectedPatient);
2080 Register("/patients/{id}/protected", SetPatientProtection);
2081 Register("/instances/{id}/file", GetInstanceFile);
2082 Register("/instances/{id}/export", ExportInstanceFile);
2083 Register("/instances/{id}/tags", GetInstanceTags<false>);
2084 Register("/instances/{id}/simplified-tags", GetInstanceTags<true>);
2085 Register("/instances/{id}/frames", ListFrames);
2086 Register("/instances/{id}/content/*", GetRawContent);
2087
2088 Register("/instances/{id}/frames/{frame}/preview", GetImage<ImageExtractionMode_Preview>);
2089 Register("/instances/{id}/frames/{frame}/image-uint8", GetImage<ImageExtractionMode_UInt8>);
2090 Register("/instances/{id}/frames/{frame}/image-uint16", GetImage<ImageExtractionMode_UInt16>);
2091 Register("/instances/{id}/frames/{frame}/image-int16", GetImage<ImageExtractionMode_Int16>);
2092 Register("/instances/{id}/preview", GetImage<ImageExtractionMode_Preview>);
2093 Register("/instances/{id}/image-uint8", GetImage<ImageExtractionMode_UInt8>);
2094 Register("/instances/{id}/image-uint16", GetImage<ImageExtractionMode_UInt16>);
2095 Register("/instances/{id}/image-int16", GetImage<ImageExtractionMode_Int16>);
2096
2097 Register("/modalities", ListModalities);
2098 Register("/modalities/{id}", ListModalityOperations);
2099 Register("/modalities/{id}/find-patient", DicomFindPatient);
2100 Register("/modalities/{id}/find-study", DicomFindStudy);
2101 Register("/modalities/{id}/find-series", DicomFindSeries);
2102 Register("/modalities/{id}/find-instance", DicomFindInstance);
2103 Register("/modalities/{id}/find", DicomFind);
2104 Register("/modalities/{id}/store", DicomStore);
2105
2106 Register("/peers", ListPeers);
2107 Register("/peers/{id}", ListPeerOperations);
2108 Register("/peers/{id}/store", PeerStore);
2109
2110 Register("/instances/{id}/modify", ModifyInstance);
2111 Register("/series/{id}/modify", ModifySeriesInplace);
2112 Register("/studies/{id}/modify", ModifyStudyInplace);
2113 //Register("/patients/{id}/modify", ModifyPatientInplace);
2114
2115 Register("/instances/{id}/anonymize", AnonymizeInstance);
2116 Register("/series/{id}/anonymize", AnonymizeSeriesInplace);
2117 Register("/studies/{id}/anonymize", AnonymizeStudyInplace);
2118 Register("/patients/{id}/anonymize", AnonymizePatientInplace);
2119
2120 Register("/tools/generate-uid", GenerateUid);
2121 Register("/tools/execute-script", ExecuteScript);
2122 Register("/tools/now", GetNowIsoString);
2078 2123
2079 Register("/{resourceType}/{id}/metadata", ListMetadata); 2124 Register("/{resourceType}/{id}/metadata", ListMetadata);
2080 Register("/{resourceType}/{id}/metadata/{name}", DeleteMetadata); 2125 Register("/{resourceType}/{id}/metadata/{name}", DeleteMetadata);
2081 Register("/{resourceType}/{id}/metadata/{name}", GetMetadata); 2126 Register("/{resourceType}/{id}/metadata/{name}", GetMetadata);
2082 Register("/{resourceType}/{id}/metadata/{name}", SetMetadata); 2127 Register("/{resourceType}/{id}/metadata/{name}", SetMetadata);
2089 Register("/{resourceType}/{id}/attachments/{name}/data", GetAttachmentData<1>); 2134 Register("/{resourceType}/{id}/attachments/{name}/data", GetAttachmentData<1>);
2090 Register("/{resourceType}/{id}/attachments/{name}/md5", GetAttachmentMD5); 2135 Register("/{resourceType}/{id}/attachments/{name}/md5", GetAttachmentMD5);
2091 Register("/{resourceType}/{id}/attachments/{name}/size", GetAttachmentSize); 2136 Register("/{resourceType}/{id}/attachments/{name}/size", GetAttachmentSize);
2092 Register("/{resourceType}/{id}/attachments/{name}/verify-md5", VerifyAttachment); 2137 Register("/{resourceType}/{id}/attachments/{name}/verify-md5", VerifyAttachment);
2093 Register("/{resourceType}/{id}/attachments/{name}", UploadAttachment); 2138 Register("/{resourceType}/{id}/attachments/{name}", UploadAttachment);
2094
2095 Register("/patients/{id}/protected", IsProtectedPatient);
2096 Register("/patients/{id}/protected", SetPatientProtection);
2097 Register("/instances/{id}/file", GetInstanceFile);
2098 Register("/instances/{id}/export", ExportInstanceFile);
2099 Register("/instances/{id}/tags", GetInstanceTags<false>);
2100 Register("/instances/{id}/simplified-tags", GetInstanceTags<true>);
2101 Register("/instances/{id}/frames", ListFrames);
2102 Register("/instances/{id}/content/*", GetRawContent);
2103
2104 Register("/instances/{id}/frames/{frame}/preview", GetImage<ImageExtractionMode_Preview>);
2105 Register("/instances/{id}/frames/{frame}/image-uint8", GetImage<ImageExtractionMode_UInt8>);
2106 Register("/instances/{id}/frames/{frame}/image-uint16", GetImage<ImageExtractionMode_UInt16>);
2107 Register("/instances/{id}/frames/{frame}/image-int16", GetImage<ImageExtractionMode_Int16>);
2108 Register("/instances/{id}/preview", GetImage<ImageExtractionMode_Preview>);
2109 Register("/instances/{id}/image-uint8", GetImage<ImageExtractionMode_UInt8>);
2110 Register("/instances/{id}/image-uint16", GetImage<ImageExtractionMode_UInt16>);
2111 Register("/instances/{id}/image-int16", GetImage<ImageExtractionMode_Int16>);
2112
2113 Register("/modalities", ListModalities);
2114 Register("/modalities/{id}", ListModalityOperations);
2115 Register("/modalities/{id}/find-patient", DicomFindPatient);
2116 Register("/modalities/{id}/find-study", DicomFindStudy);
2117 Register("/modalities/{id}/find-series", DicomFindSeries);
2118 Register("/modalities/{id}/find-instance", DicomFindInstance);
2119 Register("/modalities/{id}/find", DicomFind);
2120 Register("/modalities/{id}/store", DicomStore);
2121
2122 Register("/peers", ListPeers);
2123 Register("/peers/{id}", ListPeerOperations);
2124 Register("/peers/{id}/store", PeerStore);
2125
2126 Register("/instances/{id}/modify", ModifyInstance);
2127 Register("/series/{id}/modify", ModifySeriesInplace);
2128 Register("/studies/{id}/modify", ModifyStudyInplace);
2129 //Register("/patients/{id}/modify", ModifyPatientInplace);
2130
2131 Register("/instances/{id}/anonymize", AnonymizeInstance);
2132 Register("/series/{id}/anonymize", AnonymizeSeriesInplace);
2133 Register("/studies/{id}/anonymize", AnonymizeStudyInplace);
2134 Register("/patients/{id}/anonymize", AnonymizePatientInplace);
2135
2136 Register("/tools/generate-uid", GenerateUid);
2137 Register("/tools/execute-script", ExecuteScript);
2138 Register("/tools/now", GetNowIsoString);
2139 } 2139 }
2140 } 2140 }