Mercurial > hg > orthanc
comparison OrthancServer/Internals/DicomFrameIndex.cpp @ 1956:fc16ee04e71b
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 06 Apr 2016 14:22:48 +0200 |
parents | 01de36d949c3 |
children | b10a165e0e36 |
comparison
equal
deleted
inserted
replaced
1955:ed77a9aea3f6 | 1956:fc16ee04e71b |
---|---|
317 } | 317 } |
318 }; | 318 }; |
319 | 319 |
320 | 320 |
321 | 321 |
322 bool DicomFrameIndex::IsVideo(const DcmDataset& dataset) | 322 bool DicomFrameIndex::IsVideo(DcmFileFormat& dicom) |
323 { | 323 { |
324 if (dataset.getOriginalXfer() == EXS_MPEG2MainProfileAtMainLevel || | 324 if (dicom.getDataset()->getOriginalXfer() == EXS_MPEG2MainProfileAtMainLevel || |
325 dataset.getOriginalXfer() == EXS_MPEG2MainProfileAtHighLevel) | 325 dicom.getDataset()->getOriginalXfer() == EXS_MPEG2MainProfileAtHighLevel) |
326 { | 326 { |
327 return true; | 327 return true; |
328 } | 328 } |
329 | 329 |
330 #if DCMTK_VERSION_NUMBER > 360 | 330 #if DCMTK_VERSION_NUMBER > 360 |
331 // New transfer syntaxes introduced in the DICOM standard after DCMTK 3.6.0 | 331 // New transfer syntaxes introduced in the DICOM standard after DCMTK 3.6.0 |
332 if (dataset.getOriginalXfer() == EXS_MPEG4HighProfileLevel4_1 || | 332 if (dicom.getDataset()->getOriginalXfer() == EXS_MPEG4HighProfileLevel4_1 || |
333 dataset.getOriginalXfer() == EXS_MPEG4BDcompatibleHighProfileLevel4_1 || | 333 dicom.getDataset()->getOriginalXfer() == EXS_MPEG4BDcompatibleHighProfileLevel4_1 || |
334 dataset.getOriginalXfer() == EXS_MPEG4HighProfileLevel4_2_For2DVideo || | 334 dicom.getDataset()->getOriginalXfer() == EXS_MPEG4HighProfileLevel4_2_For2DVideo || |
335 dataset.getOriginalXfer() == EXS_MPEG4HighProfileLevel4_2_For3DVideo || | 335 dicom.getDataset()->getOriginalXfer() == EXS_MPEG4HighProfileLevel4_2_For3DVideo || |
336 dataset.getOriginalXfer() == EXS_MPEG4StereoHighProfileLevel4_2) | 336 dicom.getDataset()->getOriginalXfer() == EXS_MPEG4StereoHighProfileLevel4_2) |
337 { | 337 { |
338 return true; | 338 return true; |
339 } | 339 } |
340 #endif | 340 #endif |
341 | 341 |
342 return false; | 342 return false; |
343 } | 343 } |
344 | 344 |
345 | 345 |
346 unsigned int DicomFrameIndex::GetFramesCount(DcmDataset& dataset) | 346 unsigned int DicomFrameIndex::GetFramesCount(DcmFileFormat& dicom) |
347 { | 347 { |
348 // Assume 1 frame for video transfer syntaxes | 348 // Assume 1 frame for video transfer syntaxes |
349 if (IsVideo(dataset)) | 349 if (IsVideo(dicom)) |
350 { | 350 { |
351 return 1; | 351 return 1; |
352 } | 352 } |
353 | 353 |
354 const char* tmp = NULL; | 354 const char* tmp = NULL; |
355 if (!dataset.findAndGetString(DCM_NumberOfFrames, tmp).good() || | 355 if (!dicom.getDataset()->findAndGetString(DCM_NumberOfFrames, tmp).good() || |
356 tmp == NULL) | 356 tmp == NULL) |
357 { | 357 { |
358 return 1; | 358 return 1; |
359 } | 359 } |
360 | 360 |
376 return count; | 376 return count; |
377 } | 377 } |
378 } | 378 } |
379 | 379 |
380 | 380 |
381 DicomFrameIndex::DicomFrameIndex(DcmDataset& dataset) | 381 DicomFrameIndex::DicomFrameIndex(DcmFileFormat& dicom) |
382 { | 382 { |
383 countFrames_ = GetFramesCount(dataset); | 383 countFrames_ = GetFramesCount(dicom); |
384 if (countFrames_ == 0) | 384 if (countFrames_ == 0) |
385 { | 385 { |
386 // The image has no frame. No index is to be built. | 386 // The image has no frame. No index is to be built. |
387 return; | 387 return; |
388 } | 388 } |
389 | |
390 DcmDataset& dataset = *dicom.getDataset(); | |
389 | 391 |
390 // Test whether this image is composed of a sequence of fragments | 392 // Test whether this image is composed of a sequence of fragments |
391 DcmPixelSequence* pixelSequence = FromDcmtkBridge::GetPixelSequence(dataset); | 393 DcmPixelSequence* pixelSequence = FromDcmtkBridge::GetPixelSequence(dataset); |
392 if (pixelSequence != NULL) | 394 if (pixelSequence != NULL) |
393 { | 395 { |