comparison OrthancServer/OrthancRestApi.cpp @ 302:238134081136

modification of dicom files
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 18 Dec 2012 17:29:30 +0100
parents f13eef8ce651
children c76a35a85c69
comparison
equal deleted inserted replaced
301:be378326f50b 302:238134081136
868 dicom.SendPathValue(call.GetOutput(), call.GetTrailingUri()); 868 dicom.SendPathValue(call.GetOutput(), call.GetTrailingUri());
869 } 869 }
870 870
871 871
872 872
873 // Modification of DICOM tags -----------------------------------------------
874
875 template <enum ResourceType resourceType>
876 static void Modify(RestApi::PostCall& call)
877 {
878 RETRIEVE_CONTEXT(call);
879
880 std::string id = call.GetUriComponent("id", "");
881 ParsedDicomFile& dicom = context.GetDicomFile(id);
882
883 std::auto_ptr<ParsedDicomFile> modified(dicom.Clone());
884
885 modified->InsertOrReplace(DicomTag(0x0010,0x0010), "0.42");
886 modified->Remove(DicomTag(0x0010,0x0020));
887 /*modified->Insert(DicomTag(0x0018,0x9082), "0.42");
888 modified->Replace(DicomTag(0x0010,0x0010), "Hello");*/
889 modified->Answer(call.GetOutput());
890 }
891
892
873 893
874 // Registration of the various REST handlers -------------------------------- 894 // Registration of the various REST handlers --------------------------------
875 895
876 OrthancRestApi::OrthancRestApi(ServerContext& context) : 896 OrthancRestApi::OrthancRestApi(ServerContext& context) :
877 context_(context) 897 context_(context)
924 Register("/modalities/{id}/find-study", DicomFindStudy); 944 Register("/modalities/{id}/find-study", DicomFindStudy);
925 Register("/modalities/{id}/find-series", DicomFindSeries); 945 Register("/modalities/{id}/find-series", DicomFindSeries);
926 Register("/modalities/{id}/find", DicomFind); 946 Register("/modalities/{id}/find", DicomFind);
927 Register("/modalities/{id}/store", DicomStore); 947 Register("/modalities/{id}/store", DicomStore);
928 948
929 // TODO : "content" 949 Register("/instances/{id}/modify", Modify<ResourceType_Instance>);
930 } 950 }
931 } 951 }