+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
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
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
//-----------------------------------------------------------------------------
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
/**
* \brief Constructor
*/
-DocEntryArchive::DocEntryArchive(File *header):
- HeaderHT(header->TagHT)
+DocEntryArchive::DocEntryArchive(File *file)
{
+ ArchFile = file;
}
//-----------------------------------------------------------------------------
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() )
{
}
// Set the new DocEntry
- HeaderHT[key] = newEntry;
+ HeaderHT[key] = newEntry;*/
return true;
}
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;
}
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];
else
{
HeaderHT.erase(restorePos);
- }
+ }*/
Archive.erase(restoreIt);
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
class GDCM_EXPORT DocEntryArchive
{
public:
- DocEntryArchive(File *f);
+ DocEntryArchive(File *file);
~DocEntryArchive();
void Print(std::ostream &os = std::cout);
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
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
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
return newEntry;
}
+//-----------------------------------------------------------------------------
+// Protected
/**
* \brief Searches [both] the public [and the shadow dictionary (when they
* exist)] for the presence of the DictEntry with given
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
*/
class GDCM_EXPORT DocEntrySet : public Base
{
-friend class FileHelper;
public:
DocEntrySet() {};
virtual ~DocEntrySet() {};
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);
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
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
// 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 );
}
// 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 );
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
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
//-----------------------------------------------------------------------------
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
// StateSuspension = 0;
// void *SampBuffer;
- pimage = 0;
+ pImage = 0;
}
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
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
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
it != Fragments.end();
++it )
{
- totalLength += (*it)->Length;
+ totalLength += (*it)->GetLength();
}
return totalLength;
}
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;
}
//(*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)
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
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;
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
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
{
//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).
*/
// 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 */
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
++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;
(it != JPEGInfo->Fragments.end()) && (howManyRead < totalLength);
++it )
{
- fragmentLength += (*it)->Length;
+ fragmentLength += (*it)->GetLength();
if (howManyRead > fragmentLength) continue;
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;
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;
}
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
=========================================================================*/
#include "gdcmRLEFrame.h"
+#include "gdcmDebug.h"
namespace gdcm
{
}
}
+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
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
*/
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
//-----------------------------------------------------------------------------
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
*/
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
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;
}