* src/gdcmHeader.h: the declaration of gdcmHeader::gdcmHeader(bool)
as explicit constructor didn't do the trick to fix the above problem.
Could anyone explain why ?
+ * src/gdcmBinEntry.cxx, gdcmValEntry.cxx: gdcmBinEntry::Print() now
+ properly calls gdcmValEntry::Print() (that was weed out from
+ code related to gdcmBinEntry).
2004-06-20 Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
* In order to fix memory leaks:
Program: gdcm
Module: $RCSfile: gdcmBinEntry.cxx,v $
Language: C++
- Date: $Date: 2004/06/20 18:08:47 $
- Version: $Revision: 1.11 $
+ Date: $Date: 2004/06/21 12:38:28 $
+ 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
/**
* \brief Constructor from a given gdcmBinEntry
*/
-gdcmBinEntry::gdcmBinEntry(gdcmDictEntry* e) : gdcmValEntry(e) {
+gdcmBinEntry::gdcmBinEntry(gdcmDictEntry* e) : gdcmValEntry(e)
+{
this->voidArea = NULL;
}
* \brief Constructor from a given gdcmBinEntry
* @param e Pointer to existing Doc entry
*/
-gdcmBinEntry::gdcmBinEntry(gdcmDocEntry* e) : gdcmValEntry(e->GetDictEntry()){
+gdcmBinEntry::gdcmBinEntry(gdcmDocEntry* e) : gdcmValEntry(e->GetDictEntry())
+{
this->UsableLength = e->GetLength();
this->ReadLength = e->GetReadLength();
this->ImplicitVR = e->IsImplicitVR();
//-----------------------------------------------------------------------------
// Print
/*
- * \ingroup gdcmDocEntry
* \brief canonical Printer
*/
-void gdcmBinEntry::Print(std::ostream &os) {
- PrintCommonPart(os);
- /// \todo Write a true specialisation of Print i.e. display something
- /// for BinEntry extension.
- dbg.Verbose(1, "gdcmBinEntry::Print: so WHAT ?");
+void gdcmBinEntry::Print(std::ostream &os)
+{
+ gdcmValEntry::Print(os);
+ std::ostringstream s;
+ if (voidArea != NULL)
+ {
+ s << " [gdcm::Binary data loaded with lenght is "
+ << GetLength() << "]"
+ << std::endl;
+ }
+ else
+ {
+ s << " [gdcm::Binary data NOT loaded]"
+ << std::endl;
+ }
+ os << s.str();
}
//-----------------------------------------------------------------------------
// Public
Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2004/06/21 04:18:25 $
- Version: $Revision: 1.20 $
+ Date: $Date: 2004/06/21 12:38:29 $
+ Version: $Revision: 1.21 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
gdcmDocEntry* Entry = GetDocEntryByNumber(Group, Elem);
if (!Entry)
{
- dbg.Verbose(1, "gdcmDocument::GetDocEntryByNumber",
- "failed to Locate gdcmDocEntry");
+ dbg.Verbose(1, "gdcmDocument::GetDocEntryByNumber: no entry present.");
return (size_t)0;
}
return Entry->GetOffset();
gdcmDocEntry* Entry = GetDocEntryByNumber(Group, Elem);
if (!Entry)
{
- dbg.Verbose(1, "gdcmDocument::GetDocEntryByNumber",
- "failed to Locate gdcmDocEntry");
+ dbg.Verbose(1, "gdcmDocument::GetDocEntryByNumber: no entry");
return (NULL);
}
return ((gdcmBinEntry *)Entry)->GetVoidArea();
*/
// \todo TODO : to be re -written recursively !
-void gdcmDocument::WriteEntryValue(gdcmDocEntry *tag, FILE *_fp,FileType type)
+void gdcmDocument::WriteEntryValue(gdcmDocEntry *Entry, FILE *_fp,FileType type)
{
(void)type;
- guint16 group = tag->GetGroup();
- VRKey vr = tag->GetVR();
- guint32 lgr = tag->GetReadLength();
+ guint16 group = Entry->GetGroup();
+ VRKey vr = Entry->GetVR();
+ guint32 lgr = Entry->GetReadLength();
if (vr == "SQ")
// SeQuences have no value:
// Delimiters have no associated value:
return;
- //--------------------------------
- //
- // FIXME :right now, both value and voidArea belong to gdcmValue
- //
- // -------------------------------
-
-// if (gdcmBinEntry* BinEntry = dynamic_cast< gdcmBinEntry* >(tag) ) {
+// if (gdcmBinEntry* BinEntry = dynamic_cast< gdcmBinEntry* >(Entry) ) {
void *voidArea;
- gdcmBinEntry *BinEntry= (gdcmBinEntry *)tag;;
+ gdcmBinEntry *BinEntry= (gdcmBinEntry *)Entry;;
voidArea = BinEntry->GetVoidArea();
if (voidArea != NULL)
{ // there is a 'non string' LUT, overlay, etc
// we split the string and write each value as a short int
std::vector<std::string> tokens;
tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
- Tokenize (((gdcmValEntry *)tag)->GetValue(), tokens, "\\");
+ Tokenize (((gdcmValEntry *)Entry)->GetValue(), tokens, "\\");
for (unsigned int i=0; i<tokens.size();i++)
{
guint16 val_uint16 = atoi(tokens[i].c_str());
// along the '\' and write each value as an int:
std::vector<std::string> tokens;
tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
- Tokenize (((gdcmValEntry *)tag)->GetValue(), tokens, "\\");
+ Tokenize (((gdcmValEntry *)Entry)->GetValue(), tokens, "\\");
for (unsigned int i=0; i<tokens.size();i++)
{
guint32 val_uint32 = atoi(tokens[i].c_str());
tokens.clear();
return;
}
- fwrite (((gdcmValEntry *)tag)->GetValue().c_str(),
+ fwrite (((gdcmValEntry *)Entry)->GetValue().c_str(),
(size_t)lgr ,(size_t)1, _fp); // Elem value
}
Program: gdcm
Module: $RCSfile: gdcmValEntry.cxx,v $
Language: C++
- Date: $Date: 2004/06/21 04:43:02 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2004/06/21 12:38:29 $
+ 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
//-----------------------------------------------------------------------------
// Constructor / Destructor
/**
- * \ingroup gdcmValEntry
* \brief Constructor from a given gdcmDictEntry
* @param e Pointer to existing dictionary entry
*/
-gdcmValEntry::gdcmValEntry(gdcmDictEntry* e) : gdcmDocEntry(e) {
+gdcmValEntry::gdcmValEntry(gdcmDictEntry* e) : gdcmDocEntry(e)
+{
voidArea = NULL; // will be in BinEntry ?
}
/**
- * \ingroup gdcmValEntry
* \brief Constructor from a given gdcmDocEntry
* @param e Pointer to existing Doc entry
*/
-gdcmValEntry::gdcmValEntry(gdcmDocEntry* e) : gdcmDocEntry(e->GetDictEntry()){
+gdcmValEntry::gdcmValEntry(gdcmDocEntry* e) : gdcmDocEntry(e->GetDictEntry())
+{
this->UsableLength = e->GetLength();
this->ReadLength = e->GetReadLength();
this->ImplicitVR = e->IsImplicitVR();
/**
* \brief Canonical destructor.
*/
-gdcmValEntry::~gdcmValEntry (void) {
+gdcmValEntry::~gdcmValEntry (void)
+{
if (!voidArea) // will be in BinEntry
free(voidArea);
}
//-----------------------------------------------------------------------------
// Print
/**
- * \ingroup gdcmValEntry
* \brief canonical Printer
*/
-void gdcmValEntry::Print(std::ostream & os) {
-
+void gdcmValEntry::Print(std::ostream & os)
+{
std::ostringstream s;
- //size_t o; //not used
unsigned short int g, e;
char st[20];
TSKey v;
vr = GetVR();
gdcmTS * ts = gdcmGlobal::GetTS();
- if (voidArea != NULL) { // should be moved in gdcmBinEntry Printer (when any)
- s << " [gdcm::Non String Data Loaded in Unsecure Area ("
- << GetLength() << ") ]";
- }
-
- else {
- v = GetValue(); // not applicable for SQ ...
- d2 = CreateCleanString(v); // replace non printable characters by '.'
- if( (GetLength()<=MAX_SIZE_PRINT_ELEMENT_VALUE) ||
- (printLevel>=3) ||
- (d2.find("gdcm::NotLoaded.") < d2.length()) )
- s << " [" << d2 << "]";
- else
- s << " [gdcm::too long for print (" << GetLength() << ") ]";
+ v = GetValue(); // not applicable for SQ ...
+ d2 = CreateCleanString(v); // replace non printable characters by '.'
+ if( (GetLength()<=MAX_SIZE_PRINT_ELEMENT_VALUE) ||
+ (printLevel>=3) || (d2.find("gdcm::NotLoaded.") < d2.length()) )
+ {
+ s << " [" << d2 << "]";
+ }
+ else
+ {
+ s << " [gdcm::too long for print (" << GetLength() << ") ]";
}
// Display the UID value (instead of displaying only the rough code)
Program: gdcm
Module: $RCSfile: gdcmValEntry.h,v $
Language: C++
- Date: $Date: 2004/06/21 04:43:02 $
- Version: $Revision: 1.11 $
+ Date: $Date: 2004/06/21 12:38:29 $
+ 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
private:
-// Variables
+// Members :
- /// \brief Document Entry value, stored as a std::string (VR will be used,
- /// later, to decode)
-
+ /// \brief Document Entry value, internaly represented as a std::string
+ /// The Value Representation (\ref gdcmVR) is indenpendently used
+ /// in order to interpret (decode) this field.
std::string value;
};