-gdcmDocEntry* gdcmDocument::GetDocEntryByNumber(guint16 group, guint16 element)
-{
- TagKey key = gdcmDictEntry::TranslateToKey(group, element);
- if ( ! tagHT.count(key))
- return NULL;
- return tagHT.find(key)->second;
-}
-
-/**
- * \brief Loads the element while preserving the current
- * underlying file position indicator as opposed to
- * to LoadDocEntry that modifies it.
- * @param entry Header Entry whose value shall be loaded.
- * @return
- */
-void gdcmDocument::LoadDocEntrySafe(gdcmDocEntry * entry) {
- long PositionOnEntry = ftell(fp);
- LoadDocEntry(entry);
- fseek(fp, PositionOnEntry, SEEK_SET);
-}
-
-
-/**
- * \brief Writes in a file (according to the requested format)
- * the group, the element, the value representation and the length
- * of a single gdcmDocEntry passed as argument.
- * @param tag pointer on the gdcmDocEntry to be written
- * @param _fp already open file pointer
- * @param type type of the File to be written
- */
-void gdcmDocument::WriteEntryTagVRLength(gdcmDocEntry *tag,
- FILE *_fp,
- FileType type)
-{
- guint16 group = tag->GetGroup();
- VRKey vr = tag->GetVR();
- guint16 el = tag->GetElement();
- guint32 lgr = tag->GetReadLength();
-
- if ( (group == 0xfffe) && (el == 0x0000) )
- // Fix in order to make some MR PHILIPS images e-film readable
- // see gdcmData/gdcm-MR-PHILIPS-16-Multi-Seq.dcm:
- // we just *always* ignore spurious fffe|0000 tag !
- return;
-
- fwrite ( &group,(size_t)2 ,(size_t)1 ,_fp); //group
- fwrite ( &el,(size_t)2 ,(size_t)1 ,_fp); //element
-
- if ( type == gdcmExplicitVR ) {
-
- // Special case of delimiters:
- if (group == 0xfffe) {
- // Delimiters have NO Value Representation and have NO length.
- // Hence we skip writing the VR and length and we pad by writing
- // 0xffffffff
-
- int ff=0xffffffff;
- fwrite (&ff,(size_t)4 ,(size_t)1 ,_fp);
- return;
- }
-
- guint16 z=0;
- guint16 shortLgr = lgr;
- if (vr == "unkn") { // Unknown was 'written'
- // deal with Little Endian
- fwrite ( &shortLgr,(size_t)2 ,(size_t)1 ,_fp);
- fwrite ( &z, (size_t)2 ,(size_t)1 ,_fp);
- } else {
- fwrite (vr.c_str(),(size_t)2 ,(size_t)1 ,_fp);
- if ( (vr == "OB") || (vr == "OW") || (vr == "SQ") )
- {
- fwrite ( &z, (size_t)2 ,(size_t)1 ,_fp);
- fwrite ( &lgr,(size_t)4 ,(size_t)1 ,_fp);
- } else {
- fwrite ( &shortLgr,(size_t)2 ,(size_t)1 ,_fp);
- }
- }
- }
- else // IMPLICIT VR
- {
- fwrite ( &lgr,(size_t)4 ,(size_t)1 ,_fp);
- }
-}
-
-/**
- * \brief Writes in a file (according to the requested format)
- * the value of a single gdcmDocEntry passed as argument.
- * @param tag Pointer on the gdcmDocEntry to be written
- * @param _fp Already open file pointer
- * @param type type of the File to be written
- */
-
-// \todo TODO : to be re -written recursively !
-void gdcmDocument::WriteEntryValue(gdcmDocEntry *tag, FILE *_fp,FileType type)