From 494aa96ecf94b849d344c999bfb061efbd942c87 Mon Sep 17 00:00:00 2001 From: jpr Date: Mon, 17 Oct 2005 10:41:59 +0000 Subject: [PATCH] Remove useless Example/TestFromScratch.cxx (Example/TestCopyDicom does the same jpb) --- Example/CMakeLists.txt | 1 - Example/TestCopyDicom.cxx | 10 ++-- Example/TestFromScratch.cxx | 94 ------------------------------------- 3 files changed, 7 insertions(+), 98 deletions(-) delete mode 100644 Example/TestFromScratch.cxx diff --git a/Example/CMakeLists.txt b/Example/CMakeLists.txt index ae92fe9d..4be063c8 100644 --- a/Example/CMakeLists.txt +++ b/Example/CMakeLists.txt @@ -37,7 +37,6 @@ SET(EXAMPLE_SOURCES FlatHashTablePrint TestCopyDicom TestChangeHeader - TestFromScratch Volume2Dicom WriteDicomSimple WriteRead diff --git a/Example/TestCopyDicom.cxx b/Example/TestCopyDicom.cxx index 9916f6a4..f44754df 100644 --- a/Example/TestCopyDicom.cxx +++ b/Example/TestCopyDicom.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestCopyDicom.cxx,v $ Language: C++ - Date: $Date: 2005/09/22 14:45:11 $ - Version: $Revision: 1.29 $ + Date: $Date: 2005/10/17 10:41:59 $ + Version: $Revision: 1.30 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -99,7 +99,7 @@ int main(int argc, char *argv[]) //dataSize = original->GetImageDataSize();// just an accesor :useless here imageData = original->GetImageData(); // VERY important : - // brings pixels in memory ! + // brings pixels into memory ! //(void)imageData; // not enough to avoid warning with icc compiler //(void)dataSize; // not enough to avoid warning on 'Golgot' @@ -144,7 +144,11 @@ int main(int argc, char *argv[]) std::cout << "--- ---- ----------------------" << std::endl; copy->WriteDcmExplVR( output ); + + delete fileOr; // File + delete original; // FileHelper + delete copy; // FileHelper return 0; } diff --git a/Example/TestFromScratch.cxx b/Example/TestFromScratch.cxx deleted file mode 100644 index 20f52c07..00000000 --- a/Example/TestFromScratch.cxx +++ /dev/null @@ -1,94 +0,0 @@ -/*========================================================================= - - Program: gdcm - Module: $RCSfile: TestFromScratch.cxx,v $ - Language: C++ - Date: $Date: 2005/07/08 12:02:02 $ - Version: $Revision: 1.18 $ - - Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de - l'Image). All rights reserved. See Doc/License.txt or - http://www.creatis.insa-lyon.fr/Public/Gdcm/License.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 notices for more information. - -=========================================================================*/ -#include "gdcmFile.h" -#include "gdcmFileHelper.h" -#include "gdcmDictEntry.h" -#include "gdcmDocEntry.h" -#include "gdcmBinEntry.h" -#include "gdcmValEntry.h" -#include "gdcmDebug.h" - -// The whole purpose of this example is to create a DICOM from scratch -// well almost the only thing we allow use is to copy the string entry -// From the previous image read. - -int main(int argc, char *argv[]) -{ - if( argc < 2 ) - { - std::cerr << "Usage: " << argv[0] << " Image.dcm" << std::endl; - return 1; - } - - - // Doesn't seem to do anything: - gdcm::Debug::DebugOn(); - - // Doesn't link properly: - //gdcm::Debug::GetReference().SetDebug(1); - - std::string filename = argv[1]; - gdcm::File *h1 = new gdcm::File(); - h1->SetFileName( filename ); - h1->Load( ); - gdcm::FileHelper *f1 = new gdcm::FileHelper( h1 ); - - - int dataSize = f1->GetImageDataSize(); - std::cout << "DataSize: " << dataSize << std::endl; - // Since we know the image is 16bits: - uint8_t *imageData = f1->GetImageData(); - - // Hopefully default to something - gdcm::File *h2 = new gdcm::File(); - - // Copy of the header content - gdcm::DocEntry *d = h1->GetFirstEntry(); - while(d) - { - if ( gdcm::ValEntry *v = dynamic_cast(d) ) - { - // Do not bother with field from private dict - if( v->GetName() != "gdcm::Unknown" ) - { - h2->InsertValEntry( v->GetValue(), - v->GetGroup(),v->GetElement(), - v->GetVR() ); - } - } - //else - // We skip pb of SQ recursive exploration - // We skip bin entries - - d = h1->GetNextEntry(); - } - h2->Print( std::cout ); - - gdcm::FileHelper *f2 = new gdcm::FileHelper( h2 ); - f2->SetImageData(imageData, dataSize); - - f2->SetWriteTypeToDcmExplVR(); - f2->Write( "output.dcm" ); - - delete f1; - delete f2; - delete h1; - delete h2; - - return 0; -} -- 2.45.1