comparison OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp @ 5299:c9ea57d73603 am-experimental

New URI /instances/{id}/file-until-pixel-data
author Alain Mazy <am@osimis.io>
date Tue, 23 May 2023 17:38:26 +0200
parents c04230962098
children
comparison
equal deleted inserted replaced
5287:c04230962098 5299:c9ea57d73603
416 { 416 {
417 } 417 }
418 } 418 }
419 419
420 context.AnswerAttachment(call.GetOutput(), publicId, FileContentType_Dicom); 420 context.AnswerAttachment(call.GetOutput(), publicId, FileContentType_Dicom);
421 }
422
423
424 static void GetInstanceFileUntiPixelData(RestApiGetCall& call)
425 {
426 if (call.IsDocumentation())
427 {
428 call.GetDocumentation()
429 .SetTag("Instances")
430 .SetSummary("Download DICOM Header (without the pixel data)")
431 .SetDescription("Download one DICOM instance header")
432 .SetUriArgument("id", "Orthanc identifier of the DICOM instance of interest")
433 .SetHttpHeader("Accept", "This HTTP header can be set to retrieve the DICOM instance in DICOMweb format")
434 .AddAnswerType(MimeType_Dicom, "The DICOM instance");
435 return;
436 }
437
438 ServerContext& context = OrthancRestApi::GetContext(call);
439
440 std::string publicId = call.GetUriComponent("id", "");
441
442 std::string buffer;
443 context.ReadDicomUntilPixelData(buffer, publicId);
444 call.GetOutput().AnswerBuffer(buffer, MimeType_Binary);
421 } 445 }
422 446
423 447
424 static void ExportInstanceFile(RestApiPostCall& call) 448 static void ExportInstanceFile(RestApiPostCall& call)
425 { 449 {
4009 Register("/series/{id}/module", GetModule<ResourceType_Series, DicomModule_Series>); 4033 Register("/series/{id}/module", GetModule<ResourceType_Series, DicomModule_Series>);
4010 Register("/studies/{id}/module", GetModule<ResourceType_Study, DicomModule_Study>); 4034 Register("/studies/{id}/module", GetModule<ResourceType_Study, DicomModule_Study>);
4011 Register("/studies/{id}/module-patient", GetModule<ResourceType_Study, DicomModule_Patient>); 4035 Register("/studies/{id}/module-patient", GetModule<ResourceType_Study, DicomModule_Patient>);
4012 4036
4013 Register("/instances/{id}/file", GetInstanceFile); 4037 Register("/instances/{id}/file", GetInstanceFile);
4038 Register("/instances/{id}/file-until-pixel-data", GetInstanceFileUntiPixelData);
4014 Register("/instances/{id}/export", ExportInstanceFile); 4039 Register("/instances/{id}/export", ExportInstanceFile);
4015 Register("/instances/{id}/tags", GetInstanceTags); 4040 Register("/instances/{id}/tags", GetInstanceTags);
4016 Register("/instances/{id}/simplified-tags", GetInstanceSimplifiedTags); 4041 Register("/instances/{id}/simplified-tags", GetInstanceSimplifiedTags);
4017 Register("/instances/{id}/frames", ListFrames); 4042 Register("/instances/{id}/frames", ListFrames);
4018 4043