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
|
/*=========================================================================
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 "gdcmReader.h"
#include "gdcmPrinter.h"
#include "gdcmFilename.h"
#include "gdcmTesting.h"
#include "gdcmGlobal.h"
#include "gdcmDicts.h"
/*
This test exercise a very obscure section of gdcm::Printer
when it handles a SQ when it is hidden as VR::UN + undefined
length which means this is a Implicit VR Little Endian
encoded SQ in an Explicit VR Little Endian DataSet
*/
int TestPrinter2(int , char *[])
{
const char *directory = gdcm::Testing::GetDataRoot();
std::string filename = std::string(directory) + "/undefined_length_un_vr.dcm";
gdcm::Reader r;
r.SetFileName( filename.c_str() );
if( !r.Read() )
{
return 1;
}
gdcm::Printer print;
print.SetFile( r.GetFile() );
std::ostringstream out;
print.Print( out );
gdcm::Global &g = gdcm::Global::GetInstance();
gdcm::Dicts &dicts = g.GetDicts();
gdcm::PrivateDict &priv_dict = dicts.GetPrivateDict();
gdcm::PrivateTag pt(0x2001,0x005f,"Philips Imaging DD 001");
if( !priv_dict.RemoveDictEntry( pt ) )
{
return 1;
}
gdcm::Reader r2;
r2.SetFileName( filename.c_str() );
if( !r2.Read() )
{
return 1;
}
gdcm::Printer print2;
print2.SetFile( r.GetFile() );
std::ostringstream out2;
print2.Print( out2 );
// if( out2.str() != out.str() )
// {
// return 1;
// }
return 0;
}
|