comparison OrthancServer/OrthancRestApi.cpp @ 483:8c3573d28868

export dicom instances to the filesystem
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 16 Jul 2013 12:01:39 +0200
parents 7a966b440f19
children b8ace6fc1d1f
comparison
equal deleted inserted replaced
482:b05eb8708aee 483:8c3573d28868
730 { 730 {
731 RETRIEVE_CONTEXT(call); 731 RETRIEVE_CONTEXT(call);
732 732
733 std::string publicId = call.GetUriComponent("id", ""); 733 std::string publicId = call.GetUriComponent("id", "");
734 context.AnswerFile(call.GetOutput(), publicId, FileContentType_Dicom); 734 context.AnswerFile(call.GetOutput(), publicId, FileContentType_Dicom);
735 }
736
737
738 static void ExportInstanceFile(RestApi::PostCall& call)
739 {
740 RETRIEVE_CONTEXT(call);
741
742 std::string publicId = call.GetUriComponent("id", "");
743
744 std::string dicom;
745 context.ReadFile(dicom, publicId, FileContentType_Dicom);
746
747 Toolbox::WriteFile(dicom, call.GetPostBody());
748
749 call.GetOutput().AnswerBuffer("{}", "application/json");
735 } 750 }
736 751
737 752
738 template <bool simplify> 753 template <bool simplify>
739 static void GetInstanceTags(RestApi::GetCall& call) 754 static void GetInstanceTags(RestApi::GetCall& call)
1652 Register("/studies/{id}/metadata/{name}", SetMetadata); 1667 Register("/studies/{id}/metadata/{name}", SetMetadata);
1653 1668
1654 Register("/patients/{id}/protected", IsProtectedPatient); 1669 Register("/patients/{id}/protected", IsProtectedPatient);
1655 Register("/patients/{id}/protected", SetPatientProtection); 1670 Register("/patients/{id}/protected", SetPatientProtection);
1656 Register("/instances/{id}/file", GetInstanceFile); 1671 Register("/instances/{id}/file", GetInstanceFile);
1672 Register("/instances/{id}/export", ExportInstanceFile);
1657 Register("/instances/{id}/tags", GetInstanceTags<false>); 1673 Register("/instances/{id}/tags", GetInstanceTags<false>);
1658 Register("/instances/{id}/simplified-tags", GetInstanceTags<true>); 1674 Register("/instances/{id}/simplified-tags", GetInstanceTags<true>);
1659 Register("/instances/{id}/frames", ListFrames); 1675 Register("/instances/{id}/frames", ListFrames);
1660 Register("/instances/{id}/content/*", GetRawContent); 1676 Register("/instances/{id}/content/*", GetRawContent);
1661 1677