From f6fd616782f9811f1390c64c9a3e7beb50ca4a04 Mon Sep 17 00:00:00 2001 From: malaterre Date: Fri, 8 Oct 2004 04:52:55 +0000 Subject: [PATCH] ENH: Minor cleanup, still removing stdio.h and co ... --- src/gdcmDocEntry.h | 5 ++--- src/gdcmException.cxx | 5 ++--- src/gdcmGlobal.cxx | 27 ++++++++++++++++----------- src/gdcmJpeg12.cxx | 28 +++++++++++++++++++--------- src/gdcmJpeg2000.cxx | 21 ++++++++++++++++++--- src/gdcmJpeg8.cxx | 28 ++++++++++++++++++---------- src/gdcmRLE.cxx | 35 ++++++++++++++++++++++------------- 7 files changed, 97 insertions(+), 52 deletions(-) diff --git a/src/gdcmDocEntry.h b/src/gdcmDocEntry.h index b704a983..4acd164d 100644 --- a/src/gdcmDocEntry.h +++ b/src/gdcmDocEntry.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocEntry.h,v $ Language: C++ - Date: $Date: 2004/10/07 21:05:39 $ - Version: $Revision: 1.23 $ + Date: $Date: 2004/10/08 04:52:55 $ + Version: $Revision: 1.24 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -21,7 +21,6 @@ #include "gdcmDictEntry.h" #include -#include class gdcmHeader; class gdcmValEntry; diff --git a/src/gdcmException.cxx b/src/gdcmException.cxx index 65ceb756..3f666605 100644 --- a/src/gdcmException.cxx +++ b/src/gdcmException.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmException.cxx,v $ Language: C++ - Date: $Date: 2004/09/27 08:39:07 $ - Version: $Revision: 1.18 $ + Date: $Date: 2004/10/08 04:52:55 $ + Version: $Revision: 1.19 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -19,7 +19,6 @@ #include "gdcmException.h" #include -#include //----------------------------------------------------------------------------- // gdcmException diff --git a/src/gdcmGlobal.cxx b/src/gdcmGlobal.cxx index cc6c279f..0229c8ed 100644 --- a/src/gdcmGlobal.cxx +++ b/src/gdcmGlobal.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmGlobal.cxx,v $ Language: C++ - Date: $Date: 2004/09/27 08:39:07 $ - Version: $Revision: 1.3 $ + Date: $Date: 2004/10/08 04:52:55 $ + 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 @@ -18,9 +18,6 @@ #include "gdcmGlobal.h" #include "gdcmDebug.h" -#include -#include // For isspace -#include // CLEANME: could this be only string ? Related to Win32 ? /** * \ingroup Globals @@ -58,9 +55,12 @@ gdcmGlobal gdcmGlob; * \ingroup gdcmGlobal * \brief constructor : populates the various H Tables */ -gdcmGlobal::gdcmGlobal(void) { +gdcmGlobal::gdcmGlobal() +{ if (VR || TS || Dicts || ddElem) + { dbg.Verbose(0, "gdcmGlobal::gdcmGlobal : VR or TS or Dicts already allocated"); + } Dicts = new gdcmDictSet(); VR = new gdcmVR(); TS = new gdcmTS(); @@ -71,7 +71,8 @@ gdcmGlobal::gdcmGlobal(void) { * \ingroup gdcmGlobal * \brief canonical destructor */ -gdcmGlobal::~gdcmGlobal() { +gdcmGlobal::~gdcmGlobal() +{ delete Dicts; delete VR; delete TS; @@ -81,27 +82,31 @@ gdcmGlobal::~gdcmGlobal() { * \ingroup gdcmGlobal * \brief returns a pointer to the 'Value Representation Table' */ -gdcmVR *gdcmGlobal::GetVR(void) { +gdcmVR *gdcmGlobal::GetVR() +{ return VR; } /** * \ingroup gdcmGlobal * \brief returns a pointer to the 'Transfert Syntax Table' */ -gdcmTS *gdcmGlobal::GetTS(void) { +gdcmTS *gdcmGlobal::GetTS() +{ return TS; } /** * \ingroup gdcmGlobal * \brief returns a pointer to Dictionaries Table */ -gdcmDictSet *gdcmGlobal::GetDicts(void) { +gdcmDictSet *gdcmGlobal::GetDicts() +{ return Dicts; } /** * \ingroup gdcmGlobal * \brief returns a pointer to the DicomDir related elements Table */ -gdcmDicomDirElement *gdcmGlobal::GetDicomDirElements(void) { +gdcmDicomDirElement *gdcmGlobal::GetDicomDirElements() +{ return ddElem; } diff --git a/src/gdcmJpeg12.cxx b/src/gdcmJpeg12.cxx index fe30bbb9..18d0787c 100644 --- a/src/gdcmJpeg12.cxx +++ b/src/gdcmJpeg12.cxx @@ -1,13 +1,22 @@ -// gdcmJpeg12.cxx -//----------------------------------------------------------------------------- -#include -#include "gdcmFile.h" +/*========================================================================= + + Program: gdcm + Module: $RCSfile: gdcmJpeg12.cxx,v $ + Language: C++ + Date: $Date: 2004/10/08 04:52:55 $ + Version: $Revision: 1.17 $ + + 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. + +=========================================================================*/ -#define BITS_IN_JSAMPLE 12 - -#ifdef GDCM_DEBUG -#define GDCM_jpr_DEBUG 0 -#endif //GDCM_DEBUG +#include "gdcmFile.h" /* * is used for the optional error recovery mechanism shown in @@ -23,6 +32,7 @@ */ extern "C" { +#include #include "src/jpeg/libijg12/jconfig.h" #include "src/jpeg/libijg12/jpeglib.h" //#include "jconfig12.h" diff --git a/src/gdcmJpeg2000.cxx b/src/gdcmJpeg2000.cxx index f14f6cd0..3b0499be 100644 --- a/src/gdcmJpeg2000.cxx +++ b/src/gdcmJpeg2000.cxx @@ -1,6 +1,21 @@ -// gdcmJpeg2000.cxx +/*========================================================================= + + Program: gdcm + Module: $RCSfile: gdcmJpeg2000.cxx,v $ + Language: C++ + Date: $Date: 2004/10/08 04:52:55 $ + 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 + 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 #include "gdcmFile.h" //----------------------------------------------------------------------------- @@ -17,7 +32,7 @@ bool gdcmFile::gdcm_read_JPEG2000_file (FILE* fp,void* image_buffer) { (void)fp; //FIXME (void)image_buffer; //FIXME - printf("Sorry JPEG 2000 File not yet taken into account\n"); + std::cout << "Sorry JPEG 2000 File not yet taken into account" << std::endl; return false; } diff --git a/src/gdcmJpeg8.cxx b/src/gdcmJpeg8.cxx index 28d0acd1..24b4f9e6 100644 --- a/src/gdcmJpeg8.cxx +++ b/src/gdcmJpeg8.cxx @@ -1,14 +1,22 @@ -// gdcmJpeg.cxx -//----------------------------------------------------------------------------- -#include +/*========================================================================= + + Program: gdcm + Module: $RCSfile: gdcmJpeg8.cxx,v $ + Language: C++ + Date: $Date: 2004/10/08 04:52:55 $ + 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 + 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" -#define BITS_IN_JSAMPLE 8 - -#ifdef GDCM_DEBUG -#define GDCM_jpr_DEBUG 0 -#endif //GDCM_DEBUG - /* DICOM provides a mechanism for supporting the use of JPEG Image Compression through the Encapsulated Format (see PS 3.3 of the DICOM Standard). @@ -77,7 +85,7 @@ of the uncompressed pixel data from which the compressed data is derived */ extern "C" { -//#include "jpeglib.h" +//#include "stdio.h" #include "src/jpeg/libijg8/jconfig.h" #include "src/jpeg/libijg8/jpeglib.h" diff --git a/src/gdcmRLE.cxx b/src/gdcmRLE.cxx index fd2cf2b3..229c13a5 100644 --- a/src/gdcmRLE.cxx +++ b/src/gdcmRLE.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmRLE.cxx,v $ Language: C++ - Date: $Date: 2004/10/06 22:31:31 $ - Version: $Revision: 1.24 $ + Date: $Date: 2004/10/08 04:52:55 $ + Version: $Revision: 1.25 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -16,9 +16,7 @@ =========================================================================*/ -#include #include "gdcmFile.h" -#include // For isprint() #define str2num(str, typeNum) *((typeNum *)(str)) @@ -31,7 +29,8 @@ * at which the pixel data should be copied * @return Boolean */ -bool gdcmFile::gdcm_read_RLE_file (FILE* fp,void* image_buffer) { +bool gdcmFile::gdcm_read_RLE_file (FILE* fp,void* image_buffer) +{ char * im = (char *)image_buffer; long uncompressedSegmentSize = Header->GetXSize() * Header->GetYSize(); @@ -52,7 +51,9 @@ bool gdcmFile::gdcm_read_RLE_file (FILE* fp,void* image_buffer) { } } - if (Header->GetBitsAllocated()==16) { // try to deal with RLE 16 Bits + if (Header->GetBitsAllocated()==16) + { + // try to deal with RLE 16 Bits im = (char *)image_buffer; // need to make 16 Bits Pixels from Low Byte and Hight Byte 'Planes' @@ -65,8 +66,10 @@ bool gdcmFile::gdcm_read_RLE_file (FILE* fp,void* image_buffer) { char * a = (char *)image_buffer; char * b = a + l; - for (int i=0;i= 0 && count <= 127) { + if (count >= 0 && count <= 127) + { fread(*areaToRead,(count+1)*sizeof(char),1,fp); *areaToRead+=count+1; numberOfOutputBytes+=count+1; - } else { - if (count <= -1 && count >= -127) { + } + else + { + if (count <= -1 && count >= -127) + { fread(&car,sizeof(char),1,fp); - for(int i=0; i<-count+1; i++) { + for(int i=0; i<-count+1; i++) + { (*areaToRead)[i]=car; } *areaToRead+=(-count+1); -- 2.46.1