From 99527f7d2edc2714942c0837cb56ff333b9fbb92 Mon Sep 17 00:00:00 2001 From: jpr Date: Fri, 8 Jul 2005 13:39:56 +0000 Subject: [PATCH] New gdcm2 style syntax for Load() --- Testing/TestAllEntryVerify.cxx | 10 ++- Testing/TestAllPrint.cxx | 8 +- Testing/TestAllReadCompareDicom.cxx | 22 ++++-- Testing/TestAnonymize.cxx | 69 +++++++++-------- Testing/TestBug.cxx | 20 ++--- Testing/TestBuildUpDicomDir.cxx | 8 +- Testing/TestChangeHeader.cxx | 17 +++-- Testing/TestCopyDicom.cxx | 9 ++- Testing/TestCopyRescaleDicom.cxx | 11 ++- Testing/TestDicomDir.cxx | 14 ++-- Testing/TestDicomDirElement.cxx | 6 +- Testing/TestDictGroupName.cxx | 6 +- Testing/TestException.cxx | 5 +- Testing/TestFileAccessors.cxx | 112 ++++++++++++++-------------- Testing/TestImageSet.cxx | 8 +- Testing/TestMakeIcon.cxx | 103 ++++++++++++------------- Testing/TestSerieHelper.cxx | 6 +- Testing/TestWriteSimple.cxx | 5 +- 18 files changed, 241 insertions(+), 198 deletions(-) diff --git a/Testing/TestAllEntryVerify.cxx b/Testing/TestAllEntryVerify.cxx index 2f7b86e4..6bf7ee11 100644 --- a/Testing/TestAllEntryVerify.cxx +++ b/Testing/TestAllEntryVerify.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestAllEntryVerify.cxx,v $ Language: C++ - Date: $Date: 2005/04/19 10:01:02 $ - Version: $Revision: 1.26 $ + Date: $Date: 2005/07/08 13:39:56 $ + Version: $Revision: 1.27 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -229,7 +229,11 @@ bool ReferenceFileParser::Check( MapFileValuesType::iterator &fileIt ) { std::string fileName = DataPath + fileIt->first; std::cout << Indent << "FileName: " << fileName << std::endl; - gdcm::File *tested = new gdcm::File( fileName.c_str() ); + + gdcm::File *tested; + tested = new gdcm::File( ); + tested->SetFileName( fileName.c_str() ); + tested->Load( ); if( !tested->IsReadable() ) { std::cerr << Indent << "Failed\n" diff --git a/Testing/TestAllPrint.cxx b/Testing/TestAllPrint.cxx index 983c09eb..6755e871 100644 --- a/Testing/TestAllPrint.cxx +++ b/Testing/TestAllPrint.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestAllPrint.cxx,v $ Language: C++ - Date: $Date: 2005/07/02 22:51:04 $ - Version: $Revision: 1.1 $ + Date: $Date: 2005/07/08 13:39:56 $ + Version: $Revision: 1.2 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -49,9 +49,9 @@ int TestAllPrint(int, char *[]) gdcm::File file; file.SetLoadMode( NO_SEQ ); - file.Load(filename); + file.SetFileName( filename ); + file.Load(); //file.Print( std::cout ); //just for debug - i++; } return 0; diff --git a/Testing/TestAllReadCompareDicom.cxx b/Testing/TestAllReadCompareDicom.cxx index 1ac5df48..cfb139ae 100644 --- a/Testing/TestAllReadCompareDicom.cxx +++ b/Testing/TestAllReadCompareDicom.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestAllReadCompareDicom.cxx,v $ Language: C++ - Date: $Date: 2005/07/06 09:53:43 $ - Version: $Revision: 1.43 $ + Date: $Date: 2005/07/08 13:39:56 $ + Version: $Revision: 1.44 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -396,16 +396,20 @@ int InternalTest(std::string const &filename, ////// Step 1: std::cout << "1..."; - gdcm::FileHelper *tested = new gdcm::FileHelper( filename ); - if( !tested->GetFile()->IsReadable() ) + gdcm::File *f = new gdcm::File(); + f->SetFileName( filename ); + f->Load(); + + if( !f->IsReadable() ) { std::cout << " Failed" << std::endl << " Image not gdcm compatible:" << filename << std::endl; - delete tested; + delete f; return 1; } - + gdcm::FileHelper *tested = new gdcm::FileHelper( f ); + ////// Step 2: ////// Check for existence of reference baseline dicom file: std::cout << "2..."; @@ -437,6 +441,7 @@ int InternalTest(std::string const &filename, << filename << std::endl; delete reference; delete tested; + delete f; return 1; } @@ -464,6 +469,7 @@ int InternalTest(std::string const &filename, << reference->GetZSize() << std::endl; delete reference; delete tested; + delete f; return 1; } @@ -479,6 +485,7 @@ int InternalTest(std::string const &filename, << reference->GetNumberOfComponents() << std::endl; delete reference; delete tested; + delete f; return 1; } @@ -498,6 +505,7 @@ int InternalTest(std::string const &filename, << std::endl; delete tested; delete reference; + delete f; return 1; } @@ -536,12 +544,14 @@ int InternalTest(std::string const &filename, delete tested; delete reference; + delete f; return 1; } //////////////// Clean up: delete tested; delete reference; + delete f; std::cout << "OK." << std::endl; diff --git a/Testing/TestAnonymize.cxx b/Testing/TestAnonymize.cxx index 7d6b3e1c..ab359e14 100644 --- a/Testing/TestAnonymize.cxx +++ b/Testing/TestAnonymize.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestAnonymize.cxx,v $ Language: C++ - Date: $Date: 2005/02/09 16:41:51 $ - Version: $Revision: 1.1 $ + Date: $Date: 2005/07/08 13:39:56 $ + Version: $Revision: 1.2 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -55,7 +55,12 @@ int Anonymize(std::string const &filename, //////////////// Step 1: std::cout << " 1..."; std::cout << std::endl; - gdcm::File *f1 = new gdcm::File( filename ); + + gdcm::File *f; + f = new gdcm::File( ); + f->SetFileName( filename ); + f->Load(); + std::cout << " ... Read !" << std::endl; // ============================================================ // Load the pixels in memory. @@ -63,43 +68,43 @@ int Anonymize(std::string const &filename, // ============================================================ // We need a gdcm::FileHelper, since we want to load the pixels - gdcm::FileHelper *fh1 = new gdcm::FileHelper(f1); + gdcm::FileHelper *fh = new gdcm::FileHelper(f); // --- Don't forget to load the Pixels ... // We shall not use them, but we have to load them - fh1->GetImageData(); + fh->GetImageData(); std::cout << " Image Data... Got ! " << std::endl; // Institution name - f1->AddAnonymizeElement( 0x0008, 0x0080, "Xanadoo" ); + f->AddAnonymizeElement( 0x0008, 0x0080, "Xanadoo" ); // Patient's name - f1->AddAnonymizeElement( 0x0010, 0x0010, "Fantomas" ); + f->AddAnonymizeElement( 0x0010, 0x0010, "Fantomas" ); // Patient's ID - f1->AddAnonymizeElement( 0x0010, 0x0020,"1515" ); + f->AddAnonymizeElement( 0x0010, 0x0020,"1515" ); // Study Instance UID - f1->AddAnonymizeElement( 0x0020, 0x000d, "9.99.999.9999" ); + f->AddAnonymizeElement( 0x0020, 0x000d, "9.99.999.9999" ); // Telephone - f1->AddAnonymizeElement( 0x0010, 0x2154, "3615" ); + f->AddAnonymizeElement( 0x0010, 0x2154, "3615" ); std::cout << " Anonymize list... Done ! " << std::endl; - f1->AnonymizeFile(); + f->AnonymizeFile(); std::cout << " Anonymize File... Done ! " << std::endl; - fh1->WriteDcmExplVR(output); + fh->WriteDcmExplVR(output); std::cout << " Anonymized File... Written ! " << std::endl; - f1->ClearAnonymizeList(); + f->ClearAnonymizeList(); std::cout << " Anonymize list... Cleared ! " << std::endl; - delete f1; - delete fh1; + delete f; + delete fh; // Read the file we just wrote - f1 = new gdcm::File( output ); + f = new gdcm::File( output ); std::cout << " Anonymized File... Re-Read ! " << std::endl; @@ -107,27 +112,27 @@ int Anonymize(std::string const &filename, bool plouf = false; // Compare and abort if different. - v = f1->GetEntryValue(0x0008, 0x0080); + v = f->GetEntryValue(0x0008, 0x0080); if ( v != gdcm::GDCM_UNFOUND ) if (v.find("Xanadoo") >= v.length() ) plouf = true; - v = f1->GetEntryValue(0x0010, 0x0010); + v = f->GetEntryValue(0x0010, 0x0010); if ( v != gdcm::GDCM_UNFOUND ) if (v.find("Fantomas") >= v.length() ) plouf = true; if ( v != gdcm::GDCM_UNFOUND ) - v = f1->GetEntryValue(0x0010, 0x0020); + v = f->GetEntryValue(0x0010, 0x0020); if (v.find("1515") >= v.length() ) plouf = true; if ( v != gdcm::GDCM_UNFOUND ) - v = f1->GetEntryValue(0x0010, 0x000d); + v = f->GetEntryValue(0x0010, 0x000d); if (v.find("9.99.999.9999") >= v.length() ) plouf = true; - delete f1; + delete f; if ( !plouf) { @@ -142,18 +147,18 @@ int Anonymize(std::string const &filename, // Read the file we just anonymize and check - f1 = new gdcm::File( output ); + f = new gdcm::File( output ); // First, we set values to replace the ones we want to hide // Patient's name - f1->AddAnonymizeElement(0x0010, 0x0010, "XXL"); + f->AddAnonymizeElement(0x0010, 0x0010, "XXL"); std::cout << " replace Patient's Name " << std::endl; // Patient's ID - f1->AddAnonymizeElement( 0x0010, 0x0020,"007" ); + f->AddAnonymizeElement( 0x0010, 0x0020,"007" ); std::cout << " replace Patient's ID " << std::endl; // Study Instance UID - f1->AddAnonymizeElement(0x0020, 0x000d, "6.66.666.6666" ); + f->AddAnonymizeElement(0x0020, 0x000d, "6.66.666.6666" ); std::cout << " replace Study ID " << std::endl; // --------------------- we overwrite the file @@ -162,33 +167,33 @@ int Anonymize(std::string const &filename, // The gdcm::File remains untouched in memory std::cout <<"Let's AnonymizeNoLoad " << std::endl;; - f1->AnonymizeNoLoad(); + f->AnonymizeNoLoad(); std::cout <<"End AnonymizeNoLoad" << std::endl; // No need to write the File : modif were done on disc ! - delete f1; - f1 = new gdcm::File( output ); + delete f; + f = new gdcm::File( output ); std::string val; plouf = false; - val = f1->GetEntryValue(0x0010, 0x0010); + val = f->GetEntryValue(0x0010, 0x0010); if ( val != gdcm::GDCM_UNFOUND ) if (val.find("XXL") >= v.length() ) plouf = true; if ( val != gdcm::GDCM_UNFOUND ) - val = f1->GetEntryValue(0x0010, 0x0020); + val = f->GetEntryValue(0x0010, 0x0020); if (val.find("007") >= v.length() ) plouf = true; if ( val != gdcm::GDCM_UNFOUND ) - val = f1->GetEntryValue(0x0010, 0x000d); + val = f->GetEntryValue(0x0010, 0x000d); if (val.find("6.66.666.6666") >= v.length() ) plouf = true; - delete f1; + delete f; if ( !plouf) { diff --git a/Testing/TestBug.cxx b/Testing/TestBug.cxx index 4f5b7a28..2ff730c6 100644 --- a/Testing/TestBug.cxx +++ b/Testing/TestBug.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestBug.cxx,v $ Language: C++ - Date: $Date: 2005/02/02 10:05:26 $ - Version: $Revision: 1.19 $ + Date: $Date: 2005/07/08 13:39:57 $ + Version: $Revision: 1.20 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -23,18 +23,20 @@ int TestBug(int argc, char *argv[]) { - gdcm::File *e1; - + gdcm::File *f; + f = new gdcm::File(); + if (argc > 1) - e1 = new gdcm::File( argv[1] ); + f->SetFileName( argv[1] ); else { std::string filename = GDCM_DATA_ROOT; filename += "/test.acr"; - e1 = new gdcm::File( filename.c_str() ); + f->SetFileName( filename.c_str() ); } - - e1->GetPubDict()->Print(); - delete e1; + f->Load( ); + + f->GetPubDict()->Print(); + delete f; return 0; } diff --git a/Testing/TestBuildUpDicomDir.cxx b/Testing/TestBuildUpDicomDir.cxx index ac2a79bd..4037663d 100644 --- a/Testing/TestBuildUpDicomDir.cxx +++ b/Testing/TestBuildUpDicomDir.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestBuildUpDicomDir.cxx,v $ Language: C++ - Date: $Date: 2005/04/19 10:03:22 $ - Version: $Revision: 1.2 $ + Date: $Date: 2005/07/08 13:39:57 $ + Version: $Revision: 1.3 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -185,7 +185,9 @@ int TestBuildUpDicomDir(int argc, char *argv[]) delete dcmdir; // Read the newly written DicomDir - gdcm::DicomDir *newDicomDir = new gdcm::DicomDir("NewDICOMDIR"); + gdcm::DicomDir *newDicomDir = new gdcm::DicomDir(); + newDicomDir->SetFileName("NewDICOMDIR"); + newDicomDir->Load( ); if( !newDicomDir->IsReadable() ) { std::cout<<" Written DicomDir 'NewDICOMDIR'" diff --git a/Testing/TestChangeHeader.cxx b/Testing/TestChangeHeader.cxx index 9739ebae..bfdc2ba2 100644 --- a/Testing/TestChangeHeader.cxx +++ b/Testing/TestChangeHeader.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestChangeHeader.cxx,v $ Language: C++ - Date: $Date: 2005/02/02 12:02:33 $ - Version: $Revision: 1.34 $ + Date: $Date: 2005/07/08 13:39:57 $ + Version: $Revision: 1.35 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -15,13 +15,16 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -#include "gdcmHeader.h" +#include "gdcmFileHelper.h" #include "gdcmFile.h" // Writting of a DICOM file, using a correct gdcmHeader. // and pixels of an other image +// NO SYNTAX UPDATED +// Doesn't compile ! + int TestChangeHeader(int argc, char *argv[]) { if (argc < 3) @@ -32,10 +35,12 @@ int TestChangeHeader(int argc, char *argv[]) } std::string firstArgument = argv[1]; - gdcmFile *f1 = new gdcmFile(firstArgument); - + + gdcm::File *f1 = new gdcm::File(); + f1->SetFileName(firstArgument); + f1->Load( ); std::string secondArgument = argv[2]; - gdcmFile *f2 = new gdcmFile(secondArgument); + gdcm::File *f2 = new gdcm::File(secondArgument); //f1->PrintPubElVal(); diff --git a/Testing/TestCopyDicom.cxx b/Testing/TestCopyDicom.cxx index 9220962c..c0c5164c 100644 --- a/Testing/TestCopyDicom.cxx +++ b/Testing/TestCopyDicom.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestCopyDicom.cxx,v $ Language: C++ - Date: $Date: 2005/02/09 15:31:15 $ - Version: $Revision: 1.40 $ + Date: $Date: 2005/07/08 13:39:57 $ + Version: $Revision: 1.41 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -42,9 +42,12 @@ int CopyDicom(std::string const &filename, //////////////// Step 1: std::cout << " 1..."; - gdcm::File *originalH = new gdcm::File( filename ); + + gdcm::File *originalH = new gdcm::File( ); gdcm::File *copyH = new gdcm::File( ); + originalH->SetFileName( filename ); + originalH->Load( ); //First of all copy the file, field by field //////////////// Step 2: diff --git a/Testing/TestCopyRescaleDicom.cxx b/Testing/TestCopyRescaleDicom.cxx index 1d035d72..3d25e33c 100644 --- a/Testing/TestCopyRescaleDicom.cxx +++ b/Testing/TestCopyRescaleDicom.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestCopyRescaleDicom.cxx,v $ Language: C++ - Date: $Date: 2005/05/20 15:50:27 $ - Version: $Revision: 1.19 $ + Date: $Date: 2005/07/08 13:39:57 $ + Version: $Revision: 1.20 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -72,10 +72,13 @@ int CopyRescaleDicom(std::string const &filename, return 1; } } - + //////////////// Step 1: std::cout << " 1..."; - gdcm::File originalF = gdcm::File( filename ); + gdcm::File originalF = gdcm::File( ); + originalF.SetFileName( filename ); + originalF.Load(); + gdcm::File copyF = gdcm::File( ); //First of all copy the file, field by field diff --git a/Testing/TestDicomDir.cxx b/Testing/TestDicomDir.cxx index 6039f22a..59158930 100644 --- a/Testing/TestDicomDir.cxx +++ b/Testing/TestDicomDir.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestDicomDir.cxx,v $ Language: C++ - Date: $Date: 2005/02/03 10:00:06 $ - Version: $Revision: 1.38 $ + Date: $Date: 2005/07/08 13:39:57 $ + Version: $Revision: 1.39 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -100,7 +100,9 @@ int TestDicomDir(int argc, char *argv[]) file += "/DICOMDIR"; } - dicomdir = new gdcm::DicomDir(file); + dicomdir = new gdcm::DicomDir( ); + dicomdir->SetFileName(file); + dicomdir->Load( ); if (argc > 2) { int level = atoi(argv[2]); @@ -185,8 +187,10 @@ int TestDicomDir(int argc, char *argv[]) << "NewDICOMDIR written on disc =================================" << std::endl<< std::endl; // Read what we wrote - gdcm::DicomDir *d2 = new gdcm::DicomDir("NewDICOMDIR"); - if (!d2) + gdcm::DicomDir *d2 = new gdcm::DicomDir( ); + d2->SetFileName("NewDICOMDIR"); + d2->Load( ); + if (!d2->IsReadable( )) { std::cout << std::endl << std::endl << "Read NewDicomDir from disc failed ========================" diff --git a/Testing/TestDicomDirElement.cxx b/Testing/TestDicomDirElement.cxx index 8df1b737..41171ded 100644 --- a/Testing/TestDicomDirElement.cxx +++ b/Testing/TestDicomDirElement.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestDicomDirElement.cxx,v $ Language: C++ - Date: $Date: 2005/02/10 10:51:39 $ - Version: $Revision: 1.4 $ + Date: $Date: 2005/07/08 13:39:57 $ + Version: $Revision: 1.5 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -46,7 +46,7 @@ int TestDicomDirElement(int , char *[]) // We could add others std::cout << " -------- DicomDirElement After modif --------" <Print(std::cout ); + ddElt->Print( std::cout ); delete ddElt; return 0; diff --git a/Testing/TestDictGroupName.cxx b/Testing/TestDictGroupName.cxx index d8f41c61..cc74a79f 100644 --- a/Testing/TestDictGroupName.cxx +++ b/Testing/TestDictGroupName.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestDictGroupName.cxx,v $ Language: C++ - Date: $Date: 2005/04/06 08:59:46 $ - Version: $Revision: 1.2 $ + Date: $Date: 2005/07/08 13:39:57 $ + Version: $Revision: 1.3 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -26,7 +26,7 @@ int CompareDictGroupName(gdcm::DictGroupName &groupName, { std::string val = groupName.GetName(group); std::cout << "Group : 0x" << std::hex << std::setw(4) << group - << std::dec << " : " << val << " - " + << std::dec << " : " << val << " - " << (bool)(val==ref) << std::endl; return val!=ref; diff --git a/Testing/TestException.cxx b/Testing/TestException.cxx index 312ed87e..32badc40 100644 --- a/Testing/TestException.cxx +++ b/Testing/TestException.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestException.cxx,v $ Language: C++ - Date: $Date: 2005/02/11 16:42:23 $ - Version: $Revision: 1.1 $ + Date: $Date: 2005/07/08 13:39:57 $ + Version: $Revision: 1.2 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -44,7 +44,6 @@ void functionForException() - int TestException(int , char **) { try diff --git a/Testing/TestFileAccessors.cxx b/Testing/TestFileAccessors.cxx index 5a55f106..8be0e831 100644 --- a/Testing/TestFileAccessors.cxx +++ b/Testing/TestFileAccessors.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestFileAccessors.cxx,v $ Language: C++ - Date: $Date: 2005/02/03 09:51:53 $ - Version: $Revision: 1.1 $ + Date: $Date: 2005/07/08 13:39:57 $ + Version: $Revision: 1.2 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -50,85 +50,87 @@ int TestFileAccessors(int, char *[]) std::string filename = GDCM_DATA_ROOT; filename += "/"; //doh! filename += gdcmDataImages[i]; - - gdcm::File *e1= new gdcm::File( filename ); + + gdcm::File *f= new gdcm::File( ); + f->SetFileName( filename ); + f->Load( ); // We don't check the returned values // We just want to be sure no accessor seg faults on any image ... // And this will improve test coverage ;-) - std::cout << "GetSwapCode()" << e1->GetSwapCode() << std::endl; - std::cout << "GetImageNumber()" << e1->GetImageNumber() << std::endl; - std::cout << "GetModality()" << e1->GetModality() << std::endl; - std::cout << "GetXSize()" << e1->GetXSize() << std::endl; - std::cout << "GetYSize()" << e1->GetYSize() << std::endl; - std::cout << "GetZSize()" << e1->GetZSize() << std::endl; - std::cout << "GetXSpacing()" << e1->GetXSpacing() << std::endl; - std::cout << "GetYSpacing()" << e1->GetYSpacing() << std::endl; - std::cout << "GetZSpacing()" << e1->GetZSpacing() << std::endl; - std::cout << "GetXOrigin()" << e1->GetXOrigin() << std::endl; - std::cout << "GetYOrigin()" << e1->GetYOrigin() << std::endl; - std::cout << "GetZOrigin()" << e1->GetZOrigin() << std::endl; - std::cout << "GetBitsStored()" << e1->GetBitsStored() << std::endl; - std::cout << "GetBitsAllocated()" << e1->GetBitsAllocated() << std::endl; - std::cout << "GetHighBitPosition()" << e1->GetHighBitPosition() << std::endl; - std::cout << "GetSamplesPerPixel()" << e1->GetSamplesPerPixel() << std::endl; - std::cout << "GetPlanarConfiguration()" << e1->GetPlanarConfiguration() << std::endl; - std::cout << "GetPixelSize()" << e1->GetPixelSize() << std::endl; - std::cout << "GetPixelType()" << e1->GetPixelType() << std::endl; - std::cout << "GetLUTNbits()" << e1->GetLUTNbits() << std::endl; - std::cout << "GetRescaleIntercept()" << e1->GetRescaleIntercept() << std::endl; - std::cout << "GetRescaleSlope()" << e1->GetRescaleSlope() << std::endl; - std::cout << "GetGrPixel()" << std::hex << e1->GetGrPixel() << std::endl; - std::cout << "GetNumPixel()" << std::hex << e1->GetNumPixel() << std::endl; - std::cout << "GetPixelOffset()" << e1->GetPixelOffset() << std::endl; - - std::cout << "GetPixelAreaLength()" << e1->GetPixelAreaLength()<< std::endl; - std::cout << "GetNumberOfScalarComponents()" << e1->GetNumberOfScalarComponents()<< std::endl; - std::cout << "GetNumberOfScalarComponentsRaw()" << e1->GetNumberOfScalarComponentsRaw()<< std::endl; - std::cout << "IsSignedPixelData()" << e1->IsSignedPixelData()<< std::endl; - std::cout << "IsMonochrome()" << e1->IsMonochrome() << std::endl; - std::cout << "IsPaletteColor()" << e1->IsPaletteColor() << std::endl; - std::cout << "IsYBRFull()" << e1->IsYBRFull() << std::endl; - std::cout << "HasLut() " << e1->HasLUT() << std::endl; - std::cout << "GetTransferSyntax()" << e1->GetTransferSyntax() << std::endl; - std::cout << "GetTransferSyntaxName()" << e1->GetTransferSyntaxName() << std::endl; - std::cout << "GetFileType()" << e1->GetFileType() << std::endl; - std::cout << "GetFileName()" << e1->GetFileName() << std::endl; - - e1->GetImageOrientationPatient( iop ); + std::cout << "GetSwapCode()" << f->GetSwapCode() << std::endl; + std::cout << "GetImageNumber()" << f->GetImageNumber() << std::endl; + std::cout << "GetModality()" << f->GetModality() << std::endl; + std::cout << "GetXSize()" << f->GetXSize() << std::endl; + std::cout << "GetYSize()" << f->GetYSize() << std::endl; + std::cout << "GetZSize()" << f->GetZSize() << std::endl; + std::cout << "GetXSpacing()" << f->GetXSpacing() << std::endl; + std::cout << "GetYSpacing()" << f->GetYSpacing() << std::endl; + std::cout << "GetZSpacing()" << f->GetZSpacing() << std::endl; + std::cout << "GetXOrigin()" << f->GetXOrigin() << std::endl; + std::cout << "GetYOrigin()" << f->GetYOrigin() << std::endl; + std::cout << "GetZOrigin()" << f->GetZOrigin() << std::endl; + std::cout << "GetBitsStored()" << f->GetBitsStored() << std::endl; + std::cout << "GetBitsAllocated()" << f->GetBitsAllocated() << std::endl; + std::cout << "GetHighBitPosition()" << f->GetHighBitPosition() << std::endl; + std::cout << "GetSamplesPerPixel()" << f->GetSamplesPerPixel() << std::endl; + std::cout << "GetPlanarConfiguration()" << f->GetPlanarConfiguration() << std::endl; + std::cout << "GetPixelSize()" << f->GetPixelSize() << std::endl; + std::cout << "GetPixelType()" << f->GetPixelType() << std::endl; + std::cout << "GetLUTNbits()" << f->GetLUTNbits() << std::endl; + std::cout << "GetRescaleIntercept()" << f->GetRescaleIntercept() << std::endl; + std::cout << "GetRescaleSlope()" << f->GetRescaleSlope() << std::endl; + std::cout << "GetGrPixel()" << std::hex << f->GetGrPixel() << std::endl; + std::cout << "GetNumPixel()" << std::hex << f->GetNumPixel() << std::endl; + std::cout << "GetPixelOffset()" << f->GetPixelOffset() << std::endl; + + std::cout << "GetPixelAreaLength()" << f->GetPixelAreaLength()<< std::endl; + std::cout << "GetNumberOfScalarComponents()" << f->GetNumberOfScalarComponents()<< std::endl; + std::cout << "GetNumberOfScalarComponentsRaw()" << f->GetNumberOfScalarComponentsRaw()<< std::endl; + std::cout << "IsSignedPixelData()" << f->IsSignedPixelData()<< std::endl; + std::cout << "IsMonochrome()" << f->IsMonochrome() << std::endl; + std::cout << "IsPaletteColor()" << f->IsPaletteColor() << std::endl; + std::cout << "IsYBRFull()" << f->IsYBRFull() << std::endl; + std::cout << "HasLut() " << f->HasLUT() << std::endl; + std::cout << "GetTransferSyntax()" << f->GetTransferSyntax() << std::endl; + std::cout << "GetTransferSyntaxName()" << f->GetTransferSyntaxName() << std::endl; + std::cout << "GetFileType()" << f->GetFileType() << std::endl; + std::cout << "GetFileName()" << f->GetFileName() << std::endl; + + f->GetImageOrientationPatient( iop ); for (int j=0; j<6; j++) std::cout << "iop[" << j << "] = " << iop[j] << std::endl; - if( e1->IsReadable() ) + if( f->IsReadable() ) { std::cout <GetImageDataSize() << std::endl; - std::cout << "GetImageDataRawSize()" << fh1->GetImageDataRawSize() << std::endl; + std::cout << "GetImageDataSize()" << fh->GetImageDataSize() << std::endl; + std::cout << "GetImageDataRawSize()" << fh->GetImageDataRawSize() << std::endl; // User Data - std::cout << "GetRGBDataSize()" << fh1->GetRGBDataSize() << std::endl; - std::cout << "GetRawDataSize()" << fh1->GetRawDataSize() << std::endl; - std::cout << "GetUserDataSize()" << fh1->GetUserDataSize() << std::endl; + std::cout << "GetRGBDataSize()" << fh->GetRGBDataSize() << std::endl; + std::cout << "GetRawDataSize()" << fh->GetRawDataSize() << std::endl; + std::cout << "GetUserDataSize()" << fh->GetUserDataSize() << std::endl; - std::cout << "GetWriteType()" << fh1->GetWriteType() << std::endl; + std::cout << "GetWriteType()" << fh->GetWriteType() << std::endl; - delete fh1; + delete fh; } else { std::cout << filename << " is NOT Readable" << std::endl << std::endl; - delete e1; + delete f; return 1; } - delete e1; + delete f; i++; } return 0; diff --git a/Testing/TestImageSet.cxx b/Testing/TestImageSet.cxx index 56ce95f0..7bf62230 100644 --- a/Testing/TestImageSet.cxx +++ b/Testing/TestImageSet.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestImageSet.cxx,v $ Language: C++ - Date: $Date: 2005/06/03 09:55:18 $ - Version: $Revision: 1.3 $ + Date: $Date: 2005/07/08 13:39:57 $ + Version: $Revision: 1.4 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -198,7 +198,9 @@ gdcm::File *WriteImage(gdcm::File *file, const std::string &fileName) delete hlp; // Read the written image - gdcm::File *reread = new gdcm::File( fileName ); + gdcm::File *reread = new gdcm::File( ); + reread->SetFileName( fileName ); + reread->Load(); if( !reread->IsReadable() ) { std::cerr << "Failed" << std::endl diff --git a/Testing/TestMakeIcon.cxx b/Testing/TestMakeIcon.cxx index 34eee75e..017cc2de 100644 --- a/Testing/TestMakeIcon.cxx +++ b/Testing/TestMakeIcon.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestMakeIcon.cxx,v $ Language: C++ - Date: $Date: 2005/04/26 16:23:58 $ - Version: $Revision: 1.6 $ + Date: $Date: 2005/07/08 13:39:57 $ + Version: $Revision: 1.7 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -49,20 +49,21 @@ int TestMakeIcon (int argc, char *argv[]) << " input filename.dcm output Filename.dcm" << std::endl; } - gdcm::File *f1 = new gdcm::File( ); - f1->Load(input); + gdcm::File *f = new gdcm::File( ); + f->SetFileName( input ); + f->Load( ); - if ( ! f1->IsReadable() ) + if ( ! f->IsReadable() ) { std::cout << " Failed to Open/Parse file" << input << std::endl; - delete f1; + delete f; return 1; } - gdcm::FileHelper *fh1 = new gdcm::FileHelper(f1); - uint8_t *pixels = fh1->GetImageData(); - uint32_t lgth = fh1->GetImageDataSize(); + gdcm::FileHelper *fh = new gdcm::FileHelper(f); + uint8_t *pixels = fh->GetImageData(); + uint32_t lgth = fh->GetImageDataSize(); - gdcm::SeqEntry *icon = f1->InsertSeqEntry(0x0088, 0x0200); + gdcm::SeqEntry *icon = f->InsertSeqEntry(0x0088, 0x0200); gdcm::SQItem *sqi = new gdcm::SQItem(1); icon->AddSQItem(sqi, 1); @@ -83,21 +84,21 @@ int TestMakeIcon (int argc, char *argv[]) // just to see if it's stored a the right place sqi->InsertValEntry( "128", 0x0028,0x0011); - fh1->WriteDcmExplVR(output); + fh->WriteDcmExplVR(output); - delete f1; + delete f; - f1 = new gdcm::File(output); - f1->Print(); + f = new gdcm::File(output); + f->Print(); std::cout << "End of Print" << std::endl; - icon = f1->GetSeqEntry(0x0088, 0x0200); + icon = f->GetSeqEntry(0x0088, 0x0200); if (!icon) { std::cout << "Sequence 0088|0200 not found" << std::endl << " ... Failed" << std::endl; - delete fh1; - delete f1; + delete fh; + delete f; return 1; } std::cout << "Sequence 0088|0200 found" << std::endl; @@ -108,8 +109,8 @@ int TestMakeIcon (int argc, char *argv[]) { std::cout << "Sequence 0088|0200 has no SQItem" << std::endl << " ... Failed" << std::endl; - delete fh1; - delete f1; + delete fh; + delete f; return 1; } @@ -120,8 +121,8 @@ int TestMakeIcon (int argc, char *argv[]) { std::cout << "ValEntry 0028|0010 not found" << std::endl << " ... Failed" << std::endl; - delete fh1; - delete f1; + delete fh; + delete f; return 1; } std::cout << "First Item ->ValEntry 0028|0010 found" << std::endl; @@ -131,8 +132,8 @@ int TestMakeIcon (int argc, char *argv[]) << "Read : " << sqi->GetValEntry(0x0028,0x0010)->GetValue() << " - Expected : 128" << std::endl << " ... Failed" << std::endl; - delete fh1; - delete f1; + delete fh; + delete f; return 1; } @@ -141,8 +142,8 @@ int TestMakeIcon (int argc, char *argv[]) { std::cout << "ValEntry 0028|0011 not found" << std::endl << " ... Failed" << std::endl; - delete fh1; - delete f1; + delete fh; + delete f; return 1; } std::cout << "First Item ->ValEntry 0028|0011 found" << std::endl; @@ -152,8 +153,8 @@ int TestMakeIcon (int argc, char *argv[]) << "Read : " << sqi->GetValEntry(0x0028,0x0011)->GetValue() << " - Expected : 128" << std::endl << " ... Failed" << std::endl; - delete fh1; - delete f1; + delete fh; + delete f; return 1; } @@ -162,8 +163,8 @@ int TestMakeIcon (int argc, char *argv[]) { std::cout << "ValEntry 0028|0100 not found" << std::endl << " ... Failed" << std::endl; - delete fh1; - delete f1; + delete fh; + delete f; return 1; } std::cout << "First Item ->ValEntry 0028|0100 found" << std::endl; @@ -173,8 +174,8 @@ int TestMakeIcon (int argc, char *argv[]) << "Read : " << sqi->GetValEntry(0x0028,0x0100)->GetValue() << " - Expected : 8" << std::endl << " ... Failed" << std::endl; - delete fh1; - delete f1; + delete fh; + delete f; return 1; } @@ -183,8 +184,8 @@ int TestMakeIcon (int argc, char *argv[]) { std::cout << "ValEntry 0028|0101 not found" << std::endl << " ... Failed" << std::endl; - delete fh1; - delete f1; + delete fh; + delete f; return 1; } std::cout << "First Item ->ValEntry 0028|0101 found" << std::endl; @@ -194,8 +195,8 @@ int TestMakeIcon (int argc, char *argv[]) << "Read : " << sqi->GetValEntry(0x0028,0x0101)->GetValue() << " - Expected : 8" << std::endl << " ... Failed" << std::endl; - delete fh1; - delete f1; + delete fh; + delete f; return 1; } @@ -204,8 +205,8 @@ int TestMakeIcon (int argc, char *argv[]) { std::cout << "ValEntry 0028|0102 not found" << std::endl << " ... Failed" << std::endl; - delete fh1; - delete f1; + delete fh; + delete f; return 1; } std::cout << "First Item ->ValEntry 0028|0102 found" << std::endl; @@ -215,8 +216,8 @@ int TestMakeIcon (int argc, char *argv[]) << "Read : " << sqi->GetValEntry(0x0028,0x0102)->GetValue() << " - Expected : 7" << std::endl << " ... Failed" << std::endl; - delete fh1; - delete f1; + delete fh; + delete f; return 1; } @@ -225,8 +226,8 @@ int TestMakeIcon (int argc, char *argv[]) { std::cout << "ValEntry 0028|0010 not found" << std::endl << " ... Failed" << std::endl; - delete fh1; - delete f1; + delete fh; + delete f; return 1; } std::cout << "First Item ->ValEntry 0028|0103 found" << std::endl; @@ -236,8 +237,8 @@ int TestMakeIcon (int argc, char *argv[]) << "Read : " << sqi->GetValEntry(0x0028,0x0103)->GetValue() << " - Expected : 0" << std::endl << " ... Failed" << std::endl; - delete fh1; - delete f1; + delete fh; + delete f; return 1; } @@ -246,8 +247,8 @@ int TestMakeIcon (int argc, char *argv[]) { std::cout << "BinEntry 0005|0010 not found" << std::endl << " ... Failed" << std::endl; - delete fh1; - delete f1; + delete fh; + delete f; return 1; } std::cout << "First Item ->BinEntry 0005|0010 found" << std::endl; @@ -257,8 +258,8 @@ int TestMakeIcon (int argc, char *argv[]) << "Read : " << sqi->GetValEntry(0x0005,0x0010)->GetLength() << " - Expected : 6" << std::endl << " ... Failed" << std::endl; - delete fh1; - delete f1; + delete fh; + delete f; return 1; } @@ -268,14 +269,14 @@ int TestMakeIcon (int argc, char *argv[]) { std::cout << "Value 0005|0010 don't match (BinEntry)" << std::endl << " ... Failed" << std::endl; - delete fh1; - delete f1; + delete fh; + delete f; return 1; } std::cout << "Value BinEntry 0005|0010 OK" << std::endl; - delete fh1; - delete f1; + delete fh; + delete f; std::cout << " ... OK" << std::endl; return 0; diff --git a/Testing/TestSerieHelper.cxx b/Testing/TestSerieHelper.cxx index 02f06f8e..5ab5a289 100644 --- a/Testing/TestSerieHelper.cxx +++ b/Testing/TestSerieHelper.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestSerieHelper.cxx,v $ Language: C++ - Date: $Date: 2005/05/26 18:50:45 $ - Version: $Revision: 1.4 $ + Date: $Date: 2005/07/08 13:39:57 $ + Version: $Revision: 1.5 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -38,7 +38,7 @@ int TestSerieHelper(int argc, char *argv[]) std::cout << "Dir Name :[" << dirName << "]" << std::endl; s = new gdcm::SerieHelper(); - s->SetDirectory(dirName, true); // true : recursive exploration + s->SetDirectory(dirName, true); // true : recursive exploration std::cout << " -------------------------------------------Finish parsing :[" << dirName << "]" << std::endl; diff --git a/Testing/TestWriteSimple.cxx b/Testing/TestWriteSimple.cxx index f349bcee..4bdbfbfb 100644 --- a/Testing/TestWriteSimple.cxx +++ b/Testing/TestWriteSimple.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestWriteSimple.cxx,v $ Language: C++ - Date: $Date: 2005/06/03 10:15:19 $ - Version: $Revision: 1.30 $ + Date: $Date: 2005/07/08 13:39:57 $ + Version: $Revision: 1.31 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -168,6 +168,7 @@ int WriteSimple(Image &img) + // Step 2 : Create the output image std::cout << "2..."; if( img.componentSize%8 > 0 ) -- 2.48.1