]> Creatis software - gdcm.git/blob - Testing/TestTS.cxx
Avoid warnings Darwin-gcc
[gdcm.git] / Testing / TestTS.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: TestTS.cxx,v $
5   Language:  C++
6   Date:      $Date: 2005/10/25 14:52:31 $
7   Version:   $Revision: 1.10 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*/
18 #include "gdcmTS.h"
19 #include "gdcmGlobal.h"
20
21 int TestTS(int , char *[])
22 {
23    gdcm::TS *ts = gdcm::TS::New();
24    // There should be ~150 entries
25    ts->Print( std::cout );
26
27    // Implicit VR Little Endian
28    std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2" ) << std::endl;
29    // Implicit VR Big Endian DLX (G.E Private)
30    std::cout << ts->IsTransferSyntax( "1.2.840.113619.5.2" ) << std::endl;
31    // Explicit VR Little Endian
32    std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.1" ) << std::endl;
33    // Deflated Explicit VR Little Endian
34    std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.1.99" ) << std::endl;
35    // Explicit VR Big Endian
36    std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.2" ) << std::endl;
37    // JPEG Baseline (Process 1)
38    std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.4.50" ) << std::endl;
39    // JPEG Extended (Process 2 & 4)
40    std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.4.51" ) << std::endl;
41    // JPEG Extended (Process 3 & 5)
42    std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.4.52" ) << std::endl;
43    // JPEG Spectral Selection, Non-Hierarchical (Process 6 & 8)
44    std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.4.53" ) << std::endl;
45    // JPEG Full Progression, Non-Hierarchical (Process 10 & 12)
46    std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.4.55" ) << std::endl;
47    // JPEG Lossless, Non-Hierarchical (Process 14)
48    std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.4.57" ) << std::endl;
49    // JPEG Lossless, Hierarchical, First-Order Prediction (Process 14, 
50    //               [Selection Value 1])
51    std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.4.70" ) << std::endl;
52    // JPEG 2000 Lossless
53    std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.4.90" ) << std::endl;
54    // JPEG 2000
55    std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.4.91" ) << std::endl;
56    // RLE Lossless
57    std::cout << ts->IsTransferSyntax( "1.2.840.10008.1.2.5" ) << std::endl;
58    // Unknown
59    std::cout << ts->IsTransferSyntax( "Unknown Transfer Syntax" ) << std::endl;
60
61    // Test JPEG test:
62    std::cout << "Test TS:" << std::endl;
63    std::cout << ts->IsJPEGLossless( "1.2.840.10008.1.2.4.55") << std::endl;
64 //if ( key == "1.2.840.10008.1.2.4.55"
65 //  || key == "1.2.840.10008.1.2.4.57"
66 //  || key == "1.2.840.10008.1.2.4.70" )
67    std::cout << ts->IsRLELossless( "1.2.840.10008.1.2.5") << std::endl;
68    std::cout << ts->IsJPEGLossless( "1.2.840.10008.1.2.5") << std::endl;
69    std::cout << ts->IsJPEG2000( "1.2.840.10008.1.2.5") << std::endl;
70    std::cout << ts->IsJPEG( "1.2.840.10008.1.2.5") << std::endl;
71    std::cout << ts->GetSpecialTransferSyntax( 
72                 ts->GetSpecialTransferSyntax( "1.2.840.10008.1.2.5")) << std::endl;
73    std::cout << gdcm::Global::GetTS()->IsRLELossless( "1.2.840.10008.1.2.5" )  
74              << std::endl;
75
76    bool ret = ts->GetValue( "" ) != gdcm::GDCM_UNFOUND;
77
78    ts->Delete();
79
80    return ret;
81 }