From 72911a1e847536580a21f85f211c0a14cdcf944c Mon Sep 17 00:00:00 2001 From: jpr Date: Tue, 23 Mar 2004 14:31:32 +0000 Subject: [PATCH] 2004-03-23 Jean-Pierre Roux * FIX Now gdcmFile::SwapZone doesn't seg faults any longer for big endian made volumes * ENH Now gdcmParser constructor and destructor are protected to forbid end user to instanciate class gdcmParser (only gdcmHeader and gdcmDicomDir are meaningfull) --- ChangeLog | 105 +++++++++++++++++++++++------------------- src/gdcmDicomDir.cxx | 9 ++-- src/gdcmFile.cxx | 13 +++--- src/gdcmParser.h | 5 +- vtk/vtkGdcmReader.cxx | 2 +- 5 files changed, 74 insertions(+), 60 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7679be8e..107bf87e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ + +2004-03-23 Jean-Pierre Roux + * FIX Now gdcmFile::SwapZone doesn't seg faults any longer for + big endian made volumes + * ENH Now gdcmParser constructor and destructor are protected to forbid + end user to instanciate class gdcmParser + (only gdcmHeader and gdcmDicomDir are meaningfull) + 2004-03-22 Benoit Regrain * FIX : src/gdcmDicomDir.cxx : make windows compilable * FIX : gdcmPython/gdcm.i : change gdcmStudy to gdcmDicomDirStudy and @@ -24,12 +32,13 @@ of gdcmDicomDirImage::NewImage as empty function. 2004-02-28 Jean-Pierre Roux - *ENH add gdcmDicomDir:NewPatient - add gdcmDicomDirPatient:NewStudy - add gdcmDicomDirStudy:NewSerie - add gdcmDicomDirSerie:NewImage - to allow making gdcDicomDir object. - *ADD PrintDicomDir executable that uses gdcmDicomDir tree-like structure +<<<<<<< ChangeLog + * ENH add gdcmDicomDir:NewPatient + add gdcmDicomDirPatient:NewStudy + add gdcmDicomDirStudy:NewSerie + add gdcmDicomDirSerie:NewImage + to allow making gdcDicomDir object. + * ADD PrintDicomDir executable that uses gdcmDicomDir tree-like structure (as opposite to the gdcmHeader chained list) 2004-02-11 Benoit Regrain @@ -52,7 +61,7 @@ 2004-02-05 Benoit Regrain * ENH : add methods in gdcmObject to get the hash table or the list of - header entries + header entries * FIX : wrapping python for ListPatient, ListStudy, ListSerie, ListImage * FIX : wrapping python for TagHeaderEntryHT @@ -177,10 +186,10 @@ * bug fix under python 2004-01-16 Jean-Pierre Roux - * removal of class gdcmHeaderEntrySet - * removal of files gdcmHeaderEntrySet.cxx, gdcmHeaderEntrySet.h - * add file gdcmHeader2.cxx - * add method gdcmHeader::SetPrintLevel (for PrintHeader) + * REM removal of class gdcmHeaderEntrySet + * REM removal of files gdcmHeaderEntrySet.cxx, gdcmHeaderEntrySet.h + * ADD add file gdcmHeader2.cxx + * ADD add method gdcmHeader::SetPrintLevel (for PrintHeader) 2004-01-15 Benoit Regrain * src/gdcmDicSet.[h|cxx] : add virtual entries to have a reference of @@ -238,50 +247,52 @@ * Update Windows projects and .cvsignore files 2003-11-12 Jean-Pierre Roux - *ENH gdcmHeader constructor has one more parameter (default value : false) + * ENH gdcmHeader constructor has one more parameter (default value : false) that allows the user to 'go inside' the SeQuences only if he wants to. gdcmElValSet:Print takes it into account 2003-11-12 Mathieu Malaterre - *ENH: Update gdcmPython/CMakeLists - *FIX: (gdcmHeaderHelper) GetRescale and GetSlope - *FIX: (gdcmElValSet) char 'tag' was overiding private members (VC++) + * ENH: Update gdcmPython/CMakeLists + * FIX: (gdcmHeaderHelper) GetRescale and GetSlope + * FIX: (gdcmElValSet) char 'tag' was overiding private members (VC++) 2003-11-10 Jean-Pierre Roux - *FIX : gdcmHeader::LoadElements is now based - on the ListTag listElem member, - not longer on the TagElValueHT tagHt member - *ENH : PrintPubElVal shows (temporarily) both results, - with the tagHt member and the listElem member. - (it's easier to 'see' the problems when using Printheader) - *FIX : old private member LgrElem is now splitted into - ReadLength : Length actually found on disk (updated only - if bug fixing is necessary), for internal use only - UsableLength : Updated by FixFoundLength, to fix a bug - or to allow Parser going on. - Will allow to re-write a kosher header when a SeQuence - with a length (not 0000) is found - Warning : gdcmFile::Write still uses the TagHt (not ListElem) - because gdcmElValSet::Add does not update ListElem - (to be written) + * FIX : gdcmHeader::LoadElements is now based + on the ListTag listElem member, + not longer on the TagElValueHT tagHt member + * ENH : PrintPubElVal shows (temporarily) both results, + with the tagHt member and the listElem member. + (it's easier to 'see' the problems when using Printheader) + + * FIX : old private member LgrElem is now splitted into + ReadLength : Length actually found on disk (updated only + if bug fixing is necessary), for internal + use only + UsableLength : Updated by FixFoundLength, to fix a bug + or to allow Parser going on. + Will allow to re-write a kosher header when a SeQuence + with a length (not 0000) is found + Warning : gdcmFile::Write still uses the TagHt (not ListElem) + because gdcmElValSet::Add does not update ListElem + (to be written) 2003-11-07 Jean-Pierre Roux - *FIX misstyping in Transfert Syntax name table - *ENH gdcmHeader::FixFoundLength now allow to 'go inside' tge SeQuences + * FIX misstyping in Transfert Syntax name table + * ENH gdcmHeader::FixFoundLength now allow to 'go inside' tge SeQuences when they have an actual length (not 0000 nor FFFFF) (Nobody should care of it, but DICOMDIR explorers) 2003-11-06 Mathieu Malaterre - *ENH: vtkgdcmViewer now works with LUT dicom (OT-PAL-face ...) + * ENH: vtkgdcmViewer now works with LUT dicom (OT-PAL-face ...) 2003-11-05 Mathieu Malaterre - *ENH: vtkGdcmReader now supports LUT ! + * ENH: vtkGdcmReader now supports LUT ! (vtkgdcmViewer for now is not able to use them though) 2003-11-05 Jean-Pierre Roux * in testSuite.py : new files names for checking the package - * Fix : Forgot to commit gdcmFile::GetImageDataSizeRaw(); + * FIX : Forgot to commit gdcmFile::GetImageDataSizeRaw(); that returns the pixel area size to the *aware* (vtk) user that DOESN'T want to turn the PALETTE COLOR image into an RGB image @@ -302,9 +313,9 @@ in order to loose the 'history' of un-anonymised images 2003-10-31 Jean-Pierre Roux - *RMV : removal of useless jBitsInJsample.h - for both 8 and 12 Bits JPEG Lossy Libraries - + * RMV : removal of useless jBitsInJsample.h + for both 8 and 12 Bits JPEG Lossy Libraries + 2003-10-31 Jean-Pierre Roux * ENH : Add the functions gdcmFile::GetImageDataRaw gdcmFile::GetImageDataIntoVectorRaw @@ -323,17 +334,17 @@ * FIX : a VC++ intended syntax modif broke the 12/12 Bytes expanding 2003-10-29 Mathieu Malaterre - *ENH: Can be used like this '$vtkgdcmViewer *.dcm' with *.dcm - being coherents dicom files. + * ENH: Can be used like this '$vtkgdcmViewer *.dcm' with *.dcm + being coherents dicom files. 2003-10-29 Mathieu Malaterre - *FIX: DOH ! Forgot about windo$e users, they couldn't read lossless jpeg, + * FIX: DOH ! Forgot about windo$e users, they couldn't read lossless jpeg, from medcon lib ! - *ENH: Turn it into DOS file type to match libgdcmijpeg8.dsp file type - *ENH: Two steps is necessary to please VC++ compiler... - *FIX: DOH ! libgdcmijpg8 -> libgdcmljpeg - *ENH: Add include dir to medcon lib - *FIX: only one function is being exported for now ! + * ENH: Turn it into DOS file type to match libgdcmijpeg8.dsp file type + * ENH: Two steps is necessary to please VC++ compiler... + * FIX: DOH ! libgdcmijpg8 -> libgdcmljpeg + * ENH: Add include dir to medcon lib + * FIX: only one function is being exported for now ! You should use GLOBAL(return type) see ljpg/jpeg.h for more info 2003-10-29 Jean-Pierre Roux diff --git a/src/gdcmDicomDir.cxx b/src/gdcmDicomDir.cxx index b109d1ef..b74bad25 100644 --- a/src/gdcmDicomDir.cxx +++ b/src/gdcmDicomDir.cxx @@ -23,7 +23,9 @@ // For full DICOMDIR description, see: // PS 3.3-2003, pages 731-750 //----------------------------------------------------------------------------- + // Constructor / Destructor + /* * \ingroup gdcmDicomDir * \brief Constructor : Parses recursively the directory and creates the DicomDir @@ -59,7 +61,7 @@ gdcmDicomDir::gdcmDicomDir(const char *Name, bool parseDir, metaElems=NULL; -// gdcmParser already executed +// gdcmParser already executed // if user passed a root directory, sure we didn't get anything if( GetListEntry().begin()==GetListEntry().end() ) @@ -69,7 +71,7 @@ gdcmDicomDir::gdcmDicomDir(const char *Name, bool parseDir, if(strlen(Name)==1 && Name[0]=='.') { // user passed '.' as Name // we get current directory name - char*dummy=(char*) malloc(1000); // TODO : check with Windoze // JPR + char*dummy=(char*) malloc(1000); #ifdef _MSC_VER _getcwd(dummy,(size_t)1000); #else @@ -307,8 +309,7 @@ bool gdcmDicomDir::Write(std::string fileName) fwrite(filePreamble,128,1,fp1); fwrite("DICM",4,1,fp1); free(filePreamble); - //UpdateDirectoryRecordSequenceLength(); // a reecrire en utilisant JPR - // la structure arborescente JPR + UpdateDirectoryRecordSequenceLength(); WriteDicomDirEntries(fp1); fclose(fp1); diff --git a/src/gdcmFile.cxx b/src/gdcmFile.cxx index f802dcb8..62e75550 100644 --- a/src/gdcmFile.cxx +++ b/src/gdcmFile.cxx @@ -196,6 +196,7 @@ void * gdcmFile::GetImageData (void) { PixelData = (void *) malloc(lgrTotale); if (PixelData) GetImageDataIntoVector(PixelData, lgrTotale); + PixelRead=0; // no PixelRaw return(PixelData); } @@ -332,7 +333,7 @@ size_t gdcmFile::GetImageDataIntoVectorRaw (void* destination, size_t MaxSize) { } (void)ReadPixelData(destination); - + // Number of Bits Allocated for storing a Pixel str_nb = Header->GetEntryByNumber(0x0028,0x0100); if (str_nb == GDCM_UNFOUND ) { @@ -378,7 +379,6 @@ size_t gdcmFile::GetImageDataIntoVectorRaw (void* destination, size_t MaxSize) { deb++; } } - // re arange bits inside the bytes if (nbu != nb){ int l = (int)lgrTotale / (nb/8); @@ -772,9 +772,10 @@ if(nb == 16) case 2143: case 4321: - for(i=0;i>8) | ((((unsigned short int*)im)[i])<<8); + } break; default: @@ -788,7 +789,7 @@ if( nb == 32 ) break; case 4321: - for(i=0;i>16; fort= (fort>>8) | (fort<<8); @@ -799,7 +800,7 @@ if( nb == 32 ) break; case 2143: - for(i=0;i>16; fort= (fort>>8) | (fort<<8); @@ -810,7 +811,7 @@ if( nb == 32 ) break; case 3412: - for(i=0;i>16; s32=faible; diff --git a/src/gdcmParser.h b/src/gdcmParser.h index 8335d9f7..1a84b010 100644 --- a/src/gdcmParser.h +++ b/src/gdcmParser.h @@ -120,8 +120,9 @@ public: guint32 UnswapLong(guint32); // needed by gdcmFile protected: -// constructor and destructor are protected to forbid end user to instanciate -// class gdcmParser (only gdcmHeader and gdcmDicomDir are meaningfull) +// constructor and destructor are protected to forbid end user +// to instanciate class gdcmParser +// (only gdcmHeader and gdcmDicomDir are meaningfull) gdcmParser(bool exception_on_error = false); gdcmParser(const char *inFilename, bool exception_on_error = false, diff --git a/vtk/vtkGdcmReader.cxx b/vtk/vtkGdcmReader.cxx index 139623d3..89ff5dc0 100644 --- a/vtk/vtkGdcmReader.cxx +++ b/vtk/vtkGdcmReader.cxx @@ -593,6 +593,7 @@ size_t vtkGdcmReader::LoadImageInMemory( int LineSize = NumComponents * NumColumns * GdcmFile.GetHeader()->GetPixelSize(); unsigned char * Source; + if( GdcmFile.GetHeader()->HasLUT() ) { size = GdcmFile.GetImageDataSizeRaw(); @@ -642,7 +643,6 @@ size_t vtkGdcmReader::LoadImageInMemory( } //GetImageData allocate a (void*)malloc, remove it: free(pSource); - return size; } -- 2.48.1