Mercurial > hg > orthanc
comparison OrthancServer/OrthancRestApi/OrthancRestResources.cpp @ 1826:ac5b0b4e2434
refactoring of DicomImageDecoder
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 25 Nov 2015 16:00:57 +0100 |
parents | b530c3dfe2a6 |
children | 3ae2ff249675 |
comparison
equal
deleted
inserted
replaced
1825:f0f8a94c0858 | 1826:ac5b0b4e2434 |
---|---|
408 | 408 |
409 ParsedDicomFile dicom(dicomContent); | 409 ParsedDicomFile dicom(dicomContent); |
410 | 410 |
411 try | 411 try |
412 { | 412 { |
413 DicomImageDecoder decoder; // TODO plugins | 413 #if ORTHANC_PLUGINS_ENABLED == 1 |
414 IDicomImageDecoder& decoder = context.GetPlugins(); | |
415 #else | |
416 DicomImageDecoder decoder; // This is Orthanc's built-in decoder | |
417 #endif | |
418 | |
414 ImageToEncode image(decoder, dicom, frame, mode); | 419 ImageToEncode image(decoder, dicom, frame, mode); |
415 | 420 |
416 HttpContentNegociation negociation; | 421 HttpContentNegociation negociation; |
417 EncodePng png(image); negociation.Register("image/png", png); | 422 EncodePng png(image); negociation.Register("image/png", png); |
418 EncodeJpeg jpeg(image, call); negociation.Register("image/jpeg", jpeg); | 423 EncodeJpeg jpeg(image, call); negociation.Register("image/jpeg", jpeg); |
461 | 466 |
462 std::string publicId = call.GetUriComponent("id", ""); | 467 std::string publicId = call.GetUriComponent("id", ""); |
463 std::string dicomContent; | 468 std::string dicomContent; |
464 context.ReadFile(dicomContent, publicId, FileContentType_Dicom); | 469 context.ReadFile(dicomContent, publicId, FileContentType_Dicom); |
465 | 470 |
471 #if ORTHANC_PLUGINS_ENABLED == 1 | |
472 IDicomImageDecoder& decoder = context.GetPlugins(); | |
473 #else | |
474 DicomImageDecoder decoder; // This is Orthanc's built-in decoder | |
475 #endif | |
476 | |
466 ParsedDicomFile dicom(dicomContent); | 477 ParsedDicomFile dicom(dicomContent); |
467 ImageBuffer buffer; | 478 std::auto_ptr<ImageAccessor> decoded(dicom.ExtractImage(decoder, frame)); |
468 DicomImageDecoder decoder; // TODO plugin | |
469 dicom.ExtractImage(buffer, decoder, frame); | |
470 | |
471 ImageAccessor accessor(buffer.GetConstAccessor()); | |
472 | 479 |
473 std::string result; | 480 std::string result; |
474 accessor.ToMatlabString(result); | 481 decoded->ToMatlabString(result); |
475 | 482 |
476 call.GetOutput().AnswerBuffer(result, "text/plain"); | 483 call.GetOutput().AnswerBuffer(result, "text/plain"); |
477 } | 484 } |
478 | 485 |
479 | 486 |