1 /*=========================================================================
2 
3   Program: GDCM (Grassroots DICOM). A DICOM library
4 
5   Copyright (c) 2006-2011 Mathieu Malaterre
6   All rights reserved.
7   See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8 
9      This software is distributed WITHOUT ANY WARRANTY; without even
10      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11      PURPOSE.  See the above copyright notice for more information.
12 
13 =========================================================================*/
14 #include "gdcmAttribute.h"
15 
TestAttribute7(int,char * [])16 int TestAttribute7(int, char *[])
17 {
18 {
19   const char bytes[] = "\030\000e\020";
20   gdcm::DataElement de( gdcm::Tag(0x28,0x9)  );
21   de.SetVR( gdcm::VR::INVALID );
22   de.SetByteValue( bytes, 4 );
23 
24   gdcm::Attribute<0x28,0x9, gdcm::VR::AT, gdcm::VM::VM1 > at;
25   at.SetFromDataElement( de );
26   std::cout << at.GetValue() << std::endl;
27 
28   gdcm::Attribute<0x3004, 0x0014> tissue;
29   //std::cout << tissue.GetVR() << std::endl;
30   if( tissue.GetVR() != gdcm::VR::CS ) return 1;
31 }
32 
33 {
34   gdcm::Attribute<0x8,0x8> imagetype;
35   imagetype.SetNumberOfValues(0);
36   if( imagetype.GetNumberOfValues() != 0 ) return 1;
37 
38   const char bytes[] = "ORIGINAL\\PRIMARY";
39   gdcm::DataElement de( gdcm::Tag(0x8,0x8)  );
40   de.SetVR( gdcm::VR::INVALID );
41   de.SetByteValue( bytes, (uint32_t)strlen(bytes) );
42   gdcm::DataSet ds;
43   imagetype.SetFromDataSet( ds );
44   if( imagetype.GetNumberOfValues() != 0 ) return 1;
45   ds.Insert( de );
46   imagetype.SetFromDataSet( ds );
47   if( imagetype.GetNumberOfValues() != 2 ) return 1;
48   imagetype.SetNumberOfValues(0);
49   if( imagetype.GetNumberOfValues() != 0 ) return 1;
50   imagetype.SetFromDataSet( ds );
51   if( imagetype.GetNumberOfValues() != 2 ) return 1;
52 
53 
54 }
55 
56 
57   return 0;
58 }
59