]> Creatis software - gdcm.git/commitdiff
* VoidArea is now called BinArea (less confusing name),
authorjpr <jpr>
Thu, 23 Sep 2004 10:17:25 +0000 (10:17 +0000)
committerjpr <jpr>
Thu, 23 Sep 2004 10:17:25 +0000 (10:17 +0000)
    and all the methods called ...VoidArea... are now ... BinArea...

ChangeLog
Example/TestCopyDicom.cxx
Testing/TestCopyDicom.cxx
src/gdcmBinEntry.cxx
src/gdcmBinEntry.h
src/gdcmDocument.cxx
src/gdcmDocument.h
src/gdcmFile.cxx
src/gdcmHeader.cxx

index e09e4ba1731260a8aa1673d629bfe27644032359..fbec1e02b3f3748522de4e3a6fa2be858002e19b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,9 @@
 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 
+        we can now delete[] it safely  
+  * VoidArea is now called BinArea (less confusing name),
+    and all the methods called ...VoidArea... are now ... BinArea...
 
 2004-09-22 Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
   * src/gdcmDocument.cxx: gdcmDocument::~gdcmDocument() doesn't clear (nor
index 092e6f16c5c6f73ab933adff89fb9e9a006c8639..b07b1afcff63b2447e8069ce34475e52d8a5cbbf 100644 (file)
@@ -89,7 +89,7 @@ int main(int argc, char* argv[])
          if ( gdcmBinEntry* b = dynamic_cast<gdcmBinEntry*>(d) )
          {              
             copy->GetHeader()->ReplaceOrCreateByNumber( 
-                                 b->GetVoidArea(),
+                                 b->GetBinArea(),
                                  b->GetLength(),
                                  b->GetGroup(), 
                                  b->GetElement(),
index 8bbedf69aea75e703041838331052a6ab270060c..1effa9f67b5c87c86fa8188b3fa3a0f03cdc137a 100644 (file)
@@ -87,7 +87,7 @@ int TestCopyDicom(int , char* [])
          if ( gdcmBinEntry* b = dynamic_cast<gdcmBinEntry*>(d) )
          {              
             copy->GetHeader()->ReplaceOrCreateByNumber( 
-                                 b->GetVoidArea(),
+                                 b->GetBinArea(),
                                  b->GetLength(),
                                  b->GetGroup(), 
                                  b->GetElement(),
index 47af8c38888458dcebd528afb2c88285982be9e6..d15def828fbcb27e2a59ba0763fdebabd4be7cf1 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmBinEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/09/23 09:40:30 $
-  Version:   $Revision: 1.29 $
+  Date:      $Date: 2004/09/23 10:17:26 $
+  Version:   $Revision: 1.30 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -28,7 +28,7 @@
  */
 gdcmBinEntry::gdcmBinEntry(gdcmDictEntry* e) : gdcmValEntry(e)
 {
-   VoidArea = 0;
+   BinArea = 0;
 }
 
 /**
@@ -45,7 +45,7 @@ gdcmBinEntry::gdcmBinEntry(gdcmDocEntry* e) : gdcmValEntry(e->GetDictEntry())
    //FIXME
    //SQDepthLevel = e->GetDepthLevel();
 
-   VoidArea = 0; // let's be carefull !
+   BinArea = 0; // let's be carefull !
 }
 
 /**
@@ -53,10 +53,10 @@ gdcmBinEntry::gdcmBinEntry(gdcmDocEntry* e) : gdcmValEntry(e->GetDictEntry())
  */
 gdcmBinEntry::~gdcmBinEntry()
 {
-   if (VoidArea)
+   if (BinArea)
    {
-      delete[] VoidArea;
-      VoidArea = 0; // let's be carefull !
+      delete[] BinArea;
+      BinArea = 0; // let's be carefull !
    }
 }
 
@@ -71,8 +71,8 @@ void gdcmBinEntry::Print(std::ostream &os)
 {
    gdcmDocEntry::Print(os);
    std::ostringstream s;
-   void *voidArea = GetVoidArea();
-   if (voidArea)
+   void *binArea = GetBinArea();
+   if (binArea)
    {
       //s << " [" << GDCM_BINLOADED 
       s << " [" << GetValue()
@@ -102,12 +102,12 @@ void gdcmBinEntry::Print(std::ostream &os)
 void gdcmBinEntry::Write(FILE *fp, FileType filetype)
 {
    gdcmDocEntry::Write(fp, filetype);
-   void *voidArea = GetVoidArea();
+   void *binArea = GetBinArea();
    int lgr = GetLength();
-   if (voidArea)
+   if (binArea)
    {
       // there is a 'non string' LUT, overlay, etc
-      fwrite ( voidArea,(size_t)lgr ,(size_t)1 ,fp); // Elem value
+      fwrite ( binArea,(size_t)lgr ,(size_t)1 ,fp); // Elem value
    }
    else
    {
@@ -120,11 +120,11 @@ void gdcmBinEntry::Write(FILE *fp, FileType filetype)
 
 
 /// \brief Sets the value (non string) of the current Dicom Header Entry
-void gdcmBinEntry::SetVoidArea( uint8_t* area )  
+void gdcmBinEntry::SetBinArea( uint8_t* area )  
 { 
-   if (VoidArea)
-      delete[] VoidArea;
-   VoidArea = area;  
+   if (BinArea)
+      delete[] BinArea;
+   BinArea = area;  
 }
 
 //-----------------------------------------------------------------------------
index c013ee1408ff768766fd6fa8c0168a07307f7053..5381b4c5a8e49ff1f08c1b42a61d062efc100946 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmBinEntry.h,v $
   Language:  C++
-  Date:      $Date: 2004/09/23 09:40:30 $
-  Version:   $Revision: 1.18 $
+  Date:      $Date: 2004/09/23 10:17:26 $
+  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
@@ -45,8 +45,8 @@ public:
 
    /// \brief Returns the area value of the current Dicom Header Entry
    ///  when it's not string-translatable (e.g : a LUT table)         
-   uint8_t* GetVoidArea()  { return VoidArea; }
-   void  SetVoidArea( uint8_t* area );
+   uint8_t* GetBinArea()  { return BinArea; }
+   void  SetBinArea( uint8_t* area );
          
 protected:
 
@@ -56,7 +56,7 @@ private:
    
    /// \brief unsecure memory area to hold 'non string' values 
    ///       (ie : Lookup Tables, overlays, icons)   
-   uint8_t*VoidArea;
+   uint8_t* BinArea;
 
 };
 
index 5e529a5aee33d8fe53c00184577e75f1f40fe379..b7c00a192b03676da7c9d1fb56432def85ca1e2b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/09/23 09:40:30 $
-  Version:   $Revision: 1.89 $
+  Date:      $Date: 2004/09/23 10:17:26 $
+  Version:   $Revision: 1.90 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -116,7 +116,7 @@ gdcmDocument::gdcmDocument( std::string const & filename )
    std::string PhotometricInterpretation = GetEntryByNumber(0x0028,0x0004);   
    if( PhotometricInterpretation == "PALETTE COLOR " )
    {
-      LoadEntryVoidArea(0x0028,0x1200);  // gray LUT   
+      LoadEntryBinArea(0x0028,0x1200);  // gray LUT   
       /// FIXME FIXME FIXME
       /// The tags refered by the three following lines used to be CORRECTLY
       /// defined as having an US Value Representation in the public
@@ -132,19 +132,19 @@ gdcmDocument::gdcmDocument( std::string const & filename )
       ///   also used as gdcmBinEntry, which requires the proper conversion,
       /// - OW, and hence loaded as gdcmBinEntry, but afterwards also used
       ///   as gdcmValEntry, which requires the proper conversion.
-      LoadEntryVoidArea(0x0028,0x1201);  // R    LUT
-      LoadEntryVoidArea(0x0028,0x1202);  // G    LUT
-      LoadEntryVoidArea(0x0028,0x1203);  // B    LUT
+      LoadEntryBinArea(0x0028,0x1201);  // R    LUT
+      LoadEntryBinArea(0x0028,0x1202);  // G    LUT
+      LoadEntryBinArea(0x0028,0x1203);  // B    LUT
       
       // Segmented Red   Palette Color LUT Data
-      LoadEntryVoidArea(0x0028,0x1221);
+      LoadEntryBinArea(0x0028,0x1221);
       // Segmented Green Palette Color LUT Data
-      LoadEntryVoidArea(0x0028,0x1222);
+      LoadEntryBinArea(0x0028,0x1222);
       // Segmented Blue  Palette Color LUT Data
-      LoadEntryVoidArea(0x0028,0x1223);
+      LoadEntryBinArea(0x0028,0x1223);
    } 
    //FIXME later : how to use it?
-   LoadEntryVoidArea(0x0028,0x3006);  //LUT Data (CTX dependent) 
+   LoadEntryBinArea(0x0028,0x3006);  //LUT Data (CTX dependent) 
 
    CloseFile(); 
   
@@ -666,14 +666,14 @@ gdcmValEntry * gdcmDocument::ReplaceOrCreateByNumber(
 /*
  * \brief   Modifies the value of a given Header Entry (Dicom Element)
  *          when it exists. Create it with the given value when unexistant.
- * @param   voidArea (binary) value to be set
+ * @param   binArea (binary) value to be set
  * @param   Group   Group number of the Entry 
  * @param   Elem  Element number of the Entry
  * \return  pointer to the modified/created Header Entry (NULL when creation
  *          failed).
  */
 gdcmBinEntry * gdcmDocument::ReplaceOrCreateByNumber(
-                                         uint8_t* voidArea,
+                                         uint8_t* binArea,
                                          int lgth, 
                                          uint16_t group, 
                                          uint16_t elem,
@@ -737,7 +737,7 @@ gdcmBinEntry * gdcmDocument::ReplaceOrCreateByNumber(
       }
    }
 
-   SetEntryByNumber(voidArea, lgth, group, elem);
+   SetEntryByNumber(binArea, lgth, group, elem);
 
    return binEntry;
 }  
@@ -1008,7 +1008,7 @@ bool gdcmDocument::SetEntryByNumber(uint8_t*content,
    }
 */      
    gdcmBinEntry* a = (gdcmBinEntry *)TagHT[key];           
-   a->SetVoidArea(content);  
+   a->SetBinArea(content);  
    a->SetLength(lgth);
    a->SetValue(GDCM_BINLOADED);
 
@@ -1070,7 +1070,7 @@ size_t gdcmDocument::GetEntryOffsetByNumber(uint16_t group, uint16_t elem)
  * @param elem  element number of the Entry
  * @return Pointer to the 'non string' area
  */
-void * gdcmDocument::GetEntryVoidAreaByNumber(uint16_t group, uint16_t elem) 
+void * gdcmDocument::GetEntryBinAreaByNumber(uint16_t group, uint16_t elem) 
 {
    gdcmDocEntry* entry = GetDocEntryByNumber(group, elem);
    if (!entry) 
@@ -1078,7 +1078,7 @@ void * gdcmDocument::GetEntryVoidAreaByNumber(uint16_t group, uint16_t elem)
       dbg.Verbose(1, "gdcmDocument::GetDocEntryByNumber: no entry");
       return 0;
    }
-   return ((gdcmBinEntry *)entry)->GetVoidArea();
+   return ((gdcmBinEntry *)entry)->GetBinArea();
 }
 
 /**
@@ -1087,7 +1087,7 @@ void * gdcmDocument::GetEntryVoidAreaByNumber(uint16_t group, uint16_t elem)
  * @param group   group number of the Entry 
  * @param elem  element number of the Entry
  */
-void* gdcmDocument::LoadEntryVoidArea(uint16_t group, uint16_t elem)
+void* gdcmDocument::LoadEntryBinArea(uint16_t group, uint16_t elem)
 {
    gdcmDocEntry *docElement = GetDocEntryByNumber(group, elem);
    if ( !docElement )
@@ -1100,7 +1100,7 @@ void* gdcmDocument::LoadEntryVoidArea(uint16_t group, uint16_t elem)
    uint8_t* a = new uint8_t[l];
    if(!a)
    {
-      dbg.Verbose(0, "gdcmDocument::LoadEntryVoidArea cannot allocate a");
+      dbg.Verbose(0, "gdcmDocument::LoadEntryBinArea cannot allocate a");
       return NULL;
    }
    size_t l2 = fread(a, 1, l , Fp);
@@ -1110,18 +1110,18 @@ void* gdcmDocument::LoadEntryVoidArea(uint16_t group, uint16_t elem)
       return NULL;
    }
    /// \todo Drop any already existing void area! JPR
-   if( !SetEntryVoidAreaByNumber( a, group, elem ) );
+   if( !SetEntryBinAreaByNumber( a, group, elem ) );
    {
-      dbg.Verbose(0, "gdcmDocument::LoadEntryVoidArea setting failed.");
+      dbg.Verbose(0, "gdcmDocument::LoadEntryBinArea setting failed.");
    }
    return a;
 }
 /**
  * \brief         Loads (from disk) the element content 
  *                when a string is not suitable
- * @param element  Entry whose voidArea is going to be loaded
+ * @param element  Entry whose binArea is going to be loaded
  */
-void *gdcmDocument::LoadEntryVoidArea(gdcmBinEntry *element) 
+void *gdcmDocument::LoadEntryBinArea(gdcmBinEntry *element) 
 {
    size_t o =(size_t)element->GetOffset();
    fseek(Fp, o, SEEK_SET);
@@ -1129,10 +1129,10 @@ void *gdcmDocument::LoadEntryVoidArea(gdcmBinEntry *element)
    uint8_t* a = new uint8_t[l];
    if( !a )
    {
-      dbg.Verbose(0, "gdcmDocument::LoadEntryVoidArea cannot allocate a");
+      dbg.Verbose(0, "gdcmDocument::LoadEntryBinArea cannot allocate a");
       return NULL;
    }
-   element->SetVoidArea((uint8_t*)a);
+   element->SetBinArea((uint8_t*)a);
    /// \todo check the result 
    size_t l2 = fread(a, 1, l , Fp);
    if( l != l2 )
@@ -1151,7 +1151,7 @@ void *gdcmDocument::LoadEntryVoidArea(gdcmBinEntry *element)
  * @param   element Element number of the searched Dicom Element 
  * @return  
  */
-bool gdcmDocument::SetEntryVoidAreaByNumber(uint8_t* area,
+bool gdcmDocument::SetEntryBinAreaByNumber(uint8_t* area,
                                             uint16_t group, 
                                             uint16_t element) 
 {
@@ -1162,7 +1162,7 @@ bool gdcmDocument::SetEntryVoidAreaByNumber(uint8_t* area,
    }
    if ( gdcmBinEntry* binEntry = dynamic_cast<gdcmBinEntry*>(currentEntry) )
    {
-      binEntry->SetVoidArea( area );
+      binEntry->SetBinArea( area );
       return true;
    }
    return true;
@@ -1672,7 +1672,7 @@ void gdcmDocument::LoadDocEntry(gdcmDocEntry* entry)
    {
       s << GDCM_BINLOADED;
       binEntryPtr->SetValue(s.str());
-      LoadEntryVoidArea(binEntryPtr); // last one, not to erase length !
+      LoadEntryBinArea(binEntryPtr); // last one, not to erase length !
       return;
    }
     
index 995575f9c8dc6fcb9cbf0e8d9705f632018dbdbb..72cda039ba061a2ddb5cb0aeb9251973a343ee0a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.h,v $
   Language:  C++
-  Date:      $Date: 2004/09/23 09:40:30 $
-  Version:   $Revision: 1.40 $
+  Date:      $Date: 2004/09/23 10:17:26 $
+  Version:   $Revision: 1.41 $
  
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -136,7 +136,7 @@ public:
                                          uint16_t group, uint16_t elem,
                                          std::string const & VR ="unkn");
    
-   gdcmBinEntry* ReplaceOrCreateByNumber(uint8_t* voidArea, int lgth,
+   gdcmBinEntry* ReplaceOrCreateByNumber(uint8_t* binArea, int lgth,
                                          uint16_t group, uint16_t elem,
                                          std::string const & VR="unkn");
 
@@ -146,8 +146,8 @@ public:
                                  uint16_t group,
                                  uint16_t elem );
    
-   virtual void* LoadEntryVoidArea(uint16_t group, uint16_t elem);
-   virtual void* LoadEntryVoidArea(gdcmBinEntry* entry);
+   virtual void* LoadEntryBinArea(uint16_t group, uint16_t elem);
+   virtual void* LoadEntryBinArea(gdcmBinEntry* entry);
       
    // System access (meaning endian related !?)
    uint16_t SwapShort(uint16_t);   // needed by gdcmFile
@@ -183,8 +183,8 @@ public:
                                        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(uint8_t* a, uint16_t group,
+   virtual void* GetEntryBinAreaByNumber(uint16_t group, uint16_t elem);   
+   virtual bool  SetEntryBinAreaByNumber(uint8_t* a, uint16_t group,
                                                    uint16_t elem);
 
    virtual void UpdateShaEntries();
index 75bdc905d5c1caf5b6d7d007a4ff8e269122e5d8..752af409b3bd206e7140676396687d591bce955f 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmFile.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/09/23 09:40:30 $
-  Version:   $Revision: 1.127 $
+  Date:      $Date: 2004/09/23 10:17:26 $
+  Version:   $Revision: 1.128 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -375,7 +375,7 @@ uint8_t* gdcmFile::GetImageData()
          GetHeader()->GetGrPixel(), GetHeader()->GetNumPixel());
 
       // Will be 7fe0, 0010 in standard case
-      GetHeader()->SetEntryVoidAreaByNumber( Pixel_Data, 
+      GetHeader()->SetEntryBinAreaByNumber( Pixel_Data, 
          GetHeader()->GetGrPixel(), GetHeader()->GetNumPixel()); 
    }      
    PixelRead = 0; // no PixelRaw
@@ -507,7 +507,7 @@ uint8_t* gdcmFile::GetImageDataRaw ()
          GetHeader()->GetGrPixel(), GetHeader()->GetNumPixel());
  
       // will be 7fe0, 0010 in standard cases
-      GetHeader()->SetEntryVoidAreaByNumber(Pixel_Data, 
+      GetHeader()->SetEntryBinAreaByNumber(Pixel_Data, 
          GetHeader()->GetGrPixel(), GetHeader()->GetNumPixel());
    } 
    PixelRead = 1; // PixelRaw
index 30f8cf4bd5a8cc09f1e99143a861f424cda52afc..2f7f998f7a807bc00272ee9d1894a9c5a231ab04 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmHeader.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/09/20 18:14:23 $
-  Version:   $Revision: 1.187 $
+  Date:      $Date: 2004/09/23 10:17:26 $
+  Version:   $Revision: 1.188 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -1115,9 +1115,9 @@ uint8_t* gdcmHeader::GetLUTRGBA()
    }
  
    // Load LUTs into memory, (as they were stored on disk)
-   uint8_t* lutR = (uint8_t*) GetEntryVoidAreaByNumber(0x0028,0x1201);
-   uint8_t* lutG = (uint8_t*) GetEntryVoidAreaByNumber(0x0028,0x1202);
-   uint8_t* lutB = (uint8_t*) GetEntryVoidAreaByNumber(0x0028,0x1203); 
+   uint8_t* lutR = (uint8_t*) GetEntryBinAreaByNumber(0x0028,0x1201);
+   uint8_t* lutG = (uint8_t*) GetEntryBinAreaByNumber(0x0028,0x1202);
+   uint8_t* lutB = (uint8_t*) GetEntryBinAreaByNumber(0x0028,0x1203); 
 
    if ( !lutR || !lutG || !lutB )
    {