Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
//-----------------------------------------------------------------------------
// Print
/**
* \ingroup gdcmDocEntry
* \brief Prints the common part of gdcmValEntry, gdcmBinEntry, gdcmSeqEntry
//-----------------------------------------------------------------------------
// Print
/**
* \ingroup gdcmDocEntry
* \brief Prints the common part of gdcmValEntry, gdcmBinEntry, gdcmSeqEntry
* \brief Writes the common part of any gdcmValEntry, gdcmBinEntry, gdcmSeqEntry
*/
void gdcmDocEntry::Write(FILE *fp, FileType filetype) {
* \brief Writes the common part of any gdcmValEntry, gdcmBinEntry, gdcmSeqEntry
*/
void gdcmDocEntry::Write(FILE *fp, FileType filetype) {
-/**
- * \ingroup gdcmDocEntry
- * \brief Writes the common part of any gdcmValEntry, gdcmBinEntry, gdcmSeqEntry
- */
-void gdcmDocEntry::WriteCommonPart(FILE *fp, FileType filetype) {
-
- guint16 group = GetGroup();
- VRKey vr = GetVR();
- guint16 el = GetElement();
- guint32 lgr = GetReadLength();
+ uint32_t FFFF = 0xffffffff;
+ uint16_t group = GetGroup();
+ gdcmVRKey vr = GetVR();
+ uint16_t el = GetElement();
+ uint32_t lgr = GetReadLength();
if ( (group == 0xfffe) && (el == 0x0000) )
// Fix in order to make some MR PHILIPS images e-film readable
if ( (group == 0xfffe) && (el == 0x0000) )
// Fix in order to make some MR PHILIPS images e-film readable
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 == "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);
-
-// TODO : better we set SQ length to ffffffff
-// and write a Sequence Delimitor Item at the end of the Sequence!
- if ( (vr == "OB") || (vr == "OW") || (vr == "SQ") )
+
+ if ( (vr == "OB") || (vr == "OW") || (vr == "SQ") || (vr == "UN") )
{
fwrite ( &z, (size_t)2 ,(size_t)1 ,fp);
{
fwrite ( &z, (size_t)2 ,(size_t)1 ,fp);
- fwrite ( &lgr,(size_t)4 ,(size_t)1 ,fp);
+ if (vr == "SQ") {
+ // we set SQ length to ffffffff
+ // and we shall write a Sequence Delimitor Item
+ // at the end of the Sequence!
+ fwrite ( &FFFF,(size_t)4 ,(size_t)1 ,fp);
+ } else {
+ fwrite ( &lgr,(size_t)4 ,(size_t)1 ,fp);
+ }
} else {
fwrite ( &shortLgr,(size_t)2 ,(size_t)1 ,fp);
}
} else {
fwrite ( &shortLgr,(size_t)2 ,(size_t)1 ,fp);
}
- fwrite ( &lgr,(size_t)4 ,(size_t)1 ,fp);
+ if (vr == "SQ") {
+ fwrite ( &FFFF,(size_t)4 ,(size_t)1 ,fp);
+ } else {
+ fwrite ( &lgr,(size_t)4 ,(size_t)1 ,fp);
+ }