Program: gdcm
Module: $RCSfile: gdcmDataEntry.cxx,v $
Language: C++
- Date: $Date: 2005/12/21 14:52:12 $
- Version: $Revision: 1.26 $
+ Date: $Date: 2006/02/07 12:37:19 $
+ Version: $Revision: 1.31 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <fstream>
+#if defined(__BORLANDC__)
+ #include <mem.h> // for memcpy
+ #include <stdlib.h> // for atof
+ #include <ctype.h> // for isdigit
+#endif
+
namespace gdcm
{
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Public
/**
- * \brief Sets the value (non string) of the current Dicom Header Entry
+ * \brief Sets the value (non string) of the current DataEntry
* @param area area
* @param self self
*/
State = STATE_LOADED;
}
/**
- * \brief Inserts the value (non string) into the current Dicom Header Entry
+ * \brief Inserts the value (non string) into the current DataEntry
* @param area area
* @param length length
*/
}
/**
- * \brief Inserts the value (non string) into the current Dicom Header Entry
- * @param id id
- * @param val val
+ * \brief Inserts the elementary (non string) value into the current DataEntry
+ * @param id index of the elementary value to be set
+ * @param val value, passed as a double
*/
void DataEntry::SetValue(const uint32_t &id, const double &val)
{
return GetLength();
}
/**
- * \brief Sets the 'value' of an Entry, passed as a std::string
+ * \brief Sets the 'value' of a DataEntry, passed as a std::string
* @param value string representation of the value to be set
*/
void DataEntry::SetString(std::string const &value)
uint8_t *data = BinArea; //safe notation
size_t l = GetLength();
- gdcmDebugMacro ("in DataEntry::WriteContent " << GetKey()
- << " : " << Global::GetVR()->GetAtomicElementLength(this->GetVR())
+ gdcmDebugMacro("in DataEntry::WriteContent " << GetKey() << " AtomicLength: "
+ << Global::GetVR()->GetAtomicElementLength(this->GetVR() ) // << " BinArea in :" << &BinArea
);
if (BinArea) // the binArea was *actually* loaded
{
}
case 2:
{
-gdcmDebugMacro ("AtomicLength = 2 found; lgt =" << l);
uint16_t *data16 = (uint16_t *)data;
for(i=0;i<l/vrLgth;i++)
binary_write( *fp, data16[i]);
}
else
{
- // nothing was loaded, but we need to skip space on disc
-
+ // nothing was loaded, but we need to skip space on disc
+ if (l != 0)
+ {
// --> WARNING : nothing is written;
// --> the initial data (on the the source image) is lost
- // --> user is *not* informed !
- gdcmDebugMacro ("Nothing was loaded, but we need to skip space on disc. "
- << "Length =" << l );
- fp->seekp(l, std::ios::cur);
+ // --> user is *not* informed !
+ gdcmDebugMacro ("Nothing was loaded, but we need to skip space on disc. "
+ << "Length =" << l << " for " << GetKey() );
+ fp->seekp(l, std::ios::cur); // At Write time, for unloaded elems
+ }
}
// to avoid gdcm to propagate oddities
// (length was already modified)
if (l%2)
- fp->seekp(1, std::ios::cur);
+ fp->seekp(1, std::ios::cur); // At Write time, for non even length elems
}
/**
v = GetString();
const VRKey &vr = GetVR();
- if( vr == "US" || vr == "SS" )
- s << " [" << GetString() << "]";
- else if( vr == "UL" || vr == "SL" )
- s << " [" << GetString() << "]";
- else if ( vr == "FL" )
- s << " [" << GetString() << "]";
- else if ( vr == "FD" )
+ if( vr == "US" || vr == "SS" || vr == "UL" || vr == "SL"
+ || vr == "FL" || vr == "FD")
s << " [" << GetString() << "]";
else
{