[Insight-users] GDCMSeriesFileNames with growing SeriesUIDs when
rescanning the same directory
Thomas Lambertz
thomas at hexerei-software.de
Thu Feb 22 20:52:17 EST 2007
Hello,
after spending too much time on debugging i need your help in the
correct use of GDCMSeriesFileNames.
I am sure this belongs to a misunderstanding of the concept of GDCM by
myself - so hopefully someone is so kind to enlight me. I used the
following two methods to get the SeriesUIDs from the files within a
given directory.
int cGDCMInfo::SetDir(std::string *Directory)
{
try {
FileNames->SetUseSeriesDetails( true );
FileNames->AddSeriesRestriction("0008|0021");
FileNames->SetDirectory( Directory->c_str() );
}
catch( itk::ExceptionObject & excep )
{
std::string message = excep.GetDescription();
DebugCallback(message);
return ERROR;
}
return OK;
}
int cGDCMInfo::GetSeriesUIDs(SeriesUIDContainer *SeriesUIDs)
{
try {
SeriesUIDs->clear();
*SeriesUIDs = FileNames->GetSeriesUIDs();
// for debug only
for(int i=0;i<SeriesUIDs->size();i++) {
DebugCallback(SeriesUIDs->at(i));
}
}
catch( itk::ExceptionObject & excep )
{
std::cout << excep;
return ERROR;
}
return OK;
}
This seemes to work - until i allow the user to reselect the same
directory for a second run.
sample SeriesUIDs from within a loop over the same directory:
1.3.12.2.1107.5.8.2.485257.837553.68678254.200601060732283653512512200601065351251220060106
1.3.12.2.1107.5.8.2.485257.837553.68678254.2006010607322836535125122006010653512512200601065351251220060106
1.3.12.2.1107.5.8.2.485257.837553.68678254.20060106073228365351251220060106535125122006010653512512200601065351251220060106
1.3.12.2.1107.5.8.2.485257.837553.68678254.200601060732283653512512200601065351251220060106535125122006010653512512200601065351251220060106
for(int i=0;i<4;i++) {
DirInfo->SetDir(&plandir);
DirInfo->GetSeriesUIDs(&UID);
}
Obviously there is allways the same block inserted each time i rescan
the directory. Why is it so - and how can i prevent this behaviour ?
This only happens when i re-used SetDir(). What i expected was that with
each run i get the same UIDs. Is this a wrong assumption ?
I used the seriesUID internally to remember which series is to load next
time. But when the SeriesUIDs changes there are consequently no files
that belong to the then older SeriesUID - and the import failed.
Your help is very appreciated !
Thanks in advance,
Tom
More information about the Insight-users
mailing list