comparison OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.cpp @ 4184:dbd74fa2f446

Enable the access to raw frames in Philips ELSCINT1 proprietary compression
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 12 Sep 2020 16:03:48 +0200
parents 1a26daefc3fe
children 7112a8af0b63
comparison
equal deleted inserted replaced
4183:32cda90ccf09 4184:dbd74fa2f446
345 { 345 {
346 // The image has no frame. No index is to be built. 346 // The image has no frame. No index is to be built.
347 return; 347 return;
348 } 348 }
349 349
350 // Test whether this image is composed of a sequence of fragments
351 DcmPixelSequence* pixelSequence = FromDcmtkBridge::GetPixelSequence(dicom);
352 if (pixelSequence != NULL)
353 {
354 index_.reset(new FragmentIndex(pixelSequence, countFrames_));
355 return;
356 }
357
358 // Extract information about the image structure 350 // Extract information about the image structure
359 DicomMap tags; 351 DicomMap tags;
360 std::set<DicomTag> ignoreTagLength; 352 std::set<DicomTag> ignoreTagLength;
361 FromDcmtkBridge::ExtractDicomSummary(tags, dicom, DicomImageInformation::USEFUL_TAG_LENGTH, ignoreTagLength); 353 FromDcmtkBridge::ExtractDicomSummary(tags, dicom, DicomImageInformation::USEFUL_TAG_LENGTH, ignoreTagLength);
362 354
363 DicomImageInformation information(tags); 355 DicomImageInformation information(tags);
364 356
365 // Access to the raw pixel data 357 // Test whether this image is composed of a sequence of fragments
366 if (DicomImageDecoder::IsPsmctRle1(dicom)) 358 if (dicom.tagExistsWithValue(DCM_PixelData))
359 {
360 DcmPixelSequence* pixelSequence = FromDcmtkBridge::GetPixelSequence(dicom);
361 if (pixelSequence != NULL)
362 {
363 index_.reset(new FragmentIndex(pixelSequence, countFrames_));
364 }
365 else
366 {
367 // Access to the raw pixel data
368 index_.reset(new UncompressedIndex(dicom, countFrames_, information.GetFrameSize()));
369 }
370 }
371 else if (DicomImageDecoder::IsPsmctRle1(dicom))
367 { 372 {
368 index_.reset(new PsmctRle1Index(dicom, countFrames_, information.GetFrameSize())); 373 index_.reset(new PsmctRle1Index(dicom, countFrames_, information.GetFrameSize()));
369 }
370 else
371 {
372 index_.reset(new UncompressedIndex(dicom, countFrames_, information.GetFrameSize()));
373 } 374 }
374 } 375 }
375 376
376 377
377 void DicomFrameIndex::GetRawFrame(std::string& frame, 378 void DicomFrameIndex::GetRawFrame(std::string& frame,
385 { 386 {
386 return index_->GetRawFrame(frame, index); 387 return index_->GetRawFrame(frame, index);
387 } 388 }
388 else 389 else
389 { 390 {
390 frame.clear(); 391 throw OrthancException(ErrorCode_BadFileFormat, "Cannot access a raw frame");
391 } 392 }
392 } 393 }
393 } 394 }