Program: gdcm
Module: $RCSfile: gdcmDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/11/28 16:31:23 $
- Version: $Revision: 1.175 $
+ Date: $Date: 2005/11/30 11:41:35 $
+ Version: $Revision: 1.179 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
* \brief Constructor : creates an empty DicomDir
*/
DicomDir::DicomDir()
- :Document( )
{
Initialize(); // sets all private fields to NULL
ParseDir = false;
char buf[2048];
const char *cwd = getcwd(buf, 2048);
if( cwd )
- {
+ {
SetFileName( buf ); // will be converted into a string
- }
+ }
else
- {
+ {
gdcmErrorMacro( "Path was too long to fit on 2048 bytes" );
- }
+ }
}
NewMeta();
gdcmDebugMacro( "Parse directory and create the DicomDir : "
return true;
}
+/**
+ * \brief Copies all the attributes from an other DocEntrySet
+ * @param set entry to copy from
+ * @remarks The contained DocEntries are not copied, only referenced
+ */
+void DicomDir::Copy(DocEntrySet *set)
+{
+ // Remove all previous childs
+ ClearPatient();
+
+ Document::Copy(set);
+
+ DicomDir *dd = dynamic_cast<DicomDir *>(set);
+ if( dd )
+ {
+ if(MetaElems)
+ MetaElems->Unregister();
+ MetaElems = dd->MetaElems;
+ if(MetaElems)
+ MetaElems->Register();
+
+ Patients = dd->Patients;
+ for(ItPatient = Patients.begin();ItPatient != Patients.end();++ItPatient)
+ (*ItPatient)->Register();
+ }
+}
+
//-----------------------------------------------------------------------------
// Protected
/**
File *f;
DirListType fileList = dirList.GetFilenames();
-
+ unsigned int nbFile = fileList.size();
for( DirListType::iterator it = fileList.begin();
it != fileList.end();
++it )
{
- Progress = (float)(count+1)/(float)fileList.size();
+ Progress = (float)(count+1)/(float)nbFile;
CallProgressMethod();
if ( Abort )
{
}
}
-/**
- * \brief CallStartMethod
- */
-void DicomDir::CallStartMethod()
-{
- Progress = 0.0f;
- Abort = false;
- CommandManager::ExecuteCommand(this,CMD_STARTPROGRESS);
-}
-
-/**
- * \brief CallProgressMethod
- */
-void DicomDir::CallProgressMethod()
-{
- CommandManager::ExecuteCommand(this,CMD_PROGRESS);
-}
-
-/**
- * \brief CallEndMethod
- */
-void DicomDir::CallEndMethod()
-{
- Progress = 1.0f;
- CommandManager::ExecuteCommand(this,CMD_ENDPROGRESS);
-}
//-----------------------------------------------------------------------------
// Private
continue;
}
if ( si )
- si->MoveObject(tmpSI); // New code : Copies the List
+ si->Copy(tmpSI);
tmpSI=s->GetNextSQItem();
}
* @param dst destination SQItem
* @param src source SQItem
*/
-void DicomDir::MoveSQItem(DocEntrySet *dst,DocEntrySet *src)
+void DicomDir::MoveSQItem(DocEntrySet *dst, DocEntrySet *src)
{
DocEntry *entry;
-
+// todo : rewrite the whole stuff, without using RemoveEntry an AddEntry,
+// to save time
entry = src->GetFirstEntry();
while(entry)
{
+ dst->AddEntry(entry); // use it, *before* removing it!
src->RemoveEntry(entry);
- dst->AddEntry(entry);
// we destroyed -> the current iterator is not longer valid
entry = src->GetFirstEntry();
}