1 /*=========================================================================
4 Module: $RCSfile: PrintFile.cxx,v $
6 Date: $Date: 2004/11/24 10:23:46 $
7 Version: $Revision: 1.12 $
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.
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.
17 =========================================================================*/
21 int main(int argc, char* argv[])
28 std::cout << " usage : PrintDocument fileName" << std::endl;
34 fileName += GDCM_DATA_ROOT;
35 fileName += "/test.acr";
38 e1= new gdcm::Header( fileName.c_str() );
40 f1 = new gdcm::File(e1);
46 std::cout << "\n\n" << std::endl;
48 int dataSize = f1->GetImageDataSize();
49 std::cout <<std::endl <<" dataSize " << dataSize << std::endl;
50 int nX,nY,nZ,sPP,planarConfig;
51 std::string pixelType;
55 std::cout << " DIMX=" << nX << " DIMY=" << nY << " DIMZ=" << nZ << std::endl;
57 pixelType = e1->GetPixelType();
58 sPP = e1->GetSamplesPerPixel();
59 planarConfig = e1->GetPlanarConfiguration();
61 std::cout << " pixelType=" << pixelType
62 << " SamplesPerPixel=" << sPP
63 << " PlanarConfiguration=" << planarConfig
65 << " PhotometricInterpretation="
66 << e1->GetEntryByNumber(0x0028,0x0004)
69 int numberOfScalarComponents=e1->GetNumberOfScalarComponents();
70 std::cout << " NumberOfScalarComponents " << numberOfScalarComponents <<std::endl
71 << " LUT=" << (e1->HasLUT() ? "TRUE" : "FALSE")
75 if ( e1->GetEntryByNumber(0x0002,0x0010) == gdcm::GDCM_NOTLOADED ) {
76 std::cout << "Transfert Syntax not loaded. " << std::endl
77 << "Better you increase MAX_SIZE_LOAD_ELEMENT_VALUE"
82 std::string transferSyntaxName = e1->GetTransfertSyntaxName();
83 std::cout << " TransferSyntaxName= [" << transferSyntaxName << "]" << std::endl;
85 if ( transferSyntaxName != "Implicit VR - Little Endian"
86 && transferSyntaxName != "Explicit VR - Little Endian"
87 && transferSyntaxName != "Deflated Explicit VR - Little Endian"
88 && transferSyntaxName != "Explicit VR - Big Endian"
89 && transferSyntaxName != "Uncompressed ACR-NEMA" )
91 std::cout << std::endl << "==========================================="
93 f1->GetPixelConverter()->Print();
94 std::cout << std::endl << "==========================================="
99 std::cout <<std::endl<<fileName<<" is Readable"<<std::endl;
101 std::cout <<std::endl<<fileName<<" is NOT Readable"<<std::endl;
102 std::cout<<std::flush;