Program: gdcm
Module: $RCSfile: gdcmArgMgr.cxx,v $
Language: C++
- Date: $Date: 2006/01/26 18:34:13 $
- Version: $Revision: 1.20 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ 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
}
/* Set labels to upper-case (labels are not case sensitive ) *********/
+ char *secu;
for ( i=0; i<ArgCount; i++)
+ {
+ secu = ArgLab[i];
ArgLab[i] = Majuscule ( ArgLab[i] ) ;
+ //free (secu); //we still need it in the caller pgm.
+ }
/* Standard arguments are managed by ArgStdArgs **********************/
ArgStdArgs();
trouve = ( strcmp( ArgLab[i], temp )==0 ) ;
if ( trouve )
{
+ free (temp);
ArgUsed[i] = true ;
for ( int j=1; j<i; j++)
{
ArgUsed[j] = i ;
}
return i ;
- }
+ }
}
+ free (temp);
return 0 ;
}
Program: gdcm
Module: $RCSfile: gdcmCommon.h,v $
Language: C++
- Date: $Date: 2006/03/17 14:31:43 $
- Version: $Revision: 1.108 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.109 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmConfigure.h"
#include "gdcmSystem.h"
#include "gdcmMacro.h"
-
+#include "gdcmVRKey.h"
#include <string>
//-----------------------------------------------------------------------------
unsigned short int Group;
/// Dicom Element number
unsigned short int Elem;
+ /// Value Representation
+ VRKey VR;
/// value (coded as a std::string) of the Element
std::string Value;
};
Program: gdcm
Module: $RCSfile: gdcmDataEntry.cxx,v $
Language: C++
- Date: $Date: 2006/03/31 07:52:23 $
- Version: $Revision: 1.35 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.36 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
* \brief Constructor for a given DictEntry
* @param e Pointer to existing dictionary entry
*/
-DataEntry::DataEntry(DictEntry *e)
- : DocEntry(e)
+DataEntry::DataEntry(uint16_t group,uint16_t elem,
+ VRKey const &vr)
+ : DocEntry(group,elem,vr)
{
State = STATE_LOADED;
Flag = FLAG_NONE;
* @param e Pointer to existing Doc entry
*/
DataEntry::DataEntry(DocEntry *e)
- : DocEntry(e->GetDictEntry())
+ //: DocEntry(e->GetDictEntry())
+ : DocEntry(e->GetGroup(),e->GetElement(), e->GetVR() )
{
Flag = FLAG_NONE;
BinArea = 0;
/**
* \brief Checks if the multiplicity of the value follows Dictionary VM
*/
-bool DataEntry::IsValueCountValid() const
+bool DataEntry::IsValueCountValid() /*const*/
{
uint32_t vm;
const std::string &strVM = GetVM();
}
else
{
- if( value.size() > 0 )
+ //if( value.size() > 0 ) // when user sets a string to 0, *do* the job.
{
size_t l = value.size();
SetLength(l + l%2);
memcpy(BinArea, value.c_str(), l);
if (l%2)
BinArea[l] = '\0';
- }
+ }
}
State = STATE_LOADED;
}
else
{
StrArea.append((const char *)BinArea,GetLength());
- // to avoid gdcm propagate oddities in lengthes
+ // to avoid gdcm to propagate oddities in lengthes
if ( GetLength()%2)
StrArea.append(" ",1);
}
uint8_t *data = BinArea; //safe notation
size_t l = GetLength();
- gdcmDebugMacro("in DataEntry::WriteContent " << GetKey() << " AtomicLength: "
- << Global::GetVR()->GetAtomicElementLength(this->GetVR() ) // << " BinArea in :" << &BinArea
- );
+// gdcmDebugMacro("in DataEntry::WriteContent " << GetKey() << " AtomicLength: "
+// << Global::GetVR()->GetAtomicElementLength(this->GetVR() ) // << " BinArea in :" << &BinArea
+// );
if (BinArea) // the binArea was *actually* loaded
{
#if defined(GDCM_WORDS_BIGENDIAN) || defined(GDCM_FORCE_BIGENDIAN_EMULATION)
Program: gdcm
Module: $RCSfile: gdcmDataEntry.h,v $
Language: C++
- Date: $Date: 2006/03/01 09:29:29 $
- Version: $Revision: 1.13 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.14 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
public:
/// \brief Contructs a DataEntry with a RefCounter from DictEntry
- static DataEntry *New(DictEntry *e) {return new DataEntry(e);}
+// static DataEntry *New(DictEntry *e) {return new DataEntry(e);}
/// \brief Contructs a DataEntry with a RefCounter from DocEntry
static DataEntry *New(DocEntry *d) {return new DataEntry(d);}
-
+/// \brief Contructs a DataEntry with a RefCounter from elementary items
+ static DataEntry *New(uint16_t group,uint16_t elem, VRKey const &vr)
+ {return new DataEntry(group,elem,vr);}
+
// Print
void Print(std::ostream &os = std::cout, std::string const &indent = "");
void SetValue(const uint32_t &id,const double &val);
double GetValue(const uint32_t &id) const;
uint32_t GetValueCount() const;
- bool IsValueCountValid() const;
+ bool IsValueCountValid() /*const*/; // GetVM may update the pointer DicomDict
void SetString(std::string const &value);
std::string const &GetString() const;
// Flags
/// \brief sets the 'pixel data flag'
void SetFlag(const TValueFlag &flag) { Flag = flag; }
- /// \brief returns the 'pixel data flag'
+ /// \brief returns the 'pixel data flag'
const TValueFlag &GetFlag() const { return Flag; }
/// \brief true id Entry is a Pixel Data entry
bool IsPixelData() { return (Flag &FLAG_PIXELDATA) != 0; }
bool GetDSValue(std::vector <double> &valueVector);
protected:
- DataEntry(DictEntry *e);
- DataEntry(DocEntry *d);
+ // DataEntry(DictEntry *e);
+ DataEntry(DocEntry *d);
+ DataEntry(uint16_t group,uint16_t elem,VRKey const &vr);
~DataEntry();
// Methods :
Program: gdcm
Module: $RCSfile: gdcmDebug.h,v $
Language: C++
- Date: $Date: 2006/01/03 14:28:53 $
- Version: $Revision: 1.53 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.54 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// No NDEBUG test to always have a return of warnings !!!
// -> Rien compris! JPRx
#define gdcmLogBodyMacro(obj, msg) \
-{ \
+{ \
if( Debug::GetLogFlag() ) \
gdcmMessageBodyMacro(gdcm::CMD_LOG,obj,msg,""); \
}
Program: gdcm
Module: $RCSfile: gdcmDefaultDicts.cxx.in,v $
Language: C++
- Date: $Date: 2005/10/20 15:24:08 $
- Version: $Revision: 1.11 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ 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
const char *type;
unsigned short group;
unsigned short element;
+ //VRKey vr;
+ const char *vr;
const char *value;
} ELEMENT;
while( e.type != 0 )
{
- // Force to use the string comparision operator ==
+ // Force to use the string comparison operator ==
strType = e.type;
if( strType == "metaElem" )
type = DD_META;
elem.Group = e.group;
elem.Elem = e.element;
+ elem.VR = e.vr;
elem.Value = e.value;
dde->AddEntry( type, elem);
e = dataElement[++i];
Program: gdcm
Module: $RCSfile: gdcmDicomDir.cxx,v $
Language: C++
- Date: $Date: 2006/02/16 20:06:13 $
- Version: $Revision: 1.186 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.187 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
{
tmpGr = it->Group;
tmpEl = it->Elem;
- dictEntry = GetPubDict()->GetEntry(tmpGr, tmpEl);
-
- entry = DataEntry::New( dictEntry );
+ //dictEntry = GetPubDict()->GetEntry(tmpGr, tmpEl);
+ //entry = DataEntry::New( dictEntry );
+
+ entry = DataEntry::New(tmpGr, tmpEl, GDCM_VRUNKNOWN); /// \todo : modify dicomelements file, to store VR
entry->SetOffset(0); // just to avoid further missprinting
if ( header )
Program: gdcm
Module: $RCSfile: gdcmDicomDirElement.cxx,v $
Language: C++
- Date: $Date: 2005/11/04 15:29:59 $
- Version: $Revision: 1.42 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.43 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
else
{
char buff[1024];
+ char buff2[1024];
std::string strType;
DicomElement elem;
DicomDirType type;
-
while (!from.eof())
{
from >> std::ws;
if ( type!=DD_UNKNOWN )
{
- from >> std::hex >> elem.Group >> elem.Elem;
+ from >> std::hex >> elem.Group >> elem.Elem;// >> elem.VR;
+ from.getline(buff2, 1024, '"');
+ from >> std::ws;
+ from.getline(buff2, 1024, '"');
+ elem.VR[0] = buff2[0];
+ elem.VR[1] = buff2[1];
+
from >> std::ws;
from.getline(buff, 1024, '"');
from >> std::ws;
from.getline(buff, 1024, '"');
elem.Value = buff;
-
+
AddEntry(type, elem);
}
from.getline(buff, 1024, '\n');
* @param type Element type (DD_PATIENT, DD_STUDY, DD_SERIE, DD_IMAGE)
* @param group Group number of the entry to be added
* @param elem Element number of the entry to be added
+ * @param vr Value Representation of the entry to be added
*/
void DicomDirElement::AddDicomDirElement(DicomDirType type,
- uint16_t group, uint16_t elem)
+ uint16_t group, uint16_t elem, VRKey vr)
{
DicomElement el;
el.Group = group;
el.Elem = elem;
+ el.VR = vr;
el.Value = "";
AddEntry(type, el);
}
{
std::ostringstream s;
std::list<DicomElement>::iterator it;
- //char greltag[10]; //group element tag
TagKey greltag;
s << "Meta Elements :"<<std::endl;
Program: gdcm
Module: $RCSfile: gdcmDicomDirElement.h,v $
Language: C++
- Date: $Date: 2005/11/28 16:31:23 $
- Version: $Revision: 1.37 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.38 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#define GDCMDICOMDIRELEMENT_H
#include "gdcmRefCounter.h"
+#include "gdcmVRKey.h"
#include <list>
// Only one instance of ddElem
void AddDicomDirElement(DicomDirType type,
- uint16_t group, uint16_t elem);
+ uint16_t group, uint16_t elem, VRKey vr);
protected:
DicomDirElement();
Program: gdcm
Module: $RCSfile: gdcmDicomDirObject.cxx,v $
Language: C++
- Date: $Date: 2005/10/25 09:22:15 $
- Version: $Revision: 1.23 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.24 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
{
// FillObject fills up the SQItem that will be connected to the right place
ListDicomDirMetaElem::const_iterator it;
- uint16_t tmpGr,tmpEl;
- DictEntry *dictEntry;
+ //uint16_t tmpGr,tmpEl;
+ //DictEntry *dictEntry;
DataEntry *entry;
// for all the Elements found in they own part of the DicomDir dict.
for(it = elemList.begin(); it != elemList.end(); ++it)
{
- tmpGr = it->Group;
- tmpEl = it->Elem;
- dictEntry = Global::GetDicts()->GetDefaultPubDict()->GetEntry(tmpGr,tmpEl);
- entry = DataEntry::New(dictEntry);
+ //tmpGr = it->Group;
+ //tmpEl = it->Elem;
+ //dictEntry = Global::GetDicts()->GetDefaultPubDict()->GetEntry(tmpGr,tmpEl);
+ //entry = DataEntry::New(dictEntry);
+ entry = DataEntry::New(it->Group, it->Elem, it->VR );
entry->SetOffset(0); // just to avoid further missprinting
entry->SetString(it->Value);
Program: gdcm
Module: $RCSfile: gdcmDicomEntry.cxx,v $
Language: C++
- Date: $Date: 2005/10/21 07:38:57 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.4 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
=========================================================================*/
#include "gdcmDicomEntry.h"
-#include "gdcmDebug.h"
-#include "gdcmUtil.h"
+//#include "gdcmDebug.h"
+//#include "gdcmUtil.h"
-#include <iomanip> // for std::ios::left, ...
+//#include <iomanip> // for std::ios::left, ...
#include <fstream>
-#include <stdio.h> // for sprintf
+//#include <stdio.h> // for sprintf
namespace gdcm
{
DicomEntry::DicomEntry(const uint16_t &group,const uint16_t &elem,
const VRKey &vr)
{
- Tag.SetGroup(group);
- Tag.SetElement(elem);
+ //Tag.SetGroupElement(group);
+ //Tag.SetElement(elem);
+ Tag.SetGroupElement(group,elem);
VR = vr;
}
//-----------------------------------------------------------------------------
// Public
-/**
- * \brief concatenates 2 uint16_t (supposed to be a Dicom group number
- * and a Dicom element number)
- * @param group the Dicom group number used to build the tag
- * @param elem the Dicom element number used to build the tag
- * @return the built tag
- */
-TagKey DicomEntry::TranslateToKey(uint16_t group, uint16_t elem)
-{
- // according to 'Purify', TranslateToKey is one of the most
- // time consuming methods.
- // Let's try to shorten it !
- return TagKey(group,elem);
-}
//-----------------------------------------------------------------------------
// Protected
Program: gdcm
Module: $RCSfile: gdcmDicomEntry.h,v $
Language: C++
- Date: $Date: 2005/11/28 15:30:04 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ 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
const TagKey &GetKey() const { return Tag; }
// Key creation
- static TagKey TranslateToKey(uint16_t group, uint16_t elem);
+ static TagKey TranslateToKey(uint16_t group, uint16_t elem)
+ { return TagKey(group,elem); }
protected:
DicomEntry(const uint16_t &group,const uint16_t &elt,
Program: gdcm
Module: $RCSfile: gdcmDict.cxx,v $
Language: C++
- Date: $Date: 2005/11/05 13:25:26 $
- Version: $Revision: 1.83 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.84 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
Dict::Dict(std::string const &filename)
{
-
+ gdcmDebugMacro( "in Dict::Dict, filename =[" << filename << "]" );
std::ifstream from( filename.c_str() );
if ( !from )
{
}
else
{
+ gdcmDebugMacro( "in Dict::Dict, DoTheLoadingJob filename =["
+ << filename << "]" );
DoTheLoadingJob(from);
Filename = filename;
}
* @param newEntry new entry (overwrites any previous one with same tag)
* @return false if Dicom Element doesn't exist
*/
-bool Dict::ReplaceEntry(DictEntry *newEntry)
+
+ /* seems to be useless
+
+bool Dict::ReplaceEntry(DictEntry *newEntry) // seems to be useless
{
const TagKey &key = newEntry->GetKey();
if ( RemoveEntry(key) )
}
return false;
}
-
+*/
/**
* \brief removes an already existing Dicom Dictionary Entry,
* identified by its Tag
TagKeyHT::const_iterator it = KeyHt.find(key);
if ( it != KeyHt.end() )
{
- it->second->Unregister();
- KeyHt.erase(key);
+ it->second->Unregister(); // delete the entry
+ KeyHt.erase(key); // remove pointer from HTable
return true;
}
// we assume all the pointed DictEntries are already cleaned-up
// when we clean KeyHt.
TagKeyHT::const_iterator it;
+
for(it = KeyHt.begin();it!=KeyHt.end();++it)
- it->second->Unregister();
- KeyHt.clear();
+ it->second->Unregister(); // delete the entry
+ KeyHt.clear(); // remove all the entries from HTable
+
}
/**
*/
void Dict::Print(std::ostream &os, std::string const & )
{
- os << "Dict file name : " << Filename << std::endl;
+ os << "Dict file name : [" << Filename << "]" << std::endl;
std::ostringstream s;
for (TagKeyHT::iterator tag = KeyHt.begin(); tag != KeyHt.end(); ++tag)
- {
+ {
+std::cout << tag->second->GetKey() << " " << tag->second->GetName()
+ << std::endl;
s << "Entry : ";
s << "(" << tag->second->GetKey() << ") = "
<< std::dec;
s << tag->second->GetVR() << ", ";
s << tag->second->GetVM() << ", ";
s << tag->second->GetName() << "." << std::endl;
+
}
os << s.str();
+
}
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmDict.h,v $
Language: C++
- Date: $Date: 2005/11/28 16:31:23 $
- Version: $Revision: 1.48 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ 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
// Entries
bool AddEntry(DictEntry *newEntry);
- bool ReplaceEntry(DictEntry *newEntry);
+ // bool ReplaceEntry(DictEntry *newEntry); // useless ?
bool RemoveEntry (TagKey const &key);
bool RemoveEntry (uint16_t group, uint16_t elem);
void ClearEntry();
Program: gdcm
Module: $RCSfile: gdcmDocEntry.cxx,v $
Language: C++
- Date: $Date: 2006/03/22 13:19:25 $
- Version: $Revision: 1.82 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.83 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmGlobal.h"
#include "gdcmUtil.h"
#include "gdcmDebug.h"
-
+#include "gdcmDictSet.h"
#include <iomanip> // for std::ios::left, ...
#include <fstream>
// Constructor / Destructor
/**
* \brief Constructor from a given DictEntry
- * @param in Pointer to existing dictionary entry
+ * @param group Group number
+ * @param elem Element number
+ * @param vr VR
*/
-DocEntry::DocEntry(DictEntry *in)
+DocEntry::DocEntry(uint16_t group, uint16_t elem, VRKey const &vr)
{
ImplicitVR = false;
- DicomDict = in;
+ DicomDict = 0;
Offset = 0 ; // To avoid further missprinting
// init some variables
ReadLength = 0;
Length = 0;
- gdcmAssertMacro(DicomDict);
- DicomDict->Register();
-
- VR = in->GetVR();
- Key = in->GetKey();
+ VR = vr;
+ Key.SetGroupElem(group,elem);
}
/**
*/
DocEntry::~DocEntry()
{
- gdcmAssertMacro(DicomDict);
-
- DicomDict->Unregister();
+ if (DicomDict)
+ {
+ gdcmAssertMacro(DicomDict);
+ DicomDict->Unregister();
+ }
}
//-----------------------------------------------------------------------------
VRKey vr = GetVR();
uint16_t elem = GetElement();
uint32_t lgth = GetLength();
-
+
if ( group == 0xfffe && elem == 0x0000 )
{
// Fix in order to make some MR PHILIPS images e-film readable
// Special case of delimiters:
if (group == 0xfffe)
- {
+ {
// Delimiters have NO Value Representation
// Hence we skip writing the VR.
//
binary_write(*fp, ff);
return;
}
-
uint16_t zero = 0;
uint16_t shortLgr = (uint16_t)lgth;
{
// GDCM_VRUNKNOWN was stored in the Entry VR;
// deal with Entry as if TS were Implicit VR
-
binary_write(*fp, lgth);
}
else
{
binary_write(*fp, vr.str());
-
// See PS 3.5-2004 page 33, 36
if ( (vr == "SQ") || (vr == "OB") || (vr == "OW") || (vr == "OF")
|| (vr == "UN") || (vr == "UT") )
}
}
+/// \brief Returns the 'Name' '(e.g. "Patient's Name") found in the Dicom
+/// Dictionnary of the current Dicom Header Entry
+std::string const &DocEntry::GetName()
+{
+ if (DicomDict == 0)
+ DicomDict =
+ Global::GetDicts()->GetDefaultPubDict()->GetEntry(Key[0],Key[1]);
+ if (DicomDict == 0)
+ return GDCM_UNKNOWN;
+ else
+ {
+ DicomDict->Register();
+ return DicomDict->GetName();
+ }
+}
+
+ /// \brief Returns the 'Value Multiplicity' (e.g. "1", "6", "1-n", "3-n"),
+ /// found in the Dicom entry or in the Dicom Dictionnary
+ /// of the current Dicom entry
+std::string const &DocEntry::GetVM()
+{
+ if (DicomDict == 0)
+ DicomDict =
+ Global::GetDicts()->GetDefaultPubDict()->GetEntry(Key[0],Key[1]);
+ if (DicomDict == 0)
+ return GDCM_UNKNOWN;
+ else
+ {
+ DicomDict->Register();
+ return DicomDict->GetVM();
+ }
+}
+
/**
* \brief Gets the full length of the elementary DocEntry (not only value
* length) depending on the VR.
Program: gdcm
Module: $RCSfile: gdcmDocEntry.h,v $
Language: C++
- Date: $Date: 2006/03/22 13:19:25 $
- Version: $Revision: 1.61 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.62 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
DictEntry * GetDictEntry() { return DicomDict; }
/// Returns the Dicom Group number of the current Dicom entry
- const uint16_t GetGroup() const { return Key.GetGroup(); }
+ const uint16_t GetGroup() const { return Key[0]; }
//const uint16_t &GetGroup() const { return DicomDict->GetGroup(); }
/// Returns the Dicom Element number of the current Dicom entry
- const uint16_t GetElement() const { return Key.GetElement();}
+ const uint16_t GetElement() const { return Key[1];}
//const uint16_t &GetElement() const { return DicomDict->GetElement();}
/// Returns the 'key' of the current Dicom entry
/// \brief Returns the 'Name' '(e.g. "Patient's Name") found in the Dicom
/// Dictionnary of the current Dicom Header Entry
- std::string const &GetName() const { return DicomDict->GetName(); }
+ std::string const &GetName();
/// \brief Returns the 'Value Representation' (e.g. "PN" : Person Name,
/// "SL" : Signed Long), found in the Dicom header or in the Dicom
/// \brief Returns the 'Value Multiplicity' (e.g. "1", "6", "1-n", "3-n"),
/// found in the Dicom entry or in the Dicom Dictionnary
/// of the current Dicom entry
- std::string const &GetVM() const { return DicomDict->GetVM(); }
+ std::string const &GetVM();
/// Sets the 'Value Multiplicity' of the current Dicom entry
- void SetVM( TagName const &v) { DicomDict->SetVM(v); }
-
+ //void SetVM( TagName const &v) { DicomDict->SetVM(v); }
+ void SetVM( TagName &v) { std::cout << "-----------------FIXME : SetVM "; }
+
/// \brief Returns offset (since the beginning of the file, including
/// the File Preamble, if any) of the value of the current Dicom entry
/// \warning offset of the *value*, not of the Dicom entry
/// \brief Tells us if the VR of the current Dicom entry is Unknown
/// @return true if the VR is unknown
- bool IsVRUnknown() const { return DicomDict->IsVRUnknown(); }
+// bool IsVRUnknown() const { return DicomDict->IsVRUnknown(); }
+ bool IsVRUnknown() const { return VR == GDCM_VRUNKNOWN; }
/// \brief Tells us if the VM of the current Dicom entry is Unknown
/// @return true if the VM is unknown
- bool IsVMUnknown() const { return DicomDict->IsVMUnknown(); }
-
+// bool IsVMUnknown() const { return DicomDict->IsVMUnknown(); }
+ bool IsVMUnknown() { return GetVM() == GDCM_UNKNOWN; }
bool IsItemDelimitor();
bool IsItemStarter();
bool IsSequenceDelimitor();
virtual void Copy(DocEntry *doc);
protected:
- DocEntry(DictEntry*);
+ // DocEntry(DictEntry*);
+ DocEntry(uint16_t group, uint16_t elem, VRKey const &vr);
virtual ~DocEntry();
/// \brief pointer to the underlying Dicom dictionary element
Program: gdcm
Module: $RCSfile: gdcmDocEntryArchive.cxx,v $
Language: C++
- Date: $Date: 2005/10/24 16:00:47 $
- Version: $Revision: 1.17 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.18 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
if ( !newEntry )
return false;
- uint16_t group = newEntry->GetDictEntry()->GetGroup();
- uint16_t elem = newEntry->GetDictEntry()->GetElement();
- TagKey key = DictEntry::TranslateToKey(group,elem);
+ //uint16_t group = newEntry->GetDictEntry()->GetGroup();
+ //uint16_t elem = newEntry->GetDictEntry()->GetElement();
+ //TagKey key = DictEntry::TranslateToKey(group,elem);
+ TagKey key = newEntry->GetKey();
+
if ( Archive.find(key) == Archive.end() )
{
+ uint16_t group = newEntry->GetGroup();
+ uint16_t elem = newEntry->GetElement();
+
// Save the old DocEntry if any
DocEntry *old = ArchFile->GetDocEntry(group, elem);
Archive[key] = old;
*/
bool DocEntryArchive::Push(uint16_t group, uint16_t elem)
{
- TagKey key = DictEntry::TranslateToKey(group, elem);
-
+ //TagKey key = DictEntry::TranslateToKey(group, elem);
+ TagKey key(group, elem);
if ( Archive.find(key)==Archive.end() )
{
// Save the old DocEntry if any
*/
bool DocEntryArchive::Restore(uint16_t group, uint16_t elem)
{
- TagKey key=DictEntry::TranslateToKey(group, elem);
-
+ //TagKey key=DictEntry::TranslateToKey(group, elem);
+ TagKey key(group, elem);
TagDocEntryHT::iterator restoreIt=Archive.find(key);
if ( restoreIt!=Archive.end() )
{
Program: gdcm
Module: $RCSfile: gdcmDocEntrySet.cxx,v $
Language: C++
- Date: $Date: 2006/03/22 13:19:25 $
- Version: $Revision: 1.71 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.72 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/**
* \brief Modifies the value of a given Doc Entry (Dicom Element)
- * when it exists. Create it with the given value when unexistant.
+ * when it exists. Creates it with the given value when unexistant.
* @param value (string) Value to be set
* @param group Group number of the Entry
* @param elem Element number of the Entry
{
DataEntry *dataEntry = 0;
DocEntry *currentEntry = GetDocEntry( group, elem );
-
+ VRKey localVR = vr;
if (currentEntry)
{
dataEntry = dynamic_cast<DataEntry *>(currentEntry);
}
}
}
+
+ else // the 'currentEntry' was not found
+ {
+ if ( vr == GDCM_VRUNKNOWN ) // user didn't specify a VR.
+ // Probabely he trusts the Dicom Dict !
+ {
+ DictEntry *e =
+ Global::GetDicts()->GetDefaultPubDict()->GetEntry(group, elem);
+ if ( e )
+ {
+ localVR = e->GetVR();
+ e->Register(); // ?? JPRx
+ }
+ }
+ }
// Create a new dataEntry if necessary
if ( !dataEntry )
{
- dataEntry = NewDataEntry( group, elem, vr );
+ dataEntry = NewDataEntry( group, elem, localVR );
if ( !AddEntry(dataEntry) )
{
- gdcmWarningMacro("AddEntry failed although this is a creation.");
+ gdcmWarningMacro("AddEntry " << dataEntry->GetKey()
+ << " failed although this is a creation.");
dataEntry->Delete();
return NULL;
}
- dataEntry->Delete();
+ dataEntry->Delete(); // ?!? JPRx
}
// Set the dataEntry value
return GetDocEntry(group,elem)!=NULL;
}
+
/**
* \brief Build a new DataEntry from all the low level arguments.
* Check for existence of dictionary entry, and build
DataEntry *DocEntrySet::NewDataEntry(uint16_t group,uint16_t elem,
VRKey const &vr)
{
- DictEntry *dictEntry = GetDictEntry(group, elem, vr);
- DataEntry *newEntry = DataEntry::New(dictEntry);
- dictEntry->Unregister(); // GetDictEntry register it
+ DataEntry *newEntry = DataEntry::New(group,elem,vr);
if (!newEntry)
{
gdcmWarningMacro( "Failed to allocate DataEntry for ("
*/
SeqEntry* DocEntrySet::NewSeqEntry(uint16_t group, uint16_t elem)
{
- DictEntry *dictEntry = GetDictEntry(group, elem, "SQ");
+ //DictEntry *dictEntry = GetDictEntry(group, elem, "SQ");
- SeqEntry *newEntry = SeqEntry::New( dictEntry );
- dictEntry->Unregister(); // GetDictEntry register it
+ //SeqEntry *newEntry = SeqEntry::New( dictEntry );
+ SeqEntry *newEntry = SeqEntry::New( group,elem );
+ //dictEntry->Unregister(); // GetDictEntry register it
if (!newEntry)
{
gdcmWarningMacro( "Failed to allocate SeqEntry for ("
{
DictEntry *found = 0;
/// \todo store the DefaultPubDict somwhere, in order not to access the HTable
- /// every time !
+ /// every time ! --> Done!
Dict *pubDict = Global::GetDicts()->GetDefaultPubDict();
if (!pubDict)
{
return found;
}
-/**
- * \brief Searches [both] the public [and the shadow dictionary (when they
- * exist)] for the presence of the DictEntry with given
- * group and element, and creates a new virtual DictEntry if necessary
- * @param group group number of the searched DictEntry
- * @param elem element number of the searched DictEntry
- * @param vr V(alue) R(epresentation) to use, if necessary
- * @return Corresponding DictEntry when it exists, NULL otherwise.
- * \remarks The returned DictEntry is registered
- */
-DictEntry *DocEntrySet::GetDictEntry(uint16_t group, uint16_t elem,
- VRKey const &vr)
-{
- DictEntry *dictEntry = GetDictEntry(group,elem);
- DictEntry *goodEntry = dictEntry;
- VRKey goodVR = vr;
- TagName vm;
- if (elem == 0x0000)
- goodVR="UL";
-
- if ( goodEntry )
- {
- if ( goodVR != goodEntry->GetVR()
- && goodVR != GDCM_VRUNKNOWN )
- {
- gdcmWarningMacro("For (" << std::hex << group << "|"
- << elem << "), found VR : [" << vr << "]"
- << " expected: [" << goodEntry->GetVR() << "]" ) ;
- // avoid confusing further validator with "FIXME" VM
- // when possible
- vm = dictEntry->GetVM();
- goodEntry = NULL;
- }
- dictEntry->Unregister();
- }
- else
- {
- vm = "FIXME";
- }
- // Create a new virtual DictEntry if necessary
- if (!goodEntry)
- {
- if (dictEntry)
- {
-
- goodEntry = DictEntry::New(group, elem, goodVR, vm,
- dictEntry->GetName() );
- }
- else
- {
- goodEntry = DictEntry::New(group, elem, goodVR);
- }
- }
- else
- {
- goodEntry->Register();
- }
- return goodEntry;
-}
-
//-----------------------------------------------------------------------------
// Private
Program: gdcm
Module: $RCSfile: gdcmDocEntrySet.h,v $
Language: C++
- Date: $Date: 2005/11/30 08:48:17 $
- Version: $Revision: 1.67 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.68 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// DictEntry related utilities
DictEntry *GetDictEntry(uint16_t group, uint16_t elem);
- DictEntry *GetDictEntry(uint16_t group, uint16_t elem,
- VRKey const &vr);
+ // DictEntry *GetDictEntry(uint16_t group, uint16_t elem,
+ // VRKey const &vr);
/// To be able to backtrack (Private Sequence, Implicit VR related pb)
DocEntry *PreviousDocEntry;
Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2006/03/14 12:09:18 $
- Version: $Revision: 1.345 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.346 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
fp->write(filePreamble, 128);
fp->write("DICM", 4);
}
-
/*
* \todo rewrite later, if really usefull
* - 'Group Length' element is optional in DICOM
bool delim_mode_intern = delim_mode;
bool first = true;
gdcmDebugMacro( "Enter in ParseDES, delim-mode " << delim_mode
- << " at offset " << std::hex << "0x(" << offset << ")" );
+ << " at offset " << std::hex << "0x(" << offset << ")" );
while (true)
{
// Uncomment to track the bug
/*
if( Debug::GetDebugFlag() )
- std::cout << std::dec <<"(long)(Fp->tellg()) " << (long)(Fp->tellg())
+ std::cout << std::dec <<"(long)(Fp->tellg()) " << (long)(Fp->tellg()) // in Debug mode
<< std::hex << " 0x(" <<(long)(Fp->tellg()) << ")" << std::endl;
-*/
-
+*/
+
// if ( !delim_mode && ((long)(Fp->tellg())-offset) >= l_max) // Once per DocEntry
if ( !delim_mode ) // 'and then' doesn't exist in C++ :-(
if ( ((long)(Fp->tellg())-offset) >= l_max) // Once per DocEntry, when no delim mode
l, delim_mode_intern);
gdcmDebugMacro( "Exit from ParseSQ, delim " << delim_mode_intern);
-
}
if ( !set->AddEntry( newSeqEntry ) )
{
VRKey Document::FindDocEntryVR()
{
if ( Filetype != ExplicitVR )
+ {
return GDCM_VRUNKNOWN;
+ }
// Delimiters (0xfffe), are not explicit VR ...
if ( CurrentGroup == 0xfffe )
if ( !CheckDocEntryVR(vr) )
{
/*
- std::cout << "================================================================Unknown VR"
+// std::cout << "================================================================Unknown VR"
<< std::hex << "0x("
<< (unsigned int)vr[0] << "|" << (unsigned int)vr[1]
<< ")" << "for : " << CurrentGroup
* \brief during parsing, Header Elements too long are not loaded in memory
* @param newSize new size
*/
-void Document::SetMaxSizeLoadEntry(long newSize)
+void Document::SetMaxSizeLoadEntry(long newSize)
{
if ( newSize < 0 )
{
* (read the 'Group Number', the 'Element Number',
* gets the Dict Entry
* gets the VR, gets the length, gets the offset value)
- * @return On succes : the newly created DocEntry, NULL on failure.
+ * @return On succes : the newly created DocEntry, NULL on failure.
*/
DocEntry *Document::ReadNextDocEntry()
{
}
catch ( FormatError )
{
- // We reached the EOF (or an error occured) therefore
+ // We reached the EOF (or an error occured) therefore
// header parsing has to be considered as finished.
return 0;
}
-
+
// In 'true DICOM' files Group 0002 is always little endian
if ( HasDCMPreamble )
{
HandleOutOfGroup0002(CurrentGroup, CurrentElem);
else
// Sometimes file contains groups of tags with reversed endianess.
- HandleBrokenEndian(CurrentGroup, CurrentElem);
+ HandleBrokenEndian(CurrentGroup, CurrentElem);
}
-
+
VRKey vr = FindDocEntryVR();
-
VRKey realVR = vr;
if ( vr == GDCM_VRUNKNOWN )
{
realVR = "UL"; // must be UL
}
+ else if (CurrentGroup == 0xfffe) // Don't get DictEntry for Delimitors
+ {
+ realVR = "UL";
+ }
+
// Commented out in order not to generate 'Shadow Groups' where some
// Data Elements are Explicit VR and some other ones Implicit VR
// (Stupid MatLab DICOM Reader couldn't read gdcm-written images)
*/
else
{
- DictEntry *dictEntry = GetDictEntry(CurrentGroup,CurrentElem);
+ DictEntry *dictEntry = GetDictEntry(CurrentGroup,CurrentElem);//only when ImplicitVR
if ( dictEntry )
{
realVR = dictEntry->GetVR();
- dictEntry->Unregister();
+ dictEntry->Unregister(); // GetDictEntry registered it
}
}
}
DocEntry *newEntry;
//if ( Global::GetVR()->IsVROfSequence(realVR) )
if (realVR == "SQ")
+ {
newEntry = NewSeqEntry(CurrentGroup, CurrentElem);
- else
+ }
+ else
{
newEntry = NewDataEntry(CurrentGroup, CurrentElem, realVR);
static_cast<DataEntry *>(newEntry)->SetState(DataEntry::STATE_NOTLOADED);
{
// We thought this was explicit VR, but we end up with an
// implicit VR tag. Let's backtrack.
- if ( newEntry->GetGroup() != 0xfffe )
+
+ //if ( newEntry->GetGroup() != 0xfffe )
+ if (CurrentGroup != 0xfffe )
{
- std::string msg;
int offset = Fp->tellg();//Only when heuristic for Explicit/Implicit was wrong
- msg = Util::Format(
- "Entry (%04x,%04x) at x(%x) should be Explicit VR\n",
- newEntry->GetGroup(), newEntry->GetElement(), offset );
- gdcmWarningMacro( msg.c_str() );
+
+ gdcmWarningMacro("Entry (" << newEntry->GetKey() << ") at x("
+ << offset << ") should be Explicit VR");
}
}
newEntry->SetImplicitVR();
Program: gdcm
Module: $RCSfile: gdcmFile.cxx,v $
Language: C++
- Date: $Date: 2006/03/29 16:13:00 $
- Version: $Revision: 1.317 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.318 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// The changed DictEntry will have
// - a correct PixelVR OB or OW)
// - the name to "Pixel Data"
+
+ //==>Take it easy!
+ //==> Just change the VR !
+
+/*
DataEntry *oldEntry = dynamic_cast<DataEntry *>(entry);
if (oldEntry)
{
// Change only made if usefull
if ( PixelVR != oldEntry->GetVR() )
- {
- DictEntry* newDict = DictEntry::New(GrPixel,NumPixel,
- PixelVR,"1","Pixel Data");
-
- DataEntry *newEntry = DataEntry::New(newDict);
- newDict->Delete();
- newEntry->Copy(entry);
- newEntry->SetBinArea(oldEntry->GetBinArea(),oldEntry->IsSelfArea());
- oldEntry->SetSelfArea(false);
-
- RemoveEntry(oldEntry);
- AddEntry(newEntry);
- newEntry->Delete();
+ {
+ //DictEntry* newDict = DictEntry::New(GrPixel,NumPixel,
+ // PixelVR,"1","Pixel Data");
+ //DataEntry *newEntry = DataEntry::New(newDict);
+ //newDict->Delete();
+ //newEntry->Copy(entry);
+ //newEntry->SetBinArea(oldEntry->GetBinArea(),oldEntry->IsSelfArea());
+ //oldEntry->SetSelfArea(false);
+
+ //RemoveEntry(oldEntry);
+ //AddEntry(newEntry);
+ //newEntry->Delete();
+
}
}
+*/
+ VRKey PixelVR;
+ // 8 bits allocated is a 'O Bytes' , as well as 24 (old ACR-NEMA RGB)
+ // more than 8 (i.e 12, 16) is a 'O Words'
+ if ( GetBitsAllocated() == 8 || GetBitsAllocated() == 24 )
+ PixelVR = "OB";
+ else
+ PixelVR = "OW";
+ // Change only made if usefull
+ if ( PixelVR != entry->GetVR() )
+ {
+ entry->SetVR(PixelVR);
+ }
}
return true;
}
// no (GrPixel, NumPixel) element
std::string s_lgPix = Util::Format("%d", i_lgPix+12);
s_lgPix = Util::DicomString( s_lgPix.c_str() );
- InsertEntryString(s_lgPix,GrPixel, 0x0000);
+ InsertEntryString(s_lgPix,GrPixel, 0x0000, "UL");
}
}
Document::WriteContent(fp, writetype);
Module: $RCSfile: gdcmFileHelper.cxx,v $
Language: C++
- Date: $Date: 2006/03/29 16:09:48 $
- Version: $Revision: 1.98 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.99 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
bool FileHelper::Write(std::string const &fileName)
{
+
+ CheckMandatoryElements(); //called once, here !
+
bool flag = false;
DocEntry *e;
switch(WriteType)
case Unknown: // should never happen; ExplicitVR is the default value
case ExplicitVR:
-
+
// User should ask gdcm to write an image in Explicit VR mode
// only when he is sure *all* the VR of *all* the DataElements is known.
// i.e : when there are *only* Public Groups
// Let's just *dream* about it; *never* trust a user !
// We turn to Implicit VR if at least the VR of one element is unknown.
+
e = FileInternal->GetFirstEntry();
while (e != 0)
{
- if (e->GetVR() == " ")
+ if (e->GetVR() == " ")
{
SetWriteTypeToDcmImplVR();
SetWriteFileTypeToImplicitVR();
SetWriteFileTypeToExplicitVR();
}
break;
-
+
+ SetWriteFileTypeToExplicitVR(); // to see JPRx
+ break;
case ACR:
case ACR_LIBIDO:
// NOTHING is done here just for LibIDO.
// (shame on him !)
// We add Recognition Code (RET)
if ( ! FileInternal->GetDataEntry(0x0008, 0x0010) )
- FileInternal->InsertEntryString("ACR-NEMA V1.0 ", 0x0008, 0x0010);
+ FileInternal->InsertEntryString("ACR-NEMA V1.0 ",
+ 0x0008, 0x0010, "LO");
SetWriteFileTypeToACR();
// SetWriteFileTypeToImplicitVR(); // ACR IS implicit VR !
break;
SetWriteFileTypeToJPEG();
break;
}
-
- CheckMandatoryElements();
-
+
// --------------------------------------------------------------
// Special Patch to allow gdcm to re-write ACR-LibIDO formated images
//
check = FileInternal->Write(fileName,WriteType);
}
- RestoreWrite();
- RestoreWriteFileType();
- RestoreWriteMandatory();
+ RestoreWrite();
+ // RestoreWriteFileType();
+ // RestoreWriteMandatory();
+
// --------------------------------------------------------------
// Special Patch to allow gdcm to re-write ACR-LibIDO formated images
}
else
{
- DataEntry *photInt = CopyDataEntry(0x0028,0x0004);
+ DataEntry *photInt = CopyDataEntry(0x0028,0x0004,"CS");
if (FileInternal->HasLUT() )
{
photInt->SetString("PALETTE COLOR ");
{
PixelReadConverter->BuildRGBImage();
- DataEntry *spp = CopyDataEntry(0x0028,0x0002);
+ DataEntry *spp = CopyDataEntry(0x0028,0x0002,"US");
spp->SetString("3 ");
- DataEntry *planConfig = CopyDataEntry(0x0028,0x0006);
+ DataEntry *planConfig = CopyDataEntry(0x0028,0x0006,"US");
planConfig->SetString("0 ");
- DataEntry *photInt = CopyDataEntry(0x0028,0x0004);
+ DataEntry *photInt = CopyDataEntry(0x0028,0x0004,"CS");
photInt->SetString("RGB ");
if ( PixelReadConverter->GetRGB() )
// samples per pixels = 1 (in the read file)
if ( FileInternal->GetBitsAllocated()==24 )
{
- DataEntry *bitsAlloc = CopyDataEntry(0x0028,0x0100);
+ DataEntry *bitsAlloc = CopyDataEntry(0x0028,0x0100,"US");
bitsAlloc->SetString("8 ");
- DataEntry *bitsStored = CopyDataEntry(0x0028,0x0101);
+ DataEntry *bitsStored = CopyDataEntry(0x0028,0x0101,"US");
bitsStored->SetString("8 ");
- DataEntry *highBit = CopyDataEntry(0x0028,0x0102);
+ DataEntry *highBit = CopyDataEntry(0x0028,0x0102,"US");
highBit->SetString("7 ");
Archive->Push(bitsAlloc);
*/
void FileHelper::RestoreWrite()
{
+
Archive->Restore(0x0028,0x0002);
Archive->Restore(0x0028,0x0004);
+
Archive->Restore(0x0028,0x0006);
Archive->Restore(GetFile()->GetGrPixel(),GetFile()->GetNumPixel());
// For the Palette Color Lookup Table UID
Archive->Restore(0x0028,0x1203);
-
// group 0002 may be pushed out for ACR-NEMA writting purposes
Archive->Restore(0x0002,0x0000);
Archive->Restore(0x0002,0x0001);
Archive->Restore(0x0002,0x0016);
Archive->Restore(0x0002,0x0100);
Archive->Restore(0x0002,0x0102);
+
}
/**
std::string ts = Util::DicomString(
Global::GetTS()->GetSpecialTransferSyntax(TS::JPEGBaselineProcess1) );
- DataEntry *tss = CopyDataEntry(0x0002,0x0010);
+ DataEntry *tss = CopyDataEntry(0x0002,0x0010,"UI");
tss->SetString(ts);
Archive->Push(tss);
std::string ts = Util::DicomString(
Global::GetTS()->GetSpecialTransferSyntax(TS::ExplicitVRLittleEndian) );
- DataEntry *tss = CopyDataEntry(0x0002,0x0010);
+ DataEntry *tss = CopyDataEntry(0x0002,0x0010,"UI");
tss->SetString(ts);
Archive->Push(tss);
tss->Delete();
std::string ts = Util::DicomString(
Global::GetTS()->GetSpecialTransferSyntax(TS::ImplicitVRLittleEndian) );
- DataEntry *tss = CopyDataEntry(0x0002,0x0010);
+ DataEntry *tss = CopyDataEntry(0x0002,0x0010,"UI");
tss->SetString(ts);
Archive->Push(tss);
tss->Delete();
{
std::string rows, columns;
- DataEntry *newRow=DataEntry::New(oldRow->GetDictEntry());
- DataEntry *newCol=DataEntry::New(oldCol->GetDictEntry());
-
+ //DataEntry *newRow=DataEntry::New(oldRow->GetDictEntry());
+ //DataEntry *newCol=DataEntry::New(oldCol->GetDictEntry());
+
+ DataEntry *newRow=DataEntry::New(0x0028, 0x0010, "US");
+ DataEntry *newCol=DataEntry::New(0x0028, 0x0011, "US");
+
newRow->Copy(oldCol);
newCol->Copy(oldRow);
newCol->Delete();
}
- DataEntry *libidoCode = CopyDataEntry(0x0008,0x0010);
+ DataEntry *libidoCode = CopyDataEntry(0x0008,0x0010,"LO");
libidoCode->SetString("ACRNEMA_LIBIDO_1.1");
Archive->Push(libidoCode);
libidoCode->Delete();
{
if ( recCode->GetString() == "ACRNEMA_LIBIDO_1.1" )
{
- DataEntry *libidoCode = CopyDataEntry(0x0008,0x0010);
+ DataEntry *libidoCode = CopyDataEntry(0x0008,0x0010,"LO");
libidoCode->SetString("");
Archive->Push(libidoCode);
libidoCode->Delete();
* @param group Group number of the Entry
* @param elem Element number of the Entry
* @param vr Value Representation of the Entry
- * FIXME : what is it used for?
* \return pointer to the new Bin Entry (NULL when creation failed).
*/
DataEntry *FileHelper::CopyDataEntry(uint16_t group, uint16_t elem,
- const TagName &vr)
+ const VRKey &vr)
{
DocEntry *oldE = FileInternal->GetDocEntry(group, elem);
DataEntry *newE;
if ( oldE )
{
- newE = DataEntry::New(oldE->GetDictEntry());
+ //newE = DataEntry::New(oldE->GetDictEntry());
+ newE = DataEntry::New(group, elem, vr);
newE->Copy(oldE);
}
else
// Create them if not found
// Always modify the value
// Push the entries to the archive.
- CopyMandatoryEntry(0x0002,0x0000,"0");
+ CopyMandatoryEntry(0x0002,0x0000,"0","UL");
DataEntry *e_0002_0001 = CopyDataEntry(0x0002,0x0001, "OB");
e_0002_0001->SetBinArea((uint8_t*)Util::GetFileMetaInformationVersion(),
if ( ContentType == FILTERED_IMAGE || ContentType == UNMODIFIED_PIXELS_IMAGE)
{
// we keep the original 'Media Storage SOP Class UID', we default it if missing
- CheckMandatoryEntry(0x0002,0x0002,"1.2.840.10008.5.1.4.1.1.7");
+ CheckMandatoryEntry(0x0002,0x0002,"1.2.840.10008.5.1.4.1.1.7","UI");
}
else
{
// It's *not* an image comming straight from a source. We force
// 'Media Storage SOP Class UID' --> [Secondary Capture Image Storage]
- CopyMandatoryEntry(0x0002,0x0002,"1.2.840.10008.5.1.4.1.1.7");
+ CopyMandatoryEntry(0x0002,0x0002,"1.2.840.10008.5.1.4.1.1.7","UI");
}
// 'Media Storage SOP Instance UID'
- CopyMandatoryEntry(0x0002,0x0003,sop);
+ CopyMandatoryEntry(0x0002,0x0003,sop,"UI");
// 'Implementation Class UID'
// FIXME : in all examples we have, 0x0002,0x0012 is not so long :
// seems to be Root UID + 4 digits (?)
- CopyMandatoryEntry(0x0002,0x0012,Util::CreateUniqueUID());
+ CopyMandatoryEntry(0x0002,0x0012,Util::CreateUniqueUID(),"UI");
// 'Implementation Version Name'
std::string version = "GDCM ";
version += Util::GetVersion();
- CopyMandatoryEntry(0x0002,0x0013,version);
+ CopyMandatoryEntry(0x0002,0x0013,version,"SH");
}
// --------------------- For DataSet ---------------------
+
+ if ( ContentType != USER_OWN_IMAGE) // when it's not a user made image
+ {
+
+ gdcmDebugMacro( "USER_OWN_IMAGE (1)");
+ // If 'SOP Class UID' exists ('true DICOM' image)
+ // we create the 'Source Image Sequence' SeqEntry
+ // to hold informations about the Source Image
+
+ DataEntry *e_0008_0016 = FileInternal->GetDataEntry(0x0008, 0x0016);
+ if ( e_0008_0016 )
+ {
+ // Create 'Source Image Sequence' SeqEntry
+// SeqEntry *sis = SeqEntry::New (
+// Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0008, 0x2112) );
+ SeqEntry *sis = SeqEntry::New (0x0008, 0x2112);
+ SQItem *sqi = SQItem::New(1);
+ // (we assume 'SOP Instance UID' exists too)
+ // create 'Referenced SOP Class UID'
+// DataEntry *e_0008_1150 = DataEntry::New(
+// Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0008, 0x1150) );
+ DataEntry *e_0008_1150 = DataEntry::New(0x0008, 0x1150, "UI");
+ e_0008_1150->SetString( e_0008_0016->GetString());
+ sqi->AddEntry(e_0008_1150);
+ e_0008_1150->Delete();
+
+ // create 'Referenced SOP Instance UID'
+ DataEntry *e_0008_0018 = FileInternal->GetDataEntry(0x0008, 0x0018);
+// DataEntry *e_0008_1155 = DataEntry::New(
+// Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0008, 0x1155) );
+ DataEntry *e_0008_1155 = DataEntry::New(0x0008, 0x1155, "UI");
+ e_0008_1155->SetString( e_0008_0018->GetString());
+ sqi->AddEntry(e_0008_1155);
+ e_0008_1155->Delete();
+
+ sis->AddSQItem(sqi,1);
+ sqi->Delete();
+
+ // temporarily replaces any previous 'Source Image Sequence'
+ Archive->Push(sis);
+ sis->Delete();
+
+ // FIXME : is 'Image Type' *really* depending on the presence of 'SOP Class UID'?
+ if ( ContentType == FILTERED_IMAGE)
+ // the user *knows* he just modified the pixels
+ // the image is no longer an 'Original' one
+ CopyMandatoryEntry(0x0008,0x0008,"DERIVED\\PRIMARY","CS");
+ }
+ }
if ( ContentType == FILTERED_IMAGE || ContentType == UNMODIFIED_PIXELS_IMAGE)
{
// we keep the original 'Media Storage SOP Class UID', we default it if missing (it should be present !)
- CheckMandatoryEntry(0x0008,0x0016,"1.2.840.10008.5.1.4.1.1.7");
+ CheckMandatoryEntry(0x0008,0x0016,"1.2.840.10008.5.1.4.1.1.7","UI");
}
else
{
// It's *not* an image comming straight from a source. We force
// 'Media Storage SOP Class UID' --> [Secondary Capture Image Storage]
- CopyMandatoryEntry(0x0008,0x0016,"1.2.840.10008.5.1.4.1.1.7");
+ CopyMandatoryEntry(0x0008,0x0016,"1.2.840.10008.5.1.4.1.1.7", "UI");
}
// Push out 'LibIDO-special' entries, if any
// - we're gonna write the image as Bits Stored = 16
if ( FileInternal->GetEntryString(0x0028,0x0100) == "12")
{
- CopyMandatoryEntry(0x0028,0x0100,"16");
+ CopyMandatoryEntry(0x0028,0x0100,"16","US");
}
// Check if user wasn't drunk ;-)
int nbBitsAllocated = FileInternal->GetBitsAllocated();
if ( nbBitsAllocated == 0 || nbBitsAllocated > 32)
{
- CopyMandatoryEntry(0x0028,0x0100,"16");
+ CopyMandatoryEntry(0x0028,0x0100,"16","US");
gdcmWarningMacro("(0028,0100) changed from "
<< nbBitsAllocated << " to 16 for consistency purpose");
nbBitsAllocated = 16;
{
s.str("");
s << nbBitsAllocated;
- CopyMandatoryEntry(0x0028,0x0101,s.str());
+ CopyMandatoryEntry(0x0028,0x0101,s.str(),"US");
gdcmWarningMacro("(0028,0101) changed from "
<< nbBitsStored << " to " << nbBitsAllocated
<< " for consistency purpose" );
{
s.str("");
s << nbBitsStored - 1;
- CopyMandatoryEntry(0x0028,0x0102,s.str());
+ CopyMandatoryEntry(0x0028,0x0102,s.str(),"US");
gdcmWarningMacro("(0028,0102) changed from "
<< highBitPosition << " to " << nbBitsAllocated-1
<< " for consistency purpose");
{
pixelSpacing = "1.0\\1.0";
// if missing, Pixel Spacing forced to "1.0\1.0"
- CopyMandatoryEntry(0x0028,0x0030,pixelSpacing);
+ CopyMandatoryEntry(0x0028,0x0030,pixelSpacing,"DS");
}
// 'Imager Pixel Spacing' : defaulted to 'Pixel Spacing'
if ( ContentType != USER_OWN_IMAGE)
// we write it only when we are *sure* the image comes from
// an imager (see also 0008,0x0064)
- CheckMandatoryEntry(0x0018,0x1164,pixelSpacing);
+ CheckMandatoryEntry(0x0018,0x1164,pixelSpacing,"DS");
// Samples Per Pixel (type 1) : default to grayscale
- CheckMandatoryEntry(0x0028,0x0002,"1");
+ CheckMandatoryEntry(0x0028,0x0002,"1","US");
// --- Check UID-related Entries ---
-
-
- if ( ContentType != USER_OWN_IMAGE) // when it's not a user made image
- {
- // If 'SOP Class UID' exists ('true DICOM' image)
- // we create the 'Source Image Sequence' SeqEntry
- // to hold informations about the Source Image
-
- DataEntry *e_0008_0016 = FileInternal->GetDataEntry(0x0008, 0x0016);
- if ( e_0008_0016 )
- {
- // Create 'Source Image Sequence' SeqEntry
- SeqEntry *sis = SeqEntry::New (
- Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0008, 0x2112) );
- SQItem *sqi = SQItem::New(1);
- // (we assume 'SOP Instance UID' exists too)
- // create 'Referenced SOP Class UID'
- DataEntry *e_0008_1150 = DataEntry::New(
- Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0008, 0x1150) );
- e_0008_1150->SetString( e_0008_0016->GetString());
- sqi->AddEntry(e_0008_1150);
- e_0008_1150->Delete();
-
- // create 'Referenced SOP Instance UID'
- DataEntry *e_0008_0018 = FileInternal->GetDataEntry(0x0008, 0x0018);
- DataEntry *e_0008_1155 = DataEntry::New(
- Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0008, 0x1155) );
- e_0008_1155->SetString( e_0008_0018->GetString());
- sqi->AddEntry(e_0008_1155);
- e_0008_1155->Delete();
-
- sis->AddSQItem(sqi,1);
- sqi->Delete();
-
- // temporarily replaces any previous 'Source Image Sequence'
- Archive->Push(sis);
- sis->Delete();
- // FIXME : is 'Image Type' *really* depending on the presence of 'SOP Class UID'?
- if ( ContentType == FILTERED_IMAGE)
- // the user *knows* he just modified the pixels
- // the image is no longer an 'Original' one
- CopyMandatoryEntry(0x0008,0x0008,"DERIVED\\PRIMARY");
- }
- }
-
// At the end, not to overwrite the original ones,
// needed by 'Referenced SOP Instance UID', 'Referenced SOP Class UID'
// 'SOP Instance UID'
- CopyMandatoryEntry(0x0008,0x0018,sop);
+ CopyMandatoryEntry(0x0008,0x0018,sop,"UI");
if ( ContentType == USER_OWN_IMAGE)
{
+ gdcmDebugMacro( "USER_OWN_IMAGE (2)");
// Conversion Type.
// Other possible values are :
// See PS 3.3, Page 408
// DRW = Drawing
// SYN = Synthetic Image
- CheckMandatoryEntry(0x0008,0x0064,"SYN"); // Why not?
+ CheckMandatoryEntry(0x0008,0x0064,"SYN","CS"); // Why not?
}
/*
if ( ContentType == CREATED_IMAGE)
// Instance Creation Date
const std::string &date = Util::GetCurrentDate();
- CopyMandatoryEntry(0x0008,0x0012,date);
+ CopyMandatoryEntry(0x0008,0x0012,date,"DA");
// Instance Creation Time
const std::string &time = Util::GetCurrentTime();
- CopyMandatoryEntry(0x0008,0x0013,time);
+ CopyMandatoryEntry(0x0008,0x0013,time,"TM");
// Study Date
- CheckMandatoryEntry(0x0008,0x0020,date);
+ CheckMandatoryEntry(0x0008,0x0020,date,"DA");
// Study Time
- CheckMandatoryEntry(0x0008,0x0030,time);
+ CheckMandatoryEntry(0x0008,0x0030,time,"TM");
// Accession Number
//CopyMandatoryEntry(0x0008,0x0050,"");
- CheckMandatoryEntry(0x0008,0x0050,"");
+ CheckMandatoryEntry(0x0008,0x0050,"","SH");
// ----- Add Mandatory Entries if missing ---
// keeping the same 'Study Instance UID' for various images
// The user may add images to a 'Manufacturer Study',
// adding new Series to an already existing Study
- CheckMandatoryEntry(0x0020,0x000d,Util::CreateUniqueUID());
+ CheckMandatoryEntry(0x0020,0x000d,Util::CreateUniqueUID(),"UI");
// 'Serie Instance UID'
// Keep the value if exists
// keeping the same 'Serie Instance UID' for various images
// The user shouldn't add any image to a 'Manufacturer Serie'
// but there is no way no to prevent him for doing that
- CheckMandatoryEntry(0x0020,0x000e,Util::CreateUniqueUID());
+ CheckMandatoryEntry(0x0020,0x000e,Util::CreateUniqueUID(),"UI");
// Study ID
- CheckMandatoryEntry(0x0020,0x0010,"");
+ CheckMandatoryEntry(0x0020,0x0010,"","SH");
// Series Number
- CheckMandatoryEntry(0x0020,0x0011,"");
+ CheckMandatoryEntry(0x0020,0x0011,"","IS");
// Instance Number
- CheckMandatoryEntry(0x0020,0x0013,"");
+ CheckMandatoryEntry(0x0020,0x0013,"","IS");
// Patient Orientation
// Can be computed from (0020|0037) : Image Orientation (Patient)
std::string ori = o->GetOrientation ( FileInternal );
o->Delete();
if (ori != "\\" && ori != GDCM_UNFOUND)
- CheckMandatoryEntry(0x0020,0x0020,ori);
+ CheckMandatoryEntry(0x0020,0x0020,ori,"CS");
else
- CheckMandatoryEntry(0x0020,0x0020,"");
+ CheckMandatoryEntry(0x0020,0x0020,"","CS");
// Default Patient Position to HFS
- CheckMandatoryEntry(0x0018,0x5100,"HFS");
+ CheckMandatoryEntry(0x0018,0x5100,"HFS","CS");
// Modality : if missing we set it to 'OTher'
- CheckMandatoryEntry(0x0008,0x0060,"OT");
+ CheckMandatoryEntry(0x0008,0x0060,"OT","CS");
// Manufacturer : if missing we set it to 'GDCM Factory'
- CheckMandatoryEntry(0x0008,0x0070,"GDCM Factory");
+ CheckMandatoryEntry(0x0008,0x0070,"GDCM Factory","LO");
// Institution Name : if missing we set it to 'GDCM Hospital'
- CheckMandatoryEntry(0x0008,0x0080,"GDCM Hospital");
+ CheckMandatoryEntry(0x0008,0x0080,"GDCM Hospital","LO");
// Patient's Name : if missing, we set it to 'GDCM^Patient'
- CheckMandatoryEntry(0x0010,0x0010,"GDCM^Patient");
+ CheckMandatoryEntry(0x0010,0x0010,"GDCM^Patient","PN");
// Patient ID
- CheckMandatoryEntry(0x0010,0x0020,"");
+ CheckMandatoryEntry(0x0010,0x0020,"","LO");
// Patient's Birth Date : 'type 2' entry -> must exist, value not mandatory
- CheckMandatoryEntry(0x0010,0x0030,"");
+ CheckMandatoryEntry(0x0010,0x0030,"","DA");
// Patient's Sex :'type 2' entry -> must exist, value not mandatory
- CheckMandatoryEntry(0x0010,0x0040,"");
+ CheckMandatoryEntry(0x0010,0x0040,"","CS");
// Referring Physician's Name :'type 2' entry -> must exist, value not mandatory
- CheckMandatoryEntry(0x0008,0x0090,"");
+ CheckMandatoryEntry(0x0008,0x0090,"","PN");
/*
// Deal with element 0x0000 (group length) of each group.
}
-void FileHelper::CheckMandatoryEntry(uint16_t group,uint16_t elem,std::string value)
+void FileHelper::CheckMandatoryEntry(uint16_t group,uint16_t elem,std::string value,const VRKey &vr )
{
DataEntry *entry = FileInternal->GetDataEntry(group,elem);
if ( !entry )
{
- entry = DataEntry::New(Global::GetDicts()->GetDefaultPubDict()->GetEntry(group,elem));
+ //entry = DataEntry::New(Global::GetDicts()->GetDefaultPubDict()->GetEntry(group,elem));
+ entry = DataEntry::New(group,elem,vr);
entry->SetString(value);
Archive->Push(entry);
entry->Delete();
- }
+ }
}
-void FileHelper::SetMandatoryEntry(uint16_t group,uint16_t elem,std::string value)
+/// \todo : what is it used for ? (FileHelper::SetMandatoryEntry)
+void FileHelper::SetMandatoryEntry(uint16_t group,uint16_t elem,std::string value,const VRKey &vr)
{
- DataEntry *entry = DataEntry::New(Global::GetDicts()->GetDefaultPubDict()->GetEntry(group,elem));
+ //DataEntry *entry = DataEntry::New(Global::GetDicts()->GetDefaultPubDict()->GetEntry(group,elem));
+ DataEntry *entry = DataEntry::New(group,elem,vr);
entry->SetString(value);
Archive->Push(entry);
entry->Delete();
}
-void FileHelper::CopyMandatoryEntry(uint16_t group,uint16_t elem,std::string value)
+void FileHelper::CopyMandatoryEntry(uint16_t group,uint16_t elem,std::string value,const VRKey &vr)
{
- DataEntry *entry = CopyDataEntry(group,elem);
+ DataEntry *entry = CopyDataEntry(group,elem,vr);
entry->SetString(value);
Archive->Push(entry);
entry->Delete();
Program: gdcm
Module: $RCSfile: gdcmFileHelper.h,v $
Language: C++
- Date: $Date: 2006/03/29 16:09:48 $
- Version: $Revision: 1.41 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.42 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmDebug.h"
#include "gdcmRefCounter.h"
+#include "gdcmVRKey.h"
#include "gdcmFile.h"
namespace gdcm
void RestoreWriteOfLibido();
DataEntry *CopyDataEntry(uint16_t group, uint16_t elem,
- const TagName &vr = GDCM_VRUNKNOWN);
+ const VRKey &vr = GDCM_VRUNKNOWN);
void CheckMandatoryElements();
- void CheckMandatoryEntry(uint16_t group, uint16_t elem, std::string value);
- void SetMandatoryEntry(uint16_t group, uint16_t elem, std::string value);
- void CopyMandatoryEntry(uint16_t group, uint16_t elem, std::string value);
+ void CheckMandatoryEntry(uint16_t group, uint16_t elem, std::string value,
+ const VRKey &vr = GDCM_VRUNKNOWN);
+ void SetMandatoryEntry(uint16_t group, uint16_t elem, std::string value,
+ const VRKey &vr = GDCM_VRUNKNOWN);
+ void CopyMandatoryEntry(uint16_t group, uint16_t elem, std::string value,
+ const VRKey &vr = GDCM_VRUNKNOWN);
void RestoreWriteMandatory();
private:
Program: gdcm
Module: $RCSfile: gdcmMacro.h,v $
Language: C++
- Date: $Date: 2005/11/28 15:20:34 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.4 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#define GDCMMACRO_H
//-----------------------------------------------------------------------------
-#define gdcmTypeMacro(type) \
- private : \
+#define gdcmTypeMacro(type) \
+ private : \
type(type &); /* Not implemented */ \
type &operator=(type &) /* Not implemented */
-#define gdcmNewMacro(type) \
- public : \
+#define gdcmNewMacro(type) \
+ public : \
static type *New() {return new type(); } /* Not implemented */
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmRefCounter.h,v $
Language: C++
- Date: $Date: 2005/11/28 15:20:34 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ 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
#define GDCMREFCOUNTER_H
#include "gdcmBase.h"
+//#include "gdcmDebug.h"
+#include <typeinfo>
namespace gdcm
{
/// \remarks It decrements the reference counting
void Unregister()
{
+//std::cout <<"================Unreg " << typeid(*this).name() << std::endl;
RefCount--;
if(RefCount<=0)
- delete this;
+ delete this;
}
/// \brief Get the reference counting
/// \return Reference count
Program: gdcm
Module: $RCSfile: gdcmSeqEntry.cxx,v $
Language: C++
- Date: $Date: 2006/02/16 20:06:15 $
- Version: $Revision: 1.65 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.66 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
namespace gdcm
{
//-----------------------------------------------------------------------------
+// Constructor / Destructor
+
// Constructor / Destructor
/**
* \brief Constructor from a given SeqEntry
*/
-SeqEntry::SeqEntry( DictEntry *e )
- : DocEntry(e)
+SeqEntry::SeqEntry( uint16_t group,uint16_t elem )
+ : DocEntry(group, elem, "SQ")
{
Length = 0;
ReadLength = 0xffffffff;
* @param depth depth level of the current Seq entry
*/
SeqEntry::SeqEntry( DocEntry *e, int depth )
- : DocEntry( e->GetDictEntry() )
+ //: DocEntry( e->GetDictEntry() )
+ : DocEntry( e->GetGroup(), e->GetElement(), e->GetVR() )
{
Length = 0;
ReadLength = 0xffffffff;
Program: gdcm
Module: $RCSfile: gdcmSeqEntry.h,v $
Language: C++
- Date: $Date: 2006/02/16 20:06:15 $
- Version: $Revision: 1.40 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ 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
public:
/// \brief Contructs a SeqEntry with a RefCounter from DictEntry
- static SeqEntry *New(DictEntry *e) {return new SeqEntry(e);}
+ //static SeqEntry *New(DictEntry *e) {return new SeqEntry(e);}
/// \brief Contructs a SeqEntry with a RefCounter from DocEntry
static SeqEntry *New(DocEntry *d, int depth) {return new SeqEntry(d,depth);}
-
+/// \brief Contructs a SeqEntry with a RefCounter from elementary values
+ static SeqEntry *New(uint16_t group,uint16_t elem, VRKey const &vr = GDCM_VRUNKNOWN)
+ {return new SeqEntry(group,elem);}
+
void Print(std::ostream &os = std::cout, std::string const &indent = "" );
void WriteContent(std::ofstream *fp, FileType filetype);
uint32_t ComputeFullLength();
protected:
private:
- SeqEntry( DictEntry *e);
+ //SeqEntry( DictEntry *e);
SeqEntry( DocEntry *d, int depth );
+ SeqEntry( uint16_t group, uint16_t elem );
~SeqEntry();
// Variables
Program: gdcm
Module: $RCSfile: gdcmSerieHelper.cxx,v $
Language: C++
- Date: $Date: 2006/03/30 17:19:24 $
- Version: $Revision: 1.50 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ Version: $Revision: 1.51 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmSerieHelper.h"
#include "gdcmDirList.h"
#include "gdcmFile.h"
-#include "gdcmDictEntry.h" // for TranslateToKey
+//#include "gdcmDictEntry.h" // for TranslateToKey : no more !
#include "gdcmDebug.h"
#include "gdcmUtil.h"
Program: gdcm
Module: $RCSfile: gdcmTagKey.h,v $
Language: C++
- Date: $Date: 2005/11/08 09:35:44 $
- Version: $Revision: 1.10 $
+ Date: $Date: 2006/04/11 16:03:26 $
+ 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 TagKey
{
public :
- TagKey(uint16_t gr, uint16_t elt) { tag[0] = gr;tag[1] = elt;}
+ TagKey(uint16_t group, uint16_t elem) { tag[0] = group;tag[1] = elem;}
TagKey() { tag[0] = tag[1] = 0x0000;}
friend std::ostream& operator<<(std::ostream& _os, const TagKey &_val);
sprintf(res,"%04x|%04x",tag[0],tag[1]);
return std::string(res);
}
-
+ ///\brief sets the Group Number for the TagKey
void SetGroup(uint16_t group) { tag[0] = group; }
uint16_t GetGroup() const { return tag[0]; }
- void SetElement(uint16_t elem) { tag[1] = elem; }
+ ///\brief sets the Element Number for the TagKey
+ void SetElement(uint16_t elem) { tag[1] = elem; }
uint16_t GetElement() const { return tag[1]; }
+ ///\brief sets the Group Number and Element Number for the TagKey
+ void SetGroupElem(uint16_t group, uint16_t elem)
+ { tag[0] = group;tag[1] = elem; }
+
TagKey &operator=(const TagKey &_val)
{
tag[0] = _val.tag[0];