Program: gdcm
Module: $RCSfile: gdcmDicomDir.cxx,v $
Language: C++
- Date: $Date: 2004/12/04 08:57:20 $
- Version: $Revision: 1.86 $
+ Date: $Date: 2005/01/06 20:03:26 $
+ Version: $Revision: 1.92 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
* - false if user passed an already built DICOMDIR file
* and wants to use it
*/
-DicomDir::DicomDir(std::string const & fileName, bool parseDir ):
+DicomDir::DicomDir(std::string const &fileName, bool parseDir ):
Document( fileName )
{
// Whatever user passed (a root directory or a DICOMDIR)
cc != Patients.end();
++cc)
{
- (*cc)->SetPrintLevel( PrintLevel );
- (*cc)->Print( os );
+ (*cc)->SetPrintLevel(PrintLevel);
+ (*cc)->Print(os);
}
}
* @param argDelete Argument
* \warning In python : the arg parameter isn't considered
*/
-void DicomDir::SetStartMethod( DicomDir::Method* method, void* arg,
- DicomDir::Method* argDelete )
+void DicomDir::SetStartMethod( DicomDir::Method *method, void *arg,
+ DicomDir::Method *argDelete )
{
if( StartArg && StartMethodArgDelete )
{
* class is destroyed
* @param method Method to call to delete the argument
*/
-void DicomDir::SetStartMethodArgDelete( DicomDir::Method* method )
+void DicomDir::SetStartMethodArgDelete( DicomDir::Method *method )
{
StartMethodArgDelete = method;
}
* @param argDelete Argument
* \warning In python : the arg parameter isn't considered
*/
-void DicomDir::SetProgressMethod( DicomDir::Method* method, void* arg,
- DicomDir::Method* argDelete )
+void DicomDir::SetProgressMethod( DicomDir::Method *method, void *arg,
+ DicomDir::Method *argDelete )
{
if( ProgressArg && ProgressMethodArgDelete )
{
* class is destroyed
* @param method Method to call to delete the argument
*/
-void DicomDir::SetProgressMethodArgDelete( DicomDir::Method* method )
+void DicomDir::SetProgressMethodArgDelete( DicomDir::Method *method )
{
ProgressMethodArgDelete = method;
}
* @param argDelete Argument
* \warning In python : the arg parameter isn't considered
*/
-void DicomDir::SetEndMethod( DicomDir::Method* method, void* arg,
- DicomDir::Method* argDelete )
+void DicomDir::SetEndMethod( DicomDir::Method *method, void *arg,
+ DicomDir::Method *argDelete )
{
if( EndArg && EndMethodArgDelete )
{
* the class is destroyed
* @param method Method to call to delete the argument
*/
-void DicomDir::SetEndMethodArgDelete( DicomDir::Method* method )
+void DicomDir::SetEndMethodArgDelete( DicomDir::Method *method )
{
EndMethodArgDelete = method;
}
* @return false only when fail to open
*/
-bool DicomDir::WriteDicomDir(std::string const& fileName)
+bool DicomDir::WriteDicomDir(std::string const &fileName)
{
int i;
uint16_t sq[4] = { 0x0004, 0x1220, 0xffff, 0xffff };
uint16_t sqt[4]= { 0xfffe, 0xe0dd, 0xffff, 0xffff };
- std::ofstream* fp = new std::ofstream(fileName.c_str(),
+ std::ofstream *fp = new std::ofstream(fileName.c_str(),
std::ios::out | std::ios::binary);
if( !fp )
{
break;
}
-std::cerr<<"File : "<<it->c_str()<<std::endl;
header = new Header( it->c_str() );
if( !header )
{
cc != lastOneButSequence;
++cc)
{
- m->AddDocEntry( cc->second );
+ m->AddEntry( cc->second );
}
}
else // after root directory parsing
{
- ListDicomDirMetaElem const & elemList =
+ ListDicomDirMetaElem const &elemList =
Global::GetDicomDirElements()->GetDicomDirMetaElements();
m->FillObject(elemList);
}
/**
* \brief adds a new Patient (with the basic elements) to a partially created DICOMDIR
*/
-DicomDirPatient * DicomDir::NewPatient()
+DicomDirPatient *DicomDir::NewPatient()
{
ListDicomDirPatientElem::const_iterator it;
uint16_t tmpGr,tmpEl;
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() );
- }
- p->AddDocEntry( entry );
+ p->AddEntry( entry );
}
Patients.push_front( p );
* GDCM_DICOMDIR_STUDY, GDCM_DICOMDIR_SERIE ...)
* @param header Header of the current file
*/
-void DicomDir::SetElement(std::string const & path, DicomDirType type,
+void DicomDir::SetElement(std::string const &path, DicomDirType type,
Document *header)
{
ListDicomDirElem elemList; //FIXME this is going to be a by copy operation
entry = new ValEntry( dictEntry ); // Be sure it's never a BinEntry !
entry->SetOffset(0); // just to avoid further missprinting
- entry->SetLength(0); // just to avoid further missprinting
if( header )
{
val = it->Value;
}
- // GDCM_UNFOUND or not !
-
entry->SetValue( val ); // troubles expected when vr=SQ ...
- if( dictEntry )
- {
- if( dictEntry->GetGroup() == 0xfffe )
- {
- entry->SetLength( entry->GetValue().length() ); // FIXME
- }
- 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() );
- }
- }
-
if ( type == GDCM_DICOMDIR_META ) // fusible : should never print !
{
std::cout << "GDCM_DICOMDIR_META ?!? should never print that"
return;
}
- SeqEntry* s = dynamic_cast<SeqEntry*>(e);
+ SeqEntry *s = dynamic_cast<SeqEntry *>(e);
if ( !s )
{
dbg.Verbose(0, "DicomDir::CreateDicomDir: no SeqEntry present");
ListSQItem listItems = s->GetSQItems();
- DocEntry * d;
+ DocEntry *d;
std::string v;
- SQItem * si;
+ SQItem *si;
for( ListSQItem::iterator i = listItems.begin();
i !=listItems.end(); ++i )
{
d = (*i)->GetDocEntryByNumber(0x0004, 0x1430); // Directory Record Type
- if ( ValEntry* valEntry = dynamic_cast< ValEntry* >(d) )
+ if ( ValEntry* valEntry = dynamic_cast<ValEntry *>(d) )
{
v = valEntry->GetValue();
}
/**
* \ingroup DicomDir
* \brief AddDicomDirPatientToEnd
- * @param s SQ Item to enqueue to the DicomPatient chained List
+ * @param dd SQ Item to enqueue to the DicomPatient chained List
*/
bool DicomDir::AddDicomDirPatientToEnd(DicomDirPatient *dd)
{
/**
* \ingroup DicomDir
* \brief AddDicomDirStudyToEnd
- * @param s SQ Item to enqueue to the DicomDirStudy chained List
+ * @param dd SQ Item to enqueue to the DicomDirStudy chained List
*/
bool DicomDir::AddDicomDirStudyToEnd(DicomDirStudy *dd)
{
/**
* \ingroup DicomDir
* \brief AddDicomDirSerieToEnd
- * @param s SQ Item to enqueue to the DicomDirSerie chained List
+ * @param dd SQ Item to enqueue to the DicomDirSerie chained List
*/
bool DicomDir::AddDicomDirSerieToEnd(DicomDirSerie *dd)
{
/**
* \ingroup DicomDir
* \brief AddDicomDirImageToEnd
- * @param s SQ Item to enqueue to the DicomDirImage chained List
+ * @param dd SQ Item to enqueue to the DicomDirImage chained List
*/
bool DicomDir::AddDicomDirImageToEnd(DicomDirImage *dd)
{
* Only DocEntry's are moved
*
*/
-void DicomDir::MoveSQItem(SQItem* dst,SQItem *src)
+void DicomDir::MoveSQItem(SQItem *dst,SQItem *src)
{
DocEntry *entry;