]> Creatis software - gdcm.git/commitdiff
* FIX : remove so many friend between classes
authorregrain <regrain>
Wed, 26 Jan 2005 11:42:01 +0000 (11:42 +0000)
committerregrain <regrain>
Wed, 26 Jan 2005 11:42:01 +0000 (11:42 +0000)
   -- BeNours

18 files changed:
ChangeLog
src/gdcmDocEntry.h
src/gdcmDocEntryArchive.cxx
src/gdcmDocEntryArchive.h
src/gdcmDocEntrySet.cxx
src/gdcmDocEntrySet.h
src/gdcmDocument.cxx
src/gdcmElementSet.h
src/gdcmJPEGFragment.cxx
src/gdcmJPEGFragment.h
src/gdcmJPEGFragmentsInfo.cxx
src/gdcmJPEGFragmentsInfo.h
src/gdcmJpeg.cxx
src/gdcmPixelReadConvert.cxx
src/gdcmRLEFrame.cxx
src/gdcmRLEFrame.h
src/gdcmRLEFramesInfo.h
src/jdatasrc.cxx

index 2eb054f61547342d4ba3167873a60920a39e3696..0201f1a56843dbeb1f2e0fcb439595b8a9368751 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2005-01-26 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
+   * FIX : remove so many friend between classes
+
 2005-01-25 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
    * src/gdcmDocEntrySet.cxx : Bug fix when getting the value
    * src/gdcmContentEntry.[h|cxx], gdcmValEntry.cxx : amelioration of code
index 2a5ddc89617bd25a2dae2064a0f417463c8f3d20..886a5abe6ab184281f1d8cfef6c704b072adb4e7 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntry.h,v $
   Language:  C++
-  Date:      $Date: 2005/01/21 11:40:55 $
-  Version:   $Revision: 1.40 $
+  Date:      $Date: 2005/01/26 11:42:02 $
+  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
@@ -166,9 +166,7 @@ protected:
    TagKey Key;
 
 private:
-   // FIXME: In fact we should be more specific and use :
-   // friend DocEntry *File::ReadNextElement(void);
-   friend class File;    
+   friend class File; // To use SetDictEntry
 };
 } // end namespace gdcm
 //-----------------------------------------------------------------------------
index 2a47352d56e37b2b7b5fad03abdaab16dc7906f9..eb27dff0b66d7b3e40208e56b2e10807c661feda 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntryArchive.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/26 10:29:17 $
-  Version:   $Revision: 1.9 $
+  Date:      $Date: 2005/01/26 11:42:02 $
+  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
@@ -28,9 +28,9 @@ namespace gdcm
 /**
  * \brief Constructor
  */
-DocEntryArchive::DocEntryArchive(File *header):
-   HeaderHT(header->TagHT)
+DocEntryArchive::DocEntryArchive(File *file)
 {
+   ArchFile = file;
 }
 
 //-----------------------------------------------------------------------------
@@ -74,13 +74,22 @@ bool DocEntryArchive::Push(DocEntry *newEntry)
    if(!newEntry)
       return false;
 
-   uint16_t gr = newEntry->GetDictEntry()->GetGroup();
-   uint16_t elt = newEntry->GetDictEntry()->GetElement();
-   std::string key = DictEntry::TranslateToKey(gr,elt);
+   uint16_t group = newEntry->GetDictEntry()->GetGroup();
+   uint16_t elem = newEntry->GetDictEntry()->GetElement();
+   std::string key = DictEntry::TranslateToKey(group,elem);
 
    if( Archive.find(key)==Archive.end() )
    {
       // Save the old DocEntry if any
+      DocEntry *old = ArchFile->GetDocEntry(group,elem);
+      Archive[key] = old;
+      if( old )
+         ArchFile->RemoveEntryNoDestroy(old);
+
+      // Set the new DocEntry
+      ArchFile->AddEntry(newEntry);
+
+/*      // Save the old DocEntry if any
       TagDocEntryHT::iterator it = HeaderHT.find(key);
       if( it!=HeaderHT.end() )
       {
@@ -92,7 +101,7 @@ bool DocEntryArchive::Push(DocEntry *newEntry)
       }
 
       // Set the new DocEntry
-      HeaderHT[key] = newEntry;
+      HeaderHT[key] = newEntry;*/
 
       return true;
    }
@@ -114,12 +123,18 @@ bool DocEntryArchive::Push(uint16_t group,uint16_t elem)
    if( Archive.find(key)==Archive.end() )
    {
       // Save the old DocEntry if any
+      DocEntry *old = ArchFile->GetDocEntry(group,elem);
+      Archive[key] = old;
+      if( old )
+         ArchFile->RemoveEntryNoDestroy(old);
+
+/*      // Save the old DocEntry if any
       TagDocEntryHT::iterator it = HeaderHT.find(key);
       if( it!=HeaderHT.end() )
       {
          Archive[key] = it->second;
          HeaderHT.erase(it);
-      }
+      }*/
 
       return true;
    }
@@ -141,12 +156,23 @@ bool DocEntryArchive::Restore(uint16_t group,uint16_t elem)
    TagDocEntryHT::iterator restoreIt=Archive.find(key);
    if( restoreIt!=Archive.end() )
    {
+      // Delete the new value
+      DocEntry *rem = ArchFile->GetDocEntry(group,elem);
+      if( rem )
+         ArchFile->RemoveEntry(rem);
+
+      // Restore the old value
+      if( Archive[key] )
+         ArchFile->AddEntry(Archive[key]);
+
+/*      // Delete the new value
       TagDocEntryHT::iterator restorePos = HeaderHT.find(key);
       if( restorePos!=HeaderHT.end() )
       {
          delete restorePos->second;
       }
 
+      // Restore the old value
       if( Archive[key] )
       {
          HeaderHT[key] = Archive[key];
@@ -154,7 +180,7 @@ bool DocEntryArchive::Restore(uint16_t group,uint16_t elem)
       else
       {
          HeaderHT.erase(restorePos);
-      }
+      }*/
 
       Archive.erase(restoreIt);
 
index 1c6b4c58d1ecb17f8aae5ee903d2e8301f904318..660d255c7aa5ab854d817f61edf0cff3dd46ce12 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntryArchive.h,v $
   Language:  C++
-  Date:      $Date: 2005/01/21 11:40:55 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2005/01/26 11:42:02 $
+  Version:   $Revision: 1.7 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -37,7 +37,7 @@ namespace gdcm
 class GDCM_EXPORT DocEntryArchive 
 {
 public:
-   DocEntryArchive(File *f);
+   DocEntryArchive(File *file);
    ~DocEntryArchive();
 
    void Print(std::ostream &os = std::cout);
@@ -49,7 +49,8 @@ public:
    void ClearArchive(void);
 
 private:
-   TagDocEntryHT &HeaderHT;  // we keep the name HeaderHT
+//   TagDocEntryHT &HeaderHT;  // we keep the name HeaderHT
+   File *ArchFile;
    TagDocEntryHT Archive;
 };
 } // end namespace gdcm
index 97bef68a0fb8704673a8e4c87061fa1bcecc320b..9be0a71f6f9d575921ae1781ebfa6d172e90d62e 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntrySet.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/26 10:29:17 $
-  Version:   $Revision: 1.48 $
+  Date:      $Date: 2005/01/26 11:42:02 $
+  Version:   $Revision: 1.49 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -445,8 +445,6 @@ DictEntry* DocEntrySet::NewVirtualDictEntry( uint16_t group,uint16_t elem,
    return Global::GetDicts()->NewVirtualDictEntry(group,elem,vr,vm,name);
 }
 
-//-----------------------------------------------------------------------------
-// Protected
 /**
  * \brief   Build a new Val Entry from all the low level arguments. 
  *          Check for existence of dictionary entry, and build
@@ -515,6 +513,8 @@ SeqEntry* DocEntrySet::NewSeqEntry(uint16_t group,uint16_t elem)
    return newEntry;
 }
 
+//-----------------------------------------------------------------------------
+// Protected
 /**
  * \brief   Searches [both] the public [and the shadow dictionary (when they
  *          exist)] for the presence of the DictEntry with given
index df5c2fd4a0ec0aed45ca9f8047c6df0a394dab72..9eaa474bda5e79849999835f733ce3ceccf70cc3 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntrySet.h,v $
   Language:  C++
-  Date:      $Date: 2005/01/25 15:44:23 $
-  Version:   $Revision: 1.44 $
+  Date:      $Date: 2005/01/26 11:42:02 $
+  Version:   $Revision: 1.45 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -57,7 +57,6 @@ typedef std::string BaseTagKey;
  */
 class GDCM_EXPORT DocEntrySet : public Base
 {
-friend class FileHelper;
 public:
    DocEntrySet() {};
    virtual ~DocEntrySet() {};
@@ -114,7 +113,6 @@ public:
                                   TagName const &vm     = GDCM_UNKNOWN,
                                   TagName const &name   = GDCM_UNKNOWN );
 
-protected:
 // DocEntry  related utilities 
    ValEntry *NewValEntry(uint16_t group,uint16_t elem,
                          TagName const &vr = GDCM_UNKNOWN);
@@ -122,10 +120,13 @@ protected:
                          TagName const &vr = GDCM_UNKNOWN);
    SeqEntry *NewSeqEntry(uint16_t group,uint16_t elem);
 
+protected:
 // DictEntry  related utilities
    DictEntry *GetDictEntry(uint16_t group, uint16_t elem);
    DictEntry *GetDictEntry(uint16_t group, uint16_t elem,
                            TagName const &vr);
+
+private:
 };
 
 } // end namespace gdcm
index 5a66053d1aef75e2dcfc962edbfd1a139142b26a..7686c6b10bcad748ee623acce7131c2f011ce79c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/26 09:49:54 $
-  Version:   $Revision: 1.211 $
+  Date:      $Date: 2005/01/26 11:42:02 $
+  Version:   $Revision: 1.212 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -2331,11 +2331,11 @@ void Document::ComputeRLEInfo()
 
        // Store the collected info
        RLEFrame *newFrameInfo = new RLEFrame;
-       newFrameInfo->NumberFragments = nbRleSegments;
+       newFrameInfo->SetNumberOfFragments(nbRleSegments);
        for( unsigned int uk = 1; uk <= nbRleSegments; uk++ )
        {
-          newFrameInfo->Offset[uk] = frameOffset + rleSegmentOffsetTable[uk];
-          newFrameInfo->Length[uk] = rleSegmentLength[uk];
+          newFrameInfo->SetOffset(uk,frameOffset + rleSegmentOffsetTable[uk]);
+          newFrameInfo->SetLength(uk,rleSegmentLength[uk]);
        }
        RLEInfo->Frames.push_back( newFrameInfo );
    }
@@ -2374,8 +2374,8 @@ void Document::ComputeJPEGFragmentInfo()
 
        // Store the collected info
        JPEGFragment *newFragment = new JPEGFragment;
-       newFragment->Offset = fragmentOffset;
-       newFragment->Length = fragmentLength;
+       newFragment->SetOffset(fragmentOffset);
+       newFragment->SetLength(fragmentLength);
        JPEGInfo->Fragments.push_back( newFragment );
 
        SkipBytes( fragmentLength );
index 626a85e2c7fae1a27a0f04b43ef40df976f245cc..aa2995bade99be85d16bfb2dbd20e0e5297f3c74 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmElementSet.h,v $
   Language:  C++
-  Date:      $Date: 2005/01/26 10:29:17 $
-  Version:   $Revision: 1.39 $
+  Date:      $Date: 2005/01/26 11:42:02 $
+  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
@@ -68,11 +68,9 @@ protected:
 private:
 // Variables
    /// Hash Table (map), to provide fast access
-   TagDocEntryHT TagHT; 
+   TagDocEntryHT TagHT;
    /// Hash Table (map) iterator, used to visit the TagHT variable
    TagDocEntryHT::iterator ItTagHT; 
-     
-   friend class DocEntryArchive; //For accessing private TagHT
 };
 } // end namespace gdcm
 //-----------------------------------------------------------------------------
index f1fba57aa0a5a7e89edf152a9e6b58ce76245f9d..8ba7dad4f67b3fc90ae86cb7697e160a8da6a66b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmJPEGFragment.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/25 15:37:51 $
-  Version:   $Revision: 1.8 $
+  Date:      $Date: 2005/01/26 11:42:02 $
+  Version:   $Revision: 1.9 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -60,7 +60,7 @@ JPEGFragment::JPEGFragment()
 
 //   StateSuspension = 0;
 //   void *SampBuffer;
-   pimage = 0;
+   pImage = 0;
 
 }
 
index 987da56d4210d1aed3688e980606a312a4a54df2..b2862aa6ea223a3410d0283c022a679bd40dea8c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmJPEGFragment.h,v $
   Language:  C++
-  Date:      $Date: 2005/01/24 14:52:50 $
-  Version:   $Revision: 1.12 $
+  Date:      $Date: 2005/01/26 11:42:02 $
+  Version:   $Revision: 1.13 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -53,17 +53,17 @@ public:
    bool gdcm_read_JPEG_file12 (std::ifstream* fp, void* image_buffer, int & statesuspension );
    bool gdcm_read_JPEG_file16 (std::ifstream* fp, void* image_buffer, int & statesuspension );
 
-//private:
-   uint32_t    Offset;
-   uint32_t    Length;
+   void SetLength(uint32_t length) { Length = length; };
+   uint32_t GetLength() { return Length;};
+   void SetOffset(uint32_t offset) { Offset = offset; };
+   uint32_t GetOffset() { return Offset;};
+   uint8_t *GetImage()  { return pImage;};
 
-   uint8_t *pimage;
+private:
+   uint32_t Offset;
+   uint32_t Length;
 
-
-friend class Document;
-friend class FileHelper;
-friend class PixelReadConvert;
-friend class JPEGFragmentsInfo;
+   uint8_t *pImage;
 };
 } // end namespace gdcm
 
index f503f38839390a62bf631a5f407b40835e89c8af..77532a69ce6f2eebfd6febb018483887850599e5 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmJPEGFragmentsInfo.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/24 14:52:50 $
-  Version:   $Revision: 1.9 $
+  Date:      $Date: 2005/01/26 11:42:02 $
+  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
@@ -79,7 +79,7 @@ size_t JPEGFragmentsInfo::GetFragmentsLength()
         it != Fragments.end();
         ++it )
    {
-      totalLength += (*it)->Length;
+      totalLength += (*it)->GetLength();
    }
    return totalLength;
 }
@@ -97,8 +97,8 @@ void JPEGFragmentsInfo::ReadAllFragments(std::ifstream *fp, JOCTET *buffer )
         it != Fragments.end();
         ++it )
    {
-      fp->seekg( (*it)->Offset, std::ios::beg);
-      size_t len = (*it)->Length;
+      fp->seekg( (*it)->GetOffset(), std::ios::beg);
+      size_t len = (*it)->GetLength();
       fp->read((char *)p,len);
       p += len;
    }
@@ -119,7 +119,7 @@ void JPEGFragmentsInfo::DecompressJPEGFramesFromFile(std::ifstream *fp, uint8_t
      //(*it)->pimage = localRaw;
      (*it)->DecompressJPEGFramesFromFile(fp, localRaw, nBits, StateSuspension);
      // update pointer to image after some scanlines read:
-     localRaw = (*it)->pimage;
+     localRaw = (*it)->GetImage();
       // Advance to next free location in Raw 
       // for next fragment decompression (if any)
 
index 72b7b6e34ff01f3fc9fb6b3afa9c366632c90b49..4f2f430193f5fb8e63eb63cdda2bb9a75d4e0dec 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmJPEGFragmentsInfo.h,v $
   Language:  C++
-  Date:      $Date: 2005/01/24 14:52:50 $
-  Version:   $Revision: 1.12 $
+  Date:      $Date: 2005/01/26 11:42:02 $
+  Version:   $Revision: 1.13 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -49,6 +49,7 @@ public:
    void ReadAllFragments(std::ifstream *fp, JOCTET *buffer );
 
    void DecompressJPEGFramesFromFile(std::ifstream *fp, uint8_t *buffer, int nBits, int numBytes, int length);
+
 private:
    typedef std::list< JPEGFragment* > JPEGFragmentsList;
 
@@ -56,11 +57,10 @@ private:
    int StateSuspension;
    void *SampBuffer;
    char* pimage;
-  JPEGFragmentsList Fragments;
+   JPEGFragmentsList Fragments;
 
-friend class Document;
-friend class FileHelper;
-friend class PixelReadConvert;
+   friend class Document;
+   friend class PixelReadConvert;
 };
 } // end namespace gdcm
 
index a5b1d6cc6a42275367c32c1616402721caec390a..d18fa4d906b533105f355269c4bbf936263b1adc 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmJpeg.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/24 14:52:50 $
-  Version:   $Revision: 1.36 $
+  Date:      $Date: 2005/01/26 11:42:02 $
+  Version:   $Revision: 1.37 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -384,7 +384,7 @@ bool JPEGFragment::gdcm_read_JPEG_file (std::ifstream* fp, void* image_buffer ,
 {
    //static int fragimage = 0;
    //std::cerr << "Image Fragment:" << fragimage++ << std::endl;
-   pimage = (uint8_t*)image_buffer;
+   pImage = (uint8_t*)image_buffer;
    /* This struct contains the JPEG decompression parameters and pointers to
     * working space (which is allocated as needed by the JPEG library).
     */
@@ -592,13 +592,13 @@ bool JPEGFragment::gdcm_read_JPEG_file (std::ifstream* fp, void* image_buffer ,
 // The ijg has no notion of big endian, therefore always swap the jpeg stream
 #if defined(GDCM_WORDS_BIGENDIAN) && (CMAKE_BITS_IN_JSAMPLE != 8)
       uint16_t *buffer16 = (uint16_t*)*buffer;
-      uint16_t *pimage16 = (uint16_t*)pimage;
+      uint16_t *pimage16 = (uint16_t*)pImage;
       for(unsigned int i=0;i<rowsize/2;i++)
         pimage16[i] = (buffer16[i] >> 8) | (buffer16[i] << 8 );
 #else
-      memcpy( pimage, *buffer,rowsize);
+      memcpy( pImage, *buffer,rowsize);
 #endif //GDCM_WORDS_BIGENDIAN
-      pimage+=rowsize;
+      pImage+=rowsize;
    }
 
   /* Step 7: Finish decompression */
index 83db9d6beeb1f1e6e318ae386df1660f20b12fc6..b94a76a82cb57149e26450a1673bafd2d0dd37bb 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmPixelReadConvert.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/24 16:03:58 $
-  Version:   $Revision: 1.34 $
+  Date:      $Date: 2005/01/26 11:42:02 $
+  Version:   $Revision: 1.35 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -257,11 +257,11 @@ bool PixelReadConvert::ReadAndDecompressRLEFile( std::ifstream *fp )
       ++it )
    {
       // Loop on the fragments
-      for( unsigned int k = 1; k <= (*it)->NumberFragments; k++ )
+      for( unsigned int k = 1; k <= (*it)->GetNumberOfFragments(); k++ )
       {
-         fp->seekg(  (*it)->Offset[k] , std::ios::beg );
+         fp->seekg(  (*it)->GetOffset(k) , std::ios::beg );
          (void)ReadAndDecompressRLEFragment( subRaw,
-                                             (*it)->Length[k],
+                                             (*it)->GetLength(k),
                                              RawSegmentSize, 
                                              fp );
          subRaw += RawSegmentSize;
@@ -471,7 +471,7 @@ ReadAndDecompressJPEGFragmentedFramesFromFile( std::ifstream *fp )
         (it != JPEGInfo->Fragments.end()) && (howManyRead < totalLength);
         ++it )
    {
-      fragmentLength += (*it)->Length;
+      fragmentLength += (*it)->GetLength();
       
       if (howManyRead > fragmentLength) continue;
       
@@ -498,7 +498,7 @@ bool PixelReadConvert::ReadAndDecompressJPEGFile( std::ifstream *fp )
    if ( IsJPEG2000 )
    {
       gdcmVerboseMacro( "Sorry, JPEG2000 not yet taken into account" );
-      fp->seekg( (*JPEGInfo->Fragments.begin())->Offset, std::ios::beg);
+      fp->seekg( (*JPEGInfo->Fragments.begin())->GetOffset(), std::ios::beg);
 //    if ( ! gdcm_read_JPEG2000_file( fp,Raw ) )
           gdcmVerboseMacro( "Wrong Blue LUT descriptor" );
           return false;
@@ -507,7 +507,7 @@ bool PixelReadConvert::ReadAndDecompressJPEGFile( std::ifstream *fp )
    if ( IsJPEGLS )
    {
       gdcmVerboseMacro( "Sorry, JPEG-LS not yet taken into account" );
-      fp->seekg( (*JPEGInfo->Fragments.begin())->Offset, std::ios::beg);
+      fp->seekg( (*JPEGInfo->Fragments.begin())->GetOffset(), std::ios::beg);
 //    if ( ! gdcm_read_JPEGLS_file( fp,Raw ) )
          return false;
    }
index 8ebb8f61d4619a69604b9da3705bfb30f0ac7c92..7ed3a0a91b66f4bf1e67017a1bfce2375ba12561 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmRLEFrame.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/16 04:50:42 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2005/01/26 11:42:02 $
+  Version:   $Revision: 1.3 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -17,6 +17,7 @@
 =========================================================================*/
                                                                                 
 #include "gdcmRLEFrame.h"
+#include "gdcmDebug.h"
                                                                                 
 namespace gdcm
 {
@@ -40,5 +41,29 @@ void RLEFrame::Print( std::ostream &os, std::string indent )
    }
 }
 
+void RLEFrame::SetOffset(unsigned int id,long offset)
+{
+   gdcmAssertMacro(id<15);
+   Offset[id] = offset;
+}
+
+long RLEFrame::GetOffset(unsigned int id)
+{
+   gdcmAssertMacro(id<15);
+   return Offset[id];
+}
+
+void RLEFrame::SetLength(unsigned int id,long length)
+{
+   gdcmAssertMacro(id<15);
+   Length[id] = length;
+}
+
+long RLEFrame::GetLength(unsigned int id)
+{
+   gdcmAssertMacro(id<15);
+   return Length[id];
+}
+
 } // end namespace gdcm
 
index bffdbea862b38e34eaf0c2c1187b6827949be4ce..adac8f923b5b0fe9b1cd9df833e736bfa16f5c8f 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmRLEFrame.h,v $
   Language:  C++
-  Date:      $Date: 2005/01/16 04:50:42 $
-  Version:   $Revision: 1.11 $
+  Date:      $Date: 2005/01/26 11:42:02 $
+  Version:   $Revision: 1.12 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -44,15 +44,21 @@ namespace gdcm
  */
 class GDCM_EXPORT RLEFrame
 {
-friend class Document;
-friend class PixelReadConvert;
-   unsigned int NumberFragments;
-   long    Offset[15];
-   long    Length[15];
 public:
    RLEFrame() { NumberFragments = 0; }
    void Print( std::ostream &os = std::cout, std::string indent = "" );
-   
+
+   void SetNumberOfFragments(unsigned int number) { NumberFragments = number; };   
+   unsigned int GetNumberOfFragments() { return NumberFragments; };
+   void SetOffset(unsigned int id,long offset);
+   long GetOffset(unsigned int id);
+   void SetLength(unsigned int id,long length);
+   long GetLength(unsigned int id);
+
+private:
+   unsigned int NumberFragments;
+   long Offset[15];
+   long Length[15];
 };
 } // end namespace gdcm
 //-----------------------------------------------------------------------------
index a83be408858de092dd3138cda949fcbeb696fbb1..a448b69ab9abd02238e6c26adab99aafc0fd4034 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmRLEFramesInfo.h,v $
   Language:  C++
-  Date:      $Date: 2005/01/20 16:17:00 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2005/01/26 11:42:02 $
+  Version:   $Revision: 1.11 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -43,14 +43,17 @@ namespace gdcm
  */
 class GDCM_EXPORT RLEFramesInfo
 {
-   typedef std::list< RLEFrame* > RLEFrameList;
-friend class Document;
-friend class FileHelper;
-friend class PixelReadConvert;
-   RLEFrameList Frames;
 public:
    ~RLEFramesInfo();
    void Print( std::ostream &os = std::cout, std::string indent = "" );
+
+private:
+   typedef std::list< RLEFrame* > RLEFrameList;
+
+   RLEFrameList Frames;
+
+   friend class Document;
+   friend class PixelReadConvert;
 };
 } // end namespace gdcm
 
index 199431c31444c7542b07af05e58a6ca2d2c933f3..1573e74077364e80785033b84be3684686afb99a 100644 (file)
@@ -91,17 +91,17 @@ fill_input_buffer (j_decompress_ptr cinfo)
   my_src_ptr src = (my_src_ptr) cinfo->src;
 
   //std::cerr << "Before comp:" << src->bytes_read << " / " << src->frag->Length << std::endl;
-  if( src->bytes_read == src->frag->Length )
+  if( src->bytes_read == src->frag->GetLength() )
     {
     //std::cerr << "Sweet finished this fragment" << std::endl;
     return FALSE;
     }
 
   size_t input_buf_size = INPUT_BUF_SIZE;
-  if( (src->bytes_read + INPUT_BUF_SIZE) > src->frag->Length )
+  if( (src->bytes_read + INPUT_BUF_SIZE) > src->frag->GetLength() )
     {
     //std::cerr << "Woula error:" << src->bytes_read << " / " << src->frag->Length << std::endl;
-    input_buf_size = src->frag->Length - src->bytes_read;
+    input_buf_size = src->frag->GetLength() - src->bytes_read;
     //std::cerr << "Ok only reading: " << input_buf_size << " / " << INPUT_BUF_SIZE << std::endl;
      }