Mercurial > hg > orthanc
diff 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 |
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi.cpp Mon Dec 17 16:30:39 2012 +0100 +++ b/OrthancServer/OrthancRestApi.cpp Tue Dec 18 17:29:30 2012 +0100 @@ -870,6 +870,26 @@ + // Modification of DICOM tags ----------------------------------------------- + + template <enum ResourceType resourceType> + static void Modify(RestApi::PostCall& call) + { + RETRIEVE_CONTEXT(call); + + std::string id = call.GetUriComponent("id", ""); + ParsedDicomFile& dicom = context.GetDicomFile(id); + + std::auto_ptr<ParsedDicomFile> modified(dicom.Clone()); + + modified->InsertOrReplace(DicomTag(0x0010,0x0010), "0.42"); + modified->Remove(DicomTag(0x0010,0x0020)); + /*modified->Insert(DicomTag(0x0018,0x9082), "0.42"); + modified->Replace(DicomTag(0x0010,0x0010), "Hello");*/ + modified->Answer(call.GetOutput()); + } + + // Registration of the various REST handlers -------------------------------- @@ -926,6 +946,6 @@ Register("/modalities/{id}/find", DicomFind); Register("/modalities/{id}/store", DicomStore); - // TODO : "content" + Register("/instances/{id}/modify", Modify<ResourceType_Instance>); } }