- std::list<gdcmElement>::iterator it;
- uint16_t tmpGr,tmpEl;
- gdcmDictEntry *dictEntry;
- gdcmValEntry *entry;
-
- std::list<gdcmElement> elemList;
- elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirPatientElements();
- gdcmSQItem *s = new gdcmSQItem(0);
-
- // for all the DicomDirPatient Elements
- for( it = elemList.begin(); it != elemList.end(); ++it )
- {
- tmpGr = it->group;
- tmpEl = it->elem;
- dictEntry = GetPubDict()->GetDictEntryByNumber(tmpGr, tmpEl);
- entry = new gdcmValEntry( dictEntry );
- entry->SetOffset(0); // just to avoid further missprinting
- entry->SetValue( it->value );
-
- // dealing with value length ...
-
- if( dictEntry->GetGroup() == 0xfffe)
- {
- entry->SetLength(entry->GetValue().length());
- }
- else if( dictEntry->GetVR() == "UL" || dictEntry->GetVR() == "SL" )
- {
- entry->SetLength( 4 );
- }
- else if( dictEntry->GetVR() == "US" || dictEntry->GetVR() == "SS" )
- {
- entry->SetLength(2);
- }
- else if( dictEntry->GetVR() == "SQ" )
- {
- entry->SetLength( 0xffffffff );
- }
- else
- {
- entry->SetLength( entry->GetValue().length() );
- }
- s->AddDocEntry( entry );
- }
-
- gdcmDicomDirPatient *p = new gdcmDicomDirPatient(s, &TagHT);
- patients.push_front( p );
-
- return p;