- Header *header = new Header( filename );
- CoherentGdcmFileList.push_back( header );
-}
-
-/**
- * \brief add a File to the list
- * @param file Header to add
- */
-void SerieHeader::AddGdcmFile(Header *file)
-{
- CoherentGdcmFileList.push_back( file );
+ //directly use string and not const char*:
+ Header *header = new Header( filename );
+ if( header->IsReadable() )
+ {
+ // 0020 000e UI REL Series Instance UID
+ std::string uid = header->GetEntry (0x0020, 0x000e);
+ // if uid == GDCM_UNFOUND then consistenly we should find GDCM_UNFOUND
+ // no need here to do anything special
+ if( CurrentSerieUID == "" )
+ {
+ // Set the current one
+ CurrentSerieUID = uid;
+ }
+ if( CurrentSerieUID == uid )
+ {
+ // Current Serie UID and DICOM header seems to match add the file:
+ CoherentGdcmFileList.push_back( header );
+ }
+ else
+ {
+ gdcmVerboseMacro("Wrong Serie Instance UID should be:" << CurrentSerieUID );
+ }
+ }
+ else
+ {
+ gdcmVerboseMacro("Could not read file: " << filename );
+ delete header;
+ }