Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2004/11/10 18:27:23 $
- Version: $Revision: 1.121 $
+ Date: $Date: 2004/11/12 21:33:46 $
+ Version: $Revision: 1.122 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
+/**
+ * \brief Handle broken private tag from Philips NTSCAN
+ * where the endianess is being switch to BigEndian for no
+ * apparent reason
+ * @return no return
+ */
+void Document::HandleBrokenEndian(uint16_t group, uint16_t elem)
+{
+ // Endian reversion. Some files contain groups of tags with reversed endianess.
+ static int reversedEndian = 0;
+ // try to fix endian switching in the middle of headers
+ if ((group == 0xfeff) && (elem == 0x00e0))
+ {
+ // start endian swap mark for group found
+ reversedEndian++;
+ SwitchSwapToBigEndian();
+ // fix the tag
+ group = 0xfffe;
+ elem = 0xe000;
+ }
+ else if ((group == 0xfffe) && (elem == 0xe00d) && reversedEndian)
+ {
+ // end of reversed endian group
+ reversedEndian--;
+ SwitchSwapToBigEndian();
+ }
+
+}
+
/**
* \brief Read the next tag but WITHOUT loading it's value
* (read the 'Group Number', the 'Element Number',
return 0;
}
+ HandleBrokenEndian(group, elem);
DocEntry *newEntry = NewDocEntryByNumber(group, elem);
FindDocEntryVR(newEntry);
Program: gdcm
Module: $RCSfile: gdcmDocument.h,v $
Language: C++
- Date: $Date: 2004/10/28 03:10:57 $
- Version: $Revision: 1.56 $
+ Date: $Date: 2004/11/12 21:33:46 $
+ Version: $Revision: 1.57 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
void BuildFlatHashTableRecurse( TagDocEntryHT& builtHT,
DocEntrySet* set );
+ void HandleBrokenEndian(uint16_t group, uint16_t elem);
public:
// Accessors:
/// Accessor to \ref PrintLevel