From: regrain Date: Fri, 26 Nov 2004 10:55:02 +0000 (+0000) Subject: * Remove some useless methods in gdcm::Document, gdcm::Header and gdcm::File X-Git-Tag: Version1.0.bp~564 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=af698856153f426a4d852b6645e238f669d42276;p=gdcm.git * Remove some useless methods in gdcm::Document, gdcm::Header and gdcm::File * Rename gdcmHeaderHelper.[h|cxx] to gdcmSerieHeader.[h|cxx] to be coherent between the class name and the file name -- BeNours --- diff --git a/ChangeLog b/ChangeLog index 3c1e7dcc..aff435cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ +2004-11-26 Benoit Regrain + * Remove some useless methods in gdcm::Document, gdcm::Header and gdcm::File + * Rename gdcmHeaderHelper.[h|cxx] to gdcmSerieHeader.[h|cxx] to be coherent + between the class name and the file name + 2004-11-25 Benoit Regrain - * src/ : fix compilation warnings for the Write method (2 different + * src/ : fix compilation warnings for the Write method (2 different proto). So Rename 'Write(ifstream* fp' into 'WriteContent(ifstream* fp' fix compilation warnings for the gdcm::Document::TransferSyntaxStrings variable... create a static method in gdcm::Document to access to @@ -8,7 +13,7 @@ 2004-11-25 Benoit Regrain * src/gdcmDocument.[h|cxx] : set the Transfert Syntax values to the header file, to be accessed by other files (like gdcmFile). Remove commented - code. Move the change of the header to the gdcmFile, using the + code. Move the change of the header to the gdcmFile, using the DocEntryArchive * src/gdcmHeader.[h|cxx] : the write is completely made in the Header. To be sure of that (and simplify calls), the Write of the header now diff --git a/Example/WriteDicom.cxx b/Example/WriteDicom.cxx index c8747dc3..7116f734 100644 --- a/Example/WriteDicom.cxx +++ b/Example/WriteDicom.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: WriteDicom.cxx,v $ Language: C++ - Date: $Date: 2004/11/16 04:26:18 $ - Version: $Revision: 1.7 $ + Date: $Date: 2004/11/26 10:55:03 $ + Version: $Revision: 1.8 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -61,7 +61,6 @@ int main(int argc, char* argv[]) // TODO : Shouldn't we merge those two functions ? f1->SetImageData( imageData, dataSize); - f1->GetHeader()->SetImageDataSize( dataSize ); f1->GetHeader()->Print(); diff --git a/Testing/TestChangeHeader.cxx b/Testing/TestChangeHeader.cxx index 3f873524..3fb0ab9a 100644 --- a/Testing/TestChangeHeader.cxx +++ b/Testing/TestChangeHeader.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestChangeHeader.cxx,v $ Language: C++ - Date: $Date: 2004/11/16 04:28:20 $ - Version: $Revision: 1.26 $ + Date: $Date: 2004/11/26 10:55:03 $ + 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 @@ -83,7 +83,6 @@ int TestChangeHeader(int argc, char* argv[]) // TODO : Why don't we merge theese 2 functions ? f1->SetImageData(imageData,dataSize); - f1->GetHeader()->SetImageDataSize(dataSize); f1->GetHeader()->Print(); diff --git a/Testing/TestCopyDicom.cxx b/Testing/TestCopyDicom.cxx index c7e74012..cfbbfcdf 100644 --- a/Testing/TestCopyDicom.cxx +++ b/Testing/TestCopyDicom.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestCopyDicom.cxx,v $ Language: C++ - Date: $Date: 2004/11/25 10:24:33 $ - Version: $Revision: 1.22 $ + Date: $Date: 2004/11/26 10:55:03 $ + Version: $Revision: 1.23 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -129,8 +129,6 @@ int CopyDicom(std::string const & filename, // Useless to set the image datas, because it's already made when // copying the corresponding BinEntry that contains the pixel datas copy->SetImageData(imageData, dataSize); -// copy->GetImageData(); -// original->GetHeader()->SetImageDataSize(dataSize); //////////////// Step 3: std::cout << "3..."; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b52f680a..bbdd6693 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -33,7 +33,6 @@ SET(libgdcm_la_SOURCES gdcmFile.cxx gdcmGlobal.cxx gdcmHeader.cxx - gdcmHeaderHelper.cxx gdcmJPEGFragment.cxx gdcmJPEGFragmentsInfo.cxx gdcmJpeg8.cxx @@ -44,6 +43,7 @@ SET(libgdcm_la_SOURCES gdcmRLEFrame.cxx gdcmRLEFramesInfo.cxx gdcmSeqEntry.cxx + gdcmSerieHeader.cxx gdcmSQItem.cxx gdcmTS.cxx gdcmUtil.cxx diff --git a/src/gdcm.h b/src/gdcm.h index 05ecafd4..8408d4f8 100644 --- a/src/gdcm.h +++ b/src/gdcm.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcm.h,v $ Language: C++ - Date: $Date: 2004/09/27 08:39:05 $ - Version: $Revision: 1.49 $ + Date: $Date: 2004/11/26 10:55:04 $ + Version: $Revision: 1.50 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -31,7 +31,7 @@ #include "gdcmDocument.h" #include "gdcmHeader.h" -#include "gdcmHeaderHelper.h" +#include "gdcmSerieHeader.h" #include "gdcmFile.h" #include "gdcmUtil.h" diff --git a/src/gdcmDocument.cxx b/src/gdcmDocument.cxx index 0d32d8fc..a26f291e 100644 --- a/src/gdcmDocument.cxx +++ b/src/gdcmDocument.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocument.cxx,v $ Language: C++ - Date: $Date: 2004/11/25 16:35:16 $ - Version: $Revision: 1.141 $ + Date: $Date: 2004/11/26 10:55:04 $ + Version: $Revision: 1.142 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -979,7 +979,7 @@ bool Document::SetEntryByNumber(uint8_t*content, int lgth, * @param element element number of the Entry to modify * @return true on success, false otherwise. */ -bool Document::SetEntryLengthByNumber(uint32_t l, +/*bool Document::SetEntryLengthByNumber(uint32_t l, uint16_t group, uint16_t element) { /// \todo use map methods, instead of multimap JPR @@ -995,7 +995,7 @@ bool Document::SetEntryLengthByNumber(uint32_t l, ( ((TagHT.equal_range(key)).first)->second )->SetLength(l); return true ; -} +}*/ /** * \brief Gets (from Header) the offset of a 'non string' element value @@ -1004,7 +1004,7 @@ bool Document::SetEntryLengthByNumber(uint32_t l, * @param elem element number of the Entry * @return File Offset of the Element Value */ -size_t Document::GetEntryOffsetByNumber(uint16_t group, uint16_t elem) +/*size_t Document::GetEntryOffsetByNumber(uint16_t group, uint16_t elem) { DocEntry* entry = GetDocEntryByNumber(group, elem); if (!entry) @@ -1013,7 +1013,7 @@ size_t Document::GetEntryOffsetByNumber(uint16_t group, uint16_t elem) return 0; } return entry->GetOffset(); -} +}*/ /** * \brief Gets (from Header) a 'non string' element value @@ -1056,30 +1056,6 @@ void Document::LoadEntryBinArea(uint16_t group, uint16_t elem) return; LoadEntryBinArea(binElement); -/* size_t o =(size_t)docElement->GetOffset(); - Fp->seekg( o, std::ios_base::beg); - size_t l = docElement->GetLength(); - uint8_t* a = new uint8_t[l]; - if(!a) - { - dbg.Verbose(0, "Document::LoadEntryBinArea cannot allocate a"); - return; - } - - // Read the value - Fp->read((char*)a, l); - if( Fp->fail() || Fp->eof() )//Fp->gcount() == 1 - { - delete[] a; - return; - } - - // Set the value to the DocEntry - if( !SetEntryBinAreaByNumber( a, group, elem ) ) - { - delete[] a; - dbg.Verbose(0, "Document::LoadEntryBinArea setting failed."); - }*/ } /** @@ -1128,7 +1104,7 @@ void Document::LoadEntryBinArea(BinEntry* element) * @param element Element number of the searched Dicom Element * @return */ -bool Document::SetEntryBinAreaByNumber(uint8_t* area, +/*bool Document::SetEntryBinAreaByNumber(uint8_t* area, uint16_t group, uint16_t element) { DocEntry* currentEntry = GetDocEntryByNumber(group, element); @@ -1144,7 +1120,7 @@ bool Document::SetEntryBinAreaByNumber(uint8_t* area, } return false; -} +}*/ /** * \brief Update the entries with the shadow dictionary. diff --git a/src/gdcmDocument.h b/src/gdcmDocument.h index 9682e57b..7e4e8d99 100644 --- a/src/gdcmDocument.h +++ b/src/gdcmDocument.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocument.h,v $ Language: C++ - Date: $Date: 2004/11/25 16:35:17 $ - Version: $Revision: 1.65 $ + Date: $Date: 2004/11/26 10:55:04 $ + Version: $Revision: 1.66 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -196,19 +196,28 @@ public: virtual std::string GetEntryVRByNumber(uint16_t group, uint16_t elem); virtual int GetEntryLengthByNumber(uint16_t group, uint16_t elem); //protected: - virtual bool SetEntryByName ( std::string const & content, - TagName const & tagName ); + virtual bool SetEntryByName (std::string const & content, + TagName const & tagName ); virtual bool SetEntryByNumber(std::string const & content, uint16_t group, uint16_t element); virtual bool SetEntryByNumber(uint8_t* content, int lgth, uint16_t group, uint16_t element); - virtual bool SetEntryLengthByNumber(uint32_t length, - uint16_t group, uint16_t element); - - virtual size_t GetEntryOffsetByNumber(uint16_t group, uint16_t elem); + // FIXME + // Verify the usefull of this method... otherwise remove it + // It's body is commented in the .xx + //virtual bool SetEntryLengthByNumber(uint32_t length, + // uint16_t group, uint16_t element); + + // FIXME + // Verify the usefull of this method... otherwise remove it + // It's body is commented in the .xx + // virtual size_t GetEntryOffsetByNumber(uint16_t group, uint16_t elem); virtual void* GetEntryBinAreaByNumber(uint16_t group, uint16_t elem); - virtual bool SetEntryBinAreaByNumber(uint8_t* a, uint16_t group, - uint16_t elem); + // FIXME + // Verify the usefull of this method... otherwise remove it + // It's body is commented in the .xx + //virtual bool SetEntryBinAreaByNumber(uint8_t* a, uint16_t group, + // uint16_t elem); virtual void UpdateShaEntries(); diff --git a/src/gdcmFile.cxx b/src/gdcmFile.cxx index f362a3d9..ca361e54 100644 --- a/src/gdcmFile.cxx +++ b/src/gdcmFile.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmFile.cxx,v $ Language: C++ - Date: $Date: 2004/11/25 16:35:17 $ - Version: $Revision: 1.165 $ + Date: $Date: 2004/11/26 10:55:04 $ + Version: $Revision: 1.166 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -772,23 +772,6 @@ BinEntry* File::CopyBinEntry(uint16_t group,uint16_t element) //----------------------------------------------------------------------------- // Private -/** - * \brief Set the pixel datas in the good entry of the Header - */ -void File::SetPixelData(uint8_t* data) -{ - GetHeader()->SetEntryByNumber( GDCM_BINLOADED, - GetHeader()->GetGrPixel(), GetHeader()->GetNumPixel()); - - // Will be 7fe0, 0010 in standard case - DocEntry* currentEntry = GetHeader()->GetDocEntryByNumber(GetHeader()->GetGrPixel(), GetHeader()->GetNumPixel()); - if ( currentEntry ) - { - if ( BinEntry* binEntry = dynamic_cast(currentEntry) ) - // Flag is to false because datas are kept in the gdcmPixelConvert - binEntry->SetBinArea( data, false ); - } -} //----------------------------------------------------------------------------- } // end namespace gdcm diff --git a/src/gdcmFile.h b/src/gdcmFile.h index 02eaae75..7637b7bd 100644 --- a/src/gdcmFile.h +++ b/src/gdcmFile.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmFile.h,v $ Language: C++ - Date: $Date: 2004/11/25 13:12:02 $ - Version: $Revision: 1.77 $ + Date: $Date: 2004/11/26 10:55:04 $ + Version: $Revision: 1.78 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -68,7 +68,6 @@ public: uint8_t* GetImageDataRaw(); size_t GetImageDataIntoVector(void* destination, size_t maxSize); - // see also Header::SetImageDataSize ?!? bool SetImageData (uint8_t* data, size_t expectedSize); // Write pixels of ONE image on hard drive @@ -129,8 +128,6 @@ private: uint8_t* GetDecompressed(); int ComputeDecompressedPixelDataSizeFromHeader(); - void SetPixelData(uint8_t* data); - private: // members variables: diff --git a/src/gdcmHeader.cxx b/src/gdcmHeader.cxx index 6e43c2bc..2ccd0ac1 100644 --- a/src/gdcmHeader.cxx +++ b/src/gdcmHeader.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmHeader.cxx,v $ Language: C++ - Date: $Date: 2004/11/25 15:46:11 $ - Version: $Revision: 1.207 $ + Date: $Date: 2004/11/26 10:55:04 $ + Version: $Revision: 1.208 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -1176,28 +1176,6 @@ std::string Header::GetTransfertSyntaxName() return tsName; } -/** - * \brief Sets the Pixel Area size in the Header - * --> not-for-rats function - * @param ImageDataSize new Pixel Area Size - * warning : nothing else is checked - */ -void Header::SetImageDataSize(size_t ImageDataSize) -{ - ///FIXME I don't understand this code why do we set two times 'car' ? - std::string car = Util::Format("%d", ImageDataSize); - - DocEntry *a = GetDocEntryByNumber(GrPixel, NumPixel); - a->SetLength(ImageDataSize); - - // Change the value of the BinEntry, not the BinArea !!! - ImageDataSize += 8; - car = Util::Format("%d", ImageDataSize); - car = Util::DicomString( car.c_str() ); - - SetEntryByNumber(car, GrPixel, NumPixel); -} - //----------------------------------------------------------------------------- // Protected diff --git a/src/gdcmHeader.h b/src/gdcmHeader.h index cbd36527..de5acd13 100644 --- a/src/gdcmHeader.h +++ b/src/gdcmHeader.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmHeader.h,v $ Language: C++ - Date: $Date: 2004/11/25 13:12:02 $ - Version: $Revision: 1.94 $ + Date: $Date: 2004/11/26 10:55:04 $ + Version: $Revision: 1.95 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -169,9 +169,6 @@ public: /// Accessor to \ref Header::NumPixel uint16_t GetNumPixel() { return NumPixel; } - /// Read (used in File) - void SetImageDataSize(size_t expectedSize); - bool Write(std::string fileName, FileType filetype); /// Initialize DICOM header when none diff --git a/src/gdcmHeaderHelper.cxx b/src/gdcmSerieHeader.cxx similarity index 98% rename from src/gdcmHeaderHelper.cxx rename to src/gdcmSerieHeader.cxx index 77d4d166..37da36b1 100644 --- a/src/gdcmHeaderHelper.cxx +++ b/src/gdcmSerieHeader.cxx @@ -1,10 +1,10 @@ /*========================================================================= Program: gdcm - Module: $RCSfile: gdcmHeaderHelper.cxx,v $ + Module: $RCSfile: gdcmSerieHeader.cxx,v $ Language: C++ - Date: $Date: 2004/11/16 18:33:33 $ - Version: $Revision: 1.45 $ + Date: $Date: 2004/11/26 10:55:04 $ + Version: $Revision: 1.1 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -16,7 +16,7 @@ =========================================================================*/ -#include "gdcmHeaderHelper.h" +#include "gdcmSerieHeader.h" #include "gdcmDirList.h" #include "gdcmDebug.h" diff --git a/src/gdcmHeaderHelper.h b/src/gdcmSerieHeader.h similarity index 89% rename from src/gdcmHeaderHelper.h rename to src/gdcmSerieHeader.h index 5dc42bfc..6b062296 100644 --- a/src/gdcmHeaderHelper.h +++ b/src/gdcmSerieHeader.h @@ -1,10 +1,10 @@ /*========================================================================= Program: gdcm - Module: $RCSfile: gdcmHeaderHelper.h,v $ + Module: $RCSfile: gdcmSerieHeader.h,v $ Language: C++ - Date: $Date: 2004/10/12 04:35:46 $ - Version: $Revision: 1.22 $ + Date: $Date: 2004/11/26 10:55:04 $ + Version: $Revision: 1.1 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -16,8 +16,8 @@ =========================================================================*/ -#ifndef GDCMHEADERHELPER_H -#define GDCMHEADERHELPER_H +#ifndef GDCMSERIEHEADER_H +#define GDCMSERIEHEADER_H #include "gdcmHeader.h" @@ -30,7 +30,7 @@ namespace gdcm * \brief * * - This class should be used for a stack of 2D dicom images. - * - For a multiframe dicom image better use directly HeaderHelper + * - For a multiframe dicom image better use directly SerieHeader */ class GDCM_EXPORT SerieHeader {