-
- gr = tag2->second->GetGroup();
- el = tag2->second->GetElement();
- lgr = tag2->second->GetLength();
- val = tag2->second->GetValue().c_str();
- vr = tag2->second->GetVR();
-
- // std::cout << "Tag "<< std::hex << gr << " " << el << std::endl;
-
- if ( type == ACR ) {
- if (gr < 0x0008) continue; // ignore pure DICOM V3 groups
- if (gr %2) continue; // ignore shadow groups
- if (vr == "SQ" ) continue; // ignore Sequences
- if (gr == 0xfffe ) continue; // ignore delimiters
- }
-
- fwrite ( &gr,(size_t)2 ,(size_t)1 ,_fp); //group
- fwrite ( &el,(size_t)2 ,(size_t)1 ,_fp); //element
-
- if ( (type == ExplicitVR) && (gr <= 0x0002) ) {
- // EXPLICIT VR
- guint16 z=0, shortLgr;
- 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 {
- shortLgr=lgr;
- fwrite ( &shortLgr,(size_t)2 ,(size_t)1 ,_fp);
- }
- } else { // IMPLICIT VR
- fwrite ( &lgr,(size_t)4 ,(size_t)1 ,_fp);
+ if ( type == gdcmACR ){
+ if ((*tag2->second).GetGroup() < 0x0008) continue; // ignore pure DICOM V3 groups
+ if ((*tag2->second).GetElement() %2) continue; // ignore shadow groups
+ if ((*tag2->second).GetVR() == "SQ" ) continue; // ignore Sequences
+ if ((*tag2->second).GetSQDepthLevel() != 0) continue; // Not only ignore the SQ element