+2004-09-23 Jean-Pierre Roux
+ * FIX In order not to be poluted any longer by casting problems,
+ the member VoidArea of gdcmBinEntry is now uint8_t* (instead of void *)
+ we can now delete[] it safely
+
2004-09-22 Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
* src/gdcmDocument.cxx: gdcmDocument::~gdcmDocument() doesn't clear (nor
clear) TagHT, which is an inherited member of gdcmElementSet. It is
TagDocEntryHT & Ht = original->GetHeader()->GetEntry();
size_t dataSize = original->GetImageDataSize();
- void *imageData = original->GetImageData();
+ uint8_t* imageData = original->GetImageData();
//First of all copy the header field by field
gdcmFile* file = new gdcmFile( header );
int dataSize = file->GetImageDataSize();
- void* imageData = file->GetImageData(); //EXTREMELY IMPORTANT
+ uint8_t* imageData = file->GetImageData(); //EXTREMELY IMPORTANT
// Sure, it is : It's up to the user to decide if he wants to
// GetImageData or if he wants to GetImageDataRaw
// (even if we do it by setting a flag, he will have to decide)
int dataSize = f2->GetImageDataSize();
// unsigned char cast is necessary to be able to delete the buffer
// since deleting a void* is not allowed in c++
- char *imageData = (char*)f2->GetImageData();
+ uint8_t* imageData = (uint8_t*)f2->GetImageData();
f2->SetImageData( imageData, dataSize);
// and that does the job
int dataSize = f2->GetImageDataSize();
- void *imageData = f2->GetImageData();
+ uint8_t* imageData = f2->GetImageData();
std::cout << "dataSize :" << dataSize << std::endl;
TagDocEntryHT & Ht = original->GetHeader()->GetEntry();
size_t dataSize = original->GetImageDataSize();
- void *imageData = original->GetImageData();
+ uint8_t* imageData = original->GetImageData();
//First of all copy the header field by field
gdcmFile* file = new gdcmFile( header );
int dataSize = file->GetImageDataSize();
- void* imageData = file->GetImageData(); //EXTREMELY IMPORTANT
+ uint8_t* imageData = file->GetImageData(); //EXTREMELY IMPORTANT
// Sure, it is : It's up to the user to decide if he wants to
// GetImageData or if he wants to GetImageDataRaw
// (even if we do it by setting a flag, he will have to decide)
Program: gdcm
Module: $RCSfile: gdcmBinEntry.cxx,v $
Language: C++
- Date: $Date: 2004/09/20 18:14:23 $
- Version: $Revision: 1.28 $
+ Date: $Date: 2004/09/23 09:40:30 $
+ Version: $Revision: 1.29 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
{
if (VoidArea)
{
- free (VoidArea);
+ delete[] VoidArea;
VoidArea = 0; // let's be carefull !
}
}
/// \brief Sets the value (non string) of the current Dicom Header Entry
-void gdcmBinEntry::SetVoidArea( void* area )
+void gdcmBinEntry::SetVoidArea( uint8_t* area )
{
if (VoidArea)
- free(VoidArea);
+ delete[] VoidArea;
VoidArea = area;
}
Program: gdcm
Module: $RCSfile: gdcmBinEntry.h,v $
Language: C++
- Date: $Date: 2004/09/13 12:10:53 $
- Version: $Revision: 1.17 $
+ Date: $Date: 2004/09/23 09:40:30 $
+ 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
/// \brief Returns the area value of the current Dicom Header Entry
/// when it's not string-translatable (e.g : a LUT table)
- void* GetVoidArea() { return VoidArea; }
- void SetVoidArea( void* area );
+ uint8_t* GetVoidArea() { return VoidArea; }
+ void SetVoidArea( uint8_t* area );
protected:
/// \brief unsecure memory area to hold 'non string' values
/// (ie : Lookup Tables, overlays, icons)
- void *VoidArea;
+ uint8_t*VoidArea;
};
Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2004/09/22 21:39:42 $
- Version: $Revision: 1.88 $
+ Date: $Date: 2004/09/23 09:40:30 $
+ Version: $Revision: 1.89 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
* failed).
*/
gdcmBinEntry * gdcmDocument::ReplaceOrCreateByNumber(
- void *voidArea,
+ uint8_t* voidArea,
int lgth,
uint16_t group,
uint16_t elem,
* \brief Accesses an existing gdcmDocEntry (i.e. a Dicom Element)
* through it's (group, element) and modifies it's content with
* the given value.
- * @param content new value (void *) to substitute with
+ * @param content new value (void * -> uint8_t*) to substitute with
* @param lgth new value length
* @param group group number of the Dicom Element to modify
* @param element element number of the Dicom Element to modify
*/
-bool gdcmDocument::SetEntryByNumber(void *content,
+bool gdcmDocument::SetEntryByNumber(uint8_t*content,
int lgth,
uint16_t group,
uint16_t element)
size_t o =(size_t)docElement->GetOffset();
fseek(Fp, o, SEEK_SET);
size_t l = docElement->GetLength();
- char* a = new char[l];
+ uint8_t* a = new uint8_t[l];
if(!a)
{
dbg.Verbose(0, "gdcmDocument::LoadEntryVoidArea cannot allocate a");
size_t o =(size_t)element->GetOffset();
fseek(Fp, o, SEEK_SET);
size_t l = element->GetLength();
- char* a = new char[l];
+ uint8_t* a = new uint8_t[l];
if( !a )
{
dbg.Verbose(0, "gdcmDocument::LoadEntryVoidArea cannot allocate a");
return NULL;
}
- element->SetVoidArea((void *)a);
+ element->SetVoidArea((uint8_t*)a);
/// \todo check the result
size_t l2 = fread(a, 1, l , Fp);
if( l != l2 )
* @param element Element number of the searched Dicom Element
* @return
*/
-bool gdcmDocument::SetEntryVoidAreaByNumber(void * area,
+bool gdcmDocument::SetEntryVoidAreaByNumber(uint8_t* area,
uint16_t group,
uint16_t element)
{
Program: gdcm
Module: $RCSfile: gdcmDocument.h,v $
Language: C++
- Date: $Date: 2004/09/20 18:14:23 $
- Version: $Revision: 1.39 $
+ Date: $Date: 2004/09/23 09:40:30 $
+ Version: $Revision: 1.40 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
uint16_t group, uint16_t elem,
std::string const & VR ="unkn");
- gdcmBinEntry* ReplaceOrCreateByNumber(void *voidArea, int lgth,
+ gdcmBinEntry* ReplaceOrCreateByNumber(uint8_t* voidArea, int lgth,
uint16_t group, uint16_t elem,
std::string const & VR="unkn");
std::string const & tagName);
virtual bool SetEntryByNumber(std::string const & content,
uint16_t group, uint16_t element);
- virtual bool SetEntryByNumber(void *content, int lgth,
+ 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);
virtual void* GetEntryVoidAreaByNumber(uint16_t group, uint16_t elem);
- virtual bool SetEntryVoidAreaByNumber(void* a, uint16_t group,
+ virtual bool SetEntryVoidAreaByNumber(uint8_t* a, uint16_t group,
uint16_t elem);
virtual void UpdateShaEntries();
Program: gdcm
Module: $RCSfile: gdcmFile.cxx,v $
Language: C++
- Date: $Date: 2004/09/20 18:14:23 $
- Version: $Revision: 1.126 $
+ Date: $Date: 2004/09/23 09:40:30 $
+ Version: $Revision: 1.127 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
* @return Pointer to newly allocated pixel data.
* NULL if alloc fails
*/
-void *gdcmFile::GetImageData()
+uint8_t* gdcmFile::GetImageData()
{
// FIXME (Mathieu)
// I need to deallocate Pixel_Data before doing any allocation:
* @return Pointer to newly allocated pixel data.
* \ NULL if alloc fails
*/
-void * gdcmFile::GetImageDataRaw ()
+uint8_t* gdcmFile::GetImageDataRaw ()
{
size_t imgDataSize;
if ( Header->HasLUT() )
*
* @return boolean
*/
-bool gdcmFile::SetImageData(void *inData, size_t expectedSize)
+bool gdcmFile::SetImageData(uint8_t* inData, size_t expectedSize)
{
Header->SetImageDataSize( expectedSize );
// FIXME : if already allocated, memory leak !
Program: gdcm
Module: $RCSfile: gdcmFile.h,v $
Language: C++
- Date: $Date: 2004/09/20 18:14:23 $
- Version: $Revision: 1.49 $
+ Date: $Date: 2004/09/23 09:40:30 $
+ 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
/// -the (vtk) user is supposed to know how to deal with LUTs-
size_t GetImageDataSizeRaw(){ return ImageDataSizeRaw; };
- void * GetImageData();
+ uint8_t* GetImageData();
size_t GetImageDataIntoVector(void* destination, size_t maxSize);
- void * GetImageDataRaw();
+ uint8_t* GetImageDataRaw();
size_t GetImageDataIntoVectorRaw(void* destination, size_t maxSize);
// Allocates ExpectedSize bytes of memory at this->Data and copies the
// e.g. VTK) before calling the Write
// see also gdcmHeader::SetImageDataSize ?!?
- bool SetImageData (void * data, size_t expectedSize);
+ bool SetImageData (uint8_t* data, size_t expectedSize);
/// \todo When the caller is aware we simply point to the data:
/// int SetImageDataNoCopy (void * Data, size_t ExpectedSize);
//
/// \brief to hold the Pixels (when read)
- void* Pixel_Data; // (was PixelData)
+ uint8_t* Pixel_Data; // (was PixelData)
/// \brief Area length to receive the Gray Level pixels
size_t ImageDataSizeRaw;