1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
/*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "gdcmTransferSyntax.h"
static const int losslylosslessarray[][3] = {
{ 0, 1, 1 }, // ImplicitVRLittleEndian = 0,
{ 0, 1, 1 }, // ImplicitVRBigEndianPrivateGE,
{ 0, 1, 1 }, // ExplicitVRLittleEndian,
{ 0, 1, 1 }, // DeflatedExplicitVRLittleEndian,
{ 0, 1, 1 }, // ExplicitVRBigEndian,
{ 1, 0, 1 }, // JPEGBaselineProcess1,
{ 1, 0, 1 }, // JPEGExtendedProcess2_4,
{ 1, 0, 1 }, // JPEGExtendedProcess3_5,
{ 1, 0, 1 }, // JPEGSpectralSelectionProcess6_8,
{ 1, 0, 1 }, // JPEGFullProgressionProcess10_12,
{ 0, 1, 0 }, // JPEGLosslessProcess14,
{ 0, 1, 0 }, // JPEGLosslessProcess14_1,
{ 0, 1, 0 }, // JPEGLSLossless,
{ 1, 1, 1 }, // JPEGLSNearLossless,
{ 0, 1, 0 }, // JPEG2000Lossless,
{ 1, 1, 1 }, // JPEG2000,
{ 0, 1, 0 }, // JPEG2000Part2Lossless,
{ 1, 1, 1 }, // JPEG2000Part2,
{ 0, 1, 0 }, // RLELossless,
{ 1, 0, 1 }, // MPEG2MainProfile,
{ 0, 1, 1 }, // ImplicitVRBigEndianACRNEMA,
#ifdef GDCM_SUPPORT_BROKEN_IMPLEMENTATION
{ 0, 1, 1 }, // WeirdPapryus,
#endif
{ 0, 1, 1 }, // CT_private_ELE,
{ 1, 1, 1 }, // JPIPReferenced
{ 1, 0, 1 }, // MPEG2MainProfileHighLevel
{ 1, 0, 1 }, // MPEG4AVCH264HighProfileLevel4_1
{ 1, 0, 1 }, // MPEG4AVCH264BDcompatibleHighProfileLevel4_1
};
static int TestTransferSyntaxAll()
{
for(int i = 0; i < gdcm::TransferSyntax::TS_END; ++i )
{
gdcm::TransferSyntax ts = (gdcm::TransferSyntax::TSType)i;
const int *ll = losslylosslessarray[i];
if( ll[0] )
{
if( !ts.IsLossy() )
{
std::cerr << "Lossy Problem with: " << gdcm::TransferSyntax::GetTSString( ts ) << std::endl;
return 1;
}
}
if( ll[1] )
{
if( !ts.IsLossless() )
{
std::cerr << "Lossless Problem with: " << gdcm::TransferSyntax::GetTSString( ts ) << std::endl;
return 1;
}
}
if( ll[2] )
{
if( !ts.CanStoreLossy() )
{
std::cerr << "CanLossy Problem with: " << gdcm::TransferSyntax::GetTSString( ts ) << std::endl;
return 1;
}
}
}
return 0;
}
int TestTransferSyntax(int argc, char *argv[])
{
(void)argc;
(void)argv;
if( TestTransferSyntaxAll() )
{
return 1;
}
gdcm::TransferSyntax ts;
ts = gdcm::TransferSyntax::JPEG2000;
if( !ts.IsLossless() )
{
return 1;
}
if( !ts.IsLossy() )
{
return 1;
}
ts = gdcm::TransferSyntax::JPEGLosslessProcess14_1;
if( !ts.IsLossless() )
{
return 1;
}
if( ts.IsLossy() )
{
return 1;
}
ts = gdcm::TransferSyntax::DeflatedExplicitVRLittleEndian;
if( !ts.IsLossless() )
{
return 1;
}
if( ts.IsLossy() )
{
return 1;
}
return 0;
}
|