return tagHt;
}
+
+ListTag & gdcmElValSet::GetListElem(void) {
+ return listElem;
+}
+
/**
* \ingroup gdcmElValSet
* \brief
void gdcmElValSet::Add(gdcmElValue * newElValue) {
tagHt [newElValue->GetKey()] = newElValue;
NameHt[newElValue->GetName()] = newElValue;
+
+// WARNING : push_bash in listElem ONLY during ParseHeader
+// TODO : something to allow further Elements addition
+// position to be taken care of !
+ listElem.push_back(newElValue);
}
/**
}
os << std::endl;
}
+
+ std::cout << "----------------------------------------------" << std::endl;
+
+ //for (ListTag::iterator i = listElem.begin();
+
+ char tag[9];
+
+ for (std::list<gdcmElValue*>::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();
+ d2 = _CreateCleanString(v); // replace non printable characters by '.'
+ //os << std::hex <<g << "|" << e << std::dec << ": ";
+ os << tag << " : ";
+ os << " lgr : " << (*i)->GetLength();
+ os << ", Offset : " << o;
+ os << " x(" << std::hex << o << std::dec << ") ";
+ os << "\t[" << (*i)->GetVR() << "]";
+ os << "\t[" << (*i)->GetName() << "]";
+ os << "\t[" << d2 << "]";
+
+ // Display the UID value (instead of displaying the rough code)
+ if (g == 0x0002) { // Any more to be displayed ?
+ if ( (e == 0x0010) || (e == 0x0002) )
+ os << " ==>\t[" << ts->GetValue(v) << "]";
+ } else {
+ if (g == 0x0008) {
+ if ( (e == 0x0016) || (e == 0x1150) )
+ os << " ==>\t[" << ts->GetValue(v) << "]";
+ }
+ }
+ os << std::endl;
+
+ }
+
}
/**
-// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.cxx,v 1.111 2003/11/07 14:34:50 jpr Exp $
+// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.cxx,v 1.112 2003/11/10 09:21:40 jpr Exp $
#include "gdcmHeader.h"
// qui pourrait ne pas etre generalisable
// Well, I'm expecting your code !!!
- // to try to 'go inside' the SeQuences
+ // the test was commented out to 'go inside' the SeQuences
// we don't any longer skip them !
// if( vr == "SQ" )
// SkipLoad = true;
- // A sequence "contains" a set of Elements.
+ // A SeQuence "contains" a set of Elements.
// (fffe e000) tells us an Element is beginning
// (fffe e00d) tells us an Element just ended
- // (fffe e0dd) tells us the current SQuence just ended
+ // (fffe e0dd) tells us the current SeQuence just ended
if( group == 0xfffe )
SkipLoad = true;
s << "gdcm::NotLoaded.";
s << " Address:" << (long)ElVal->GetOffset();
s << " Length:" << ElVal->GetLength();
+ s << " x(" << std::hex << ElVal->GetLength() << ")";
ElVal->SetValue(s.str());
return;
}
// When an integer is expected, read and convert the following two or
// four bytes properly i.e. as an integer as opposed to a string.
- // pour les elements de Value Multiplicity > 1
- // on aura en fait une serie d'entiers
- // on devrait pouvoir faire + compact (?)
+ // Actually, elements with Value Multiplicity > 1
+ // contain a set of integers (not a single one)
+ // Any compacter code suggested (?)
if ( IsAnInteger(ElVal) ) {
guint32 NewInt;
*/
int gdcmHeader::ReplaceOrCreateByNumber(std::string Value,
guint16 Group, guint16 Elem ) {
-
// TODO : FIXME JPRx
// curieux, non ?
// on (je) cree une Elvalue ne contenant pas de valeur
* \ingroup gdcmHeader
* \brief Searches within the public dictionary for element value of
* a given tag.
- * @param TagName name of the researched element.
+ * @param TagName name of the searched element.
* @return Corresponding element value when it exists, and the string
* GDCM_UNFOUND ("gdcm::Unfound") otherwise.
*/
* to convert the string typed content to caller's native type
* (think of C++ vs Python). The VR is actually of a higher level
* of semantics than just the native C++ type.
- * @param TagName name of the researched element.
+ * @param TagName name of the searched element.
* @return Corresponding element value representation when it exists,
* and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.
*/
* \ingroup gdcmHeader
* \brief Searches within elements parsed with the SHADOW dictionary
* for the element value of a given tag.
- * @param group Group of the researched tag.
- * @param element Element of the researched tag.
+ * @param group Group of the searched tag.
+ * @param element Element of the searched tag.
* @return Corresponding element value representation when it exists,
* and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.
*/
* to convert the string typed content to caller's native type
* (think of C++ vs Python). The VR is actually of a higher level
* of semantics than just the native C++ type.
- * @param group Group of the researched tag.
- * @param element Element of the researched tag.
+ * @param group Group of the searched tag.
+ * @param element Element of the searched tag.
* @return Corresponding element value representation when it exists,
* and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.
*/
* \ingroup gdcmHeader
* \brief Searches within the elements parsed with the shadow dictionary
* for an element value of given tag.
- * @param TagName name of the researched element.
+ * @param TagName name of the searched element.
* @return Corresponding element value when it exists, and the string
* GDCM_UNFOUND ("gdcm::Unfound") otherwise.
*/
* to convert the string typed content to caller's native type
* (think of C++ vs Python). The VR is actually of a higher level
* of semantics than just the native C++ type.
- * @param TagName name of the researched element.
+ * @param TagName name of the searched element.
* @return Corresponding element value representation when it exists,
* and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.
*/
* \brief Searches within elements parsed with the public dictionary
* and then within the elements parsed with the shadow dictionary
* for the element value of a given tag.
- * @param group Group of the researched tag.
- * @param element Element of the researched tag.
+ * @param group Group of the searched tag.
+ * @param element Element of the searched tag.
* @return Corresponding element value representation when it exists,
* and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.
*/
* to convert the string typed content to caller's native type
* (think of C++ vs Python). The VR is actually of a higher level
* of semantics than just the native C++ type.
- * @param group Group of the researched tag.
- * @param element Element of the researched tag.
+ * @param group Group of the searched tag.
+ * @param element Element of the searched tag.
* @return Corresponding element value representation when it exists,
* and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.
*/
* \brief Searches within elements parsed with the public dictionary
* and then within the elements parsed with the shadow dictionary
* for the element value of a given tag.
- * @param TagName name of the researched element.
+ * @param TagName name of the searched element.
* @return Corresponding element value when it exists,
* and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.
*/
* to convert the string typed content to caller's native type
* (think of C++ vs Python). The VR is actually of a higher level
* of semantics than just the native C++ type.
- * @param TagName name of the researched element.
+ * @param TagName name of the searched element.
* @return Corresponding element value representation when it exists,
* and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.
*/
rewind(fp);
CheckSwap();
- while ( (newElValue = ReadNextElement()) ) {
+ while ( (newElValue = ReadNextElement()) ) {
SkipElementValue(newElValue);
PubElValSet.Add(newElValue);
}
/**
* \ingroup gdcmHeader
- * \brief This predicate, based on hopefully reasonnable heuristics,
+ * \brief This predicate, based on hopefully reasonable heuristics,
* decides whether or not the current gdcmHeader was properly parsed
* and contains the mandatory information for being considered as
* a well formed and usable image.
* public tag based hash table.
*/
void gdcmHeader::LoadElements(void) {
- rewind(fp);
- TagElValueHT ht = PubElValSet.GetTagHt();
- for (TagElValueHT::iterator tag = ht.begin(); tag != ht.end(); ++tag) {
- LoadElementValue(tag->second);
- }
+ rewind(fp);
+
+ // We don't use any longer the HashTable, since a lot a stuff is missing
+ // we SeQuences were encountered
+ //
+ //TagElValueHT ht = PubElValSet.GetTagHt();
+ //for (TagElValueHT::iterator tag = ht.begin(); tag != ht.end(); ++tag) {
+ // LoadElementValue(tag->second);
+ //}
+
+ for (std::list<gdcmElValue*>::iterator i = GetListElem().begin();
+ i != GetListElem().end();
+ ++i){
+ LoadElementValue(*i);
+ }
+
rewind(fp);
// Load 'non string' values
*/
int gdcmHeader::Write(FILE * fp, FileType type) {
-
- // TODO : move the following lines (and a lot of others)
+ // TODO : move the following lines (and a lot of others, to be written)
// to a future function CheckAndCorrectHeader
if (type == ImplicitVR) {