#include "gdcmUtil.h"
#include "gdcmElValSet.h"
#include "gdcmTS.h"
-#include <sstream>
+#ifdef GDCM_NO_ANSI_STRING_STREAM
+# include <strstream>
+# define ostringstream ostrstream
+# else
+# include <sstream>
+#endif
+
gdcmElValSet::~gdcmElValSet() {
for (TagElValueHT::iterator tag = tagHt.begin(); tag != tagHt.end(); ++tag) {
NameHt.clear();
}
-TagElValueHT & gdcmElValSet::GetTagHt(void) {
- return tagHt;
-}
-
-
-ListTag & gdcmElValSet::GetListElem(void) {
- return listElem;
-}
-
/**
* \ingroup gdcmElValSet
* \brief
void gdcmElValSet::Print(std::ostream & os) {
size_t o;
- short int g, e;
+ unsigned short int g, e;
TSKey v;
std::string d2;
gdcmTS * ts = gdcmGlobal::GetTS();
+ std::cout << "------------- using tagHt ---------------------" << std::endl;
+
for (TagElValueHT::iterator tag = tagHt.begin();
tag != tagHt.end();
++tag){
os << std::endl;
}
- std::cout << "----------------------------------------------" << std::endl;
-
- //for (ListTag::iterator i = listElem.begin();
-
- char tag[9];
+ std::cout << "------------ using listElem -------------------" << std::endl;
+
+ guint32 lgth;
+ char greltag[10]; //group element tag
- for (std::list<gdcmElValue*>::iterator i = listElem.begin();
+ for (ListTag::iterator i = listElem.begin();
i != listElem.end();
++i){
- sprintf(tag,"%04x|%04x",(*i)->GetGroup(),(*i)->GetElement());
g = (*i)->GetGroup();
e = (*i)->GetElement();
v = (*i)->GetValue();
o = (*i)->GetOffset();
+ sprintf(greltag,"%04x|%04x",g,e);
d2 = _CreateCleanString(v); // replace non printable characters by '.'
- //os << std::hex <<g << "|" << e << std::dec << ": ";
- os << tag << " : ";
- os << " lgr : " << (*i)->GetLength();
+ os << greltag << ": lgth : ";
+ lgth = (*i)->GetReadLength();
+ if ( lgth == 0xffffffff)
+ os << std::hex << lgth << std::dec ;
+ else
+ os << lgth;
os << ", Offset : " << o;
os << " x(" << std::hex << o << std::dec << ") ";
os << "\t[" << (*i)->GetVR() << "]";
}
}
os << std::endl;
-
- }
-
+ }
}
/**
else
lgr = l;
tagHt[key]->SetLength(lgr);
-
-
-
return 1;
}
/**
* \ingroup gdcmElValSet
- * \brief
- * @param type
- * @param _fp
+ * \brief writes on disc according to the requested format
+ * \ (ACR-NEMA, DICOM, RAW) the image
+ * \ warning does NOT add the missing elements in the header :
+ * \ it's up to the user doing it !
+ * \ (function CheckHeaderCoherence to be written)
+ * @param type type of the File to be written
+ * (ACR-NEMA, DICOM, RAW)
+ * @param _fp already open file pointer
* @return
*/
void gdcmElValSet::WriteElements(FileType type, FILE * _fp) {
guint16 val_uint16;
std::vector<std::string> tokens;
+
+ // TODO : use listElem to iterate, not TagHt!
+ // pb : gdcmElValSet.Add does NOT update listElem
+ // find a trick in STL to do it, at low cost !
void *ptr;