From 6b0359d3c073112a5d6a23114d6adb0fff949e7b Mon Sep 17 00:00:00 2001 From: regrain Date: Wed, 9 Feb 2005 15:06:47 +0000 Subject: [PATCH] * Test/ : accelerate tests (it's not very significant accelerations). Remove TestCopyDicom that is redundant with TestCopyRescaleDicom -- BeNours --- ChangeLog | 4 ++++ Testing/CMakeLists.txt | 14 +++++++------- Testing/TestCopyRescaleDicom.cxx | 12 ++++++++---- Testing/TestReadWriteReadCompare.cxx | 24 +++--------------------- Testing/VTKTestRead.cxx | 17 +++-------------- 5 files changed, 25 insertions(+), 46 deletions(-) diff --git a/ChangeLog b/ChangeLog index 52dceec6..26c6f887 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-02-09 Benoit Regrain + * Test/ : accelerate tests (it's not very significant accelerations). + Remove TestCopyDicom that is redundant with TestCopyRescaleDicom + 2005-02-07 Benoit Regrain * Testing/TestSequence.cxx : add test for sequences of images... test that we have the same serie or the same study UID diff --git a/Testing/CMakeLists.txt b/Testing/CMakeLists.txt index 913593ce..ee0639e9 100644 --- a/Testing/CMakeLists.txt +++ b/Testing/CMakeLists.txt @@ -13,28 +13,28 @@ SET(TEST_SOURCES TestHash.cxx TestTS.cxx TestVR.cxx - TestDicomDirElement.cxx - TestDicomString.cxx TestDict.cxx TestWriteSimple.cxx TestSequence.cxx + TestDicomDirElement.cxx + TestDicomString.cxx ) # add tests that require data IF (GDCM_DATA_ROOT) SET(TEST_SOURCES ${TEST_SOURCES} TestFileAccessors.cxx - TestReadWriteReadCompare.cxx # includes generated gdcmDataImages.h TestPrintAllDocument.cxx # includes generated gdcmDataImages.h - TestAllReadCompareDicom.cxx # includes generated gdcmDataImages.h TestAllEntryVerify.cxx # includes generated gdcmDataImages.h - #TestChangeHeader.cxx - TestCopyDicom.cxx # includes generated gdcmDataImages.h + TestAllReadCompareDicom.cxx # includes generated gdcmDataImages.h + TestReadWriteReadCompare.cxx # includes generated gdcmDataImages.h + #TestCopyDicom.cxx # includes generated gdcmDataImages.h TestCopyRescaleDicom.cxx # includes generated gdcmDataImages.h + #TestChangeHeader.cxx + TestDirList.cxx TestDicomDir.cxx # require DICOMDIR TestBuildUpDicomDir.cxx # writes a file named "NewDICOMDIR" TestMakeDicomDir.cxx # writes a file named "NewDICOMDIR" - TestDirList.cxx TestSerieHelper.cxx # uses gdcmData as a default root directory ) # add test that require VTK: diff --git a/Testing/TestCopyRescaleDicom.cxx b/Testing/TestCopyRescaleDicom.cxx index a5a9a1b5..392e7c27 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/02/03 10:00:06 $ - Version: $Revision: 1.14 $ + Date: $Date: 2005/02/09 15:06:48 $ + Version: $Revision: 1.15 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -90,15 +90,19 @@ int CopyRescaleDicom(std::string const &filename, copyF->InsertValEntry( "8", 0x0028, 0x0101); // Bits Stored copyF->InsertValEntry( "7", 0x0028, 0x0102); // High Bit copyF->InsertValEntry( "0", 0x0028, 0x0103); // Pixel Representation - + // We assume the value were from 0 to uint16_t max rescaleSize = dataSize / 2; rescaleImage = new uint8_t[dataSize]; uint16_t *imageData16 = (uint16_t*)original->GetImageData(); + uint16_t *tmpImage = imageData16; + uint8_t *tmpRescale = rescaleImage; for(unsigned int i=0; i>8; + tmpImage++; + tmpRescale++; } } else diff --git a/Testing/TestReadWriteReadCompare.cxx b/Testing/TestReadWriteReadCompare.cxx index 8a821950..48a03f8b 100644 --- a/Testing/TestReadWriteReadCompare.cxx +++ b/Testing/TestReadWriteReadCompare.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestReadWriteReadCompare.cxx,v $ Language: C++ - Date: $Date: 2005/02/02 10:05:26 $ - Version: $Revision: 1.21 $ + Date: $Date: 2005/02/09 15:06:48 $ + Version: $Revision: 1.22 $ 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,6 @@ int CompareInternal(std::string const & filename, std::string const & output) std::cout << " step 1..."; //////////////// Step 2: - gdcm::FileHelper *filehelper = new gdcm::FileHelper( file ); int dataSize = filehelper->GetImageDataSize(); uint8_t *imageData = filehelper->GetImageData(); //EXTREMELY IMPORTANT @@ -46,30 +45,13 @@ int CompareInternal(std::string const & filename, std::string const & output) // GetImageData or if he wants to GetImageDataRaw // (even if we do it by setting a flag, he will have to decide) - /// \todo Following line commented out because gdcmFile::SetImageData() is - /// brain dead: it sets ImageDataSize to its argument and PixelRead to a. - /// Later on, when writing gdcmFile::WriteBase() - /// and because PixelRead == 1 we call - /// PixelElement->SetLength( ImageDataSizeRaw ); - /// where we use ImageDataSizeRAW instead of ImageDataSize ! - /// But when the original image made the transformation LUT -> RGB, - /// ImageDataSizeRaw is the third of ImageDataSize, and there is no - /// reason (since we called gdcmFile::SetImageData) to use the Raw image - /// size... This "bug" in gdcmFile made that we had to black list - /// images 8BitsUncompressedColor.dcm, OT-PAL-8-face.dcm and - /// US-PAL-8-10x-echo.dcm... - /// In conclusion fix gdcmFile, and then uncomment the following line. - - // --> I did. ctest doesn't break. But ... is it enought to say it's OK ? - - filehelper->SetImageData(imageData, dataSize); + //filehelper->SetImageData(imageData, dataSize); filehelper->SetWriteModeToRGB(); filehelper->WriteDcmExplVR( output ); std::cout << "2..."; //////////////// Step 3: - gdcm::FileHelper *reread = new gdcm::FileHelper( output ); if( !reread->GetFile()->IsReadable() ) { diff --git a/Testing/VTKTestRead.cxx b/Testing/VTKTestRead.cxx index 89015c9e..88a6157e 100644 --- a/Testing/VTKTestRead.cxx +++ b/Testing/VTKTestRead.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: VTKTestRead.cxx,v $ Language: C++ - Date: $Date: 2005/02/02 10:05:26 $ - Version: $Revision: 1.9 $ + Date: $Date: 2005/02/09 15:06:48 $ + Version: $Revision: 1.10 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -50,19 +50,8 @@ int VTKReadTest(vtkTesting *t,vtkImageViewer *viewer, t->AddArgument("-T"); t->AddArgument( "." ); - // Instead of directly reading the dicom let's write it down to another file - // do a scope to be sure everything gets cleanup - { - gdcm::FileHelper file( filename ); - file.GetImageData(); - file.SetWriteModeToRaw(); - file.WriteDcmExplVR( "TestWrite.dcm" ); - } - - // Ok for now still use the original image, vtkGdcmReader *reader = vtkGdcmReader::New(); - //reader->SetFileName( filename.c_str() ); - reader->SetFileName( "TestWrite.dcm" ); + reader->SetFileName( filename.c_str() ); reader->Update(); double range[2]; -- 2.45.1