comparison OrthancServer/Internals/DicomImageDecoder.cpp @ 1904:4be8accf8768

clarifications
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 05 Jan 2016 14:34:47 +0100
parents 554ec8422ec5
children 8b1baa2315b8
comparison
equal deleted inserted replaced
1903:554ec8422ec5 1904:4be8accf8768
493 493
494 494
495 ImageAccessor* DicomImageDecoder::Decode(ParsedDicomFile& dicom, 495 ImageAccessor* DicomImageDecoder::Decode(ParsedDicomFile& dicom,
496 unsigned int frame) 496 unsigned int frame)
497 { 497 {
498 DcmFileFormat& ff = dicom.GetDcmtkObject(); 498 DcmDataset& dataset = *dicom.GetDcmtkObject().getDataset();
499 DcmDataset& dataset = *ff.getDataset(); 499 E_TransferSyntax syntax = dataset.getOriginalXfer();
500 500
501 /** 501 /**
502 * Deal with uncompressed, raw images. 502 * Deal with uncompressed, raw images.
503 * http://support.dcmtk.org/docs/dcxfer_8h-source.html 503 * http://support.dcmtk.org/docs/dcxfer_8h-source.html
504 **/ 504 **/
505 if (dataset.getOriginalXfer() == EXS_Unknown || 505 if (syntax == EXS_Unknown ||
506 dataset.getOriginalXfer() == EXS_LittleEndianImplicit || 506 syntax == EXS_LittleEndianImplicit ||
507 dataset.getOriginalXfer() == EXS_BigEndianImplicit || 507 syntax == EXS_BigEndianImplicit ||
508 dataset.getOriginalXfer() == EXS_LittleEndianExplicit || 508 syntax == EXS_LittleEndianExplicit ||
509 dataset.getOriginalXfer() == EXS_BigEndianExplicit) 509 syntax == EXS_BigEndianExplicit)
510 { 510 {
511 return DecodeUncompressedImage(dataset, frame); 511 return DecodeUncompressedImage(dataset, frame);
512 } 512 }
513 513
514
514 #if ORTHANC_JPEG_LOSSLESS_ENABLED == 1 515 #if ORTHANC_JPEG_LOSSLESS_ENABLED == 1
515 if (dataset.getOriginalXfer() == EXS_JPEGLSLossless || 516 /**
516 dataset.getOriginalXfer() == EXS_JPEGLSLossy) 517 * Deal with JPEG-LS images.
517 { 518 **/
518 LOG(INFO) << "Decoding a JPEG-LS image"; 519
519 /** 520 if (syntax == EXS_JPEGLSLossless ||
520 * The "DJLSLosslessDecoder" and "DJLSNearLosslessDecoder" in DCMTK 521 syntax == EXS_JPEGLSLossy)
521 * are exactly the same, except for the "supportedTransferSyntax()" 522 {
522 * virtual function. 523 DJLSCodecParameter parameters;
523 * http://support.dcmtk.org/docs/classDJLSDecoderBase.html 524 std::auto_ptr<DJLSDecoderBase> decoder;
524 **/ 525
525 526 switch (syntax)
526 DJLSLosslessDecoder decoder; DJLSCodecParameter parameters; 527 {
527 //DJLSNearLosslessDecoder decoder; DJLSCodecParameter parameters; 528 case EXS_JPEGLSLossless:
528 529 LOG(INFO) << "Decoding a JPEG-LS lossless image";
529 return ApplyCodec(decoder, parameters, dataset, frame); 530 decoder.reset(new DJLSLosslessDecoder);
531 break;
532
533 case EXS_JPEGLSLossy:
534 LOG(INFO) << "Decoding a JPEG-LS near-lossless image";
535 decoder.reset(new DJLSNearLosslessDecoder);
536 break;
537
538 default:
539 throw OrthancException(ErrorCode_InternalError);
540 }
541
542 return ApplyCodec(*decoder, parameters, dataset, frame);
530 } 543 }
531 #endif 544 #endif
532 545
533 546
534 #if ORTHANC_JPEG_ENABLED == 1 547 #if ORTHANC_JPEG_ENABLED == 1
548
535 // TODO Implement this part to speed up JPEG decompression 549 // TODO Implement this part to speed up JPEG decompression
536 #endif 550 #endif
551
552
553 // TODO DcmRLECodecDecoder
554
537 555
538 /** 556 /**
539 * This DICOM image format is not natively supported by 557 * This DICOM image format is not natively supported by
540 * Orthanc. As a last resort, try and decode it through 558 * Orthanc. As a last resort, try and decode it through
541 * DCMTK. This will result in higher memory consumption. This is 559 * DCMTK. This will result in higher memory consumption. This is