Program: gdcm
Module: $RCSfile: MakeDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/07/26 02:25:25 $
- Version: $Revision: 1.11 $
+ Date: $Date: 2005/08/29 12:29:47 $
+ Version: $Revision: 1.12 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
dcmdir = new gdcm::DicomDir( );
- dcmdir->SetStartMethod(StartMethod, (void *) NULL);
+ dcmdir->SetStartMethod(StartMethod);
dcmdir->SetEndMethod(EndMethod);
dcmdir->SetLoadMode(loadMode);
Program: gdcm
Module: $RCSfile: TestMakeDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/07/21 04:51:26 $
- Version: $Revision: 1.5 $
+ Date: $Date: 2005/08/29 12:29:48 $
+ Version: $Revision: 1.6 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
dcmdir->SetDirectoryName(dirName);
dcmdir->Load( );
- dcmdir->SetStartMethod(StartMethod, (void *) NULL);
+ dcmdir->SetStartMethod(StartMethod);
dcmdir->SetEndMethod(EndMethod);
if ( !dcmdir->GetFirstPatient() )
print ""
print ""
+### Progress methods
+def startMethod():
+ print "Start"
+def progressMethod():
+ print "Progress",dicomdir.GetProgress()
+def endMethod():
+ print "End"
+
### Get filename from command line or default it
try:
fileName = sys.argv[1]
### Build the DicomDir element list
dicomdir = gdcm.DicomDir()
+
+dicomdir.SetStartMethod(startMethod)
+dicomdir.SetProgressMethod(progressMethod)
+dicomdir.SetEndMethod(endMethod)
+
dicomdir.SetFileName(fileName)
dicomdir.Load()
if not dicomdir.IsReadable():
study=patient.GetNextStudy()
patient=dicomdir.GetNextPatient()
+dicomdir.SetDirectoryName(os.path.dirname(fileName))
+dicomdir.Load()
+if not dicomdir.IsReadable():
+ PrintUse()
+ raise RuntimeError,"The '%s' DicomDir is not readable with gdcm." % fileName
+
+print "DICOMDIR -->",fileName
+print "##############################################################"
+print "## Display all the elements and their respective values"
+print "## found in the ", fileName, " file."
+print "##############################################################"
+dicomdir.SetPrintLevel(-1)
+dicomdir.Print()
+
// Note: Uses gdcmPythonVoidFunc and gdcmPythonVoidFuncArgDelete defined
// in the Swig verbatim section of this gdcm.i i.e. in the above section
// enclosed within the %{ ... %} scope operator ).
-%typemap(python, in) ( gdcm::DicomDir::Method *,
- void * = NULL,
- gdcm::DicomDir::Method * = NULL )
+%typemap(python, in) (void(*method)(void *),void *arg,void(*argDelete)(void *))
{
if($input!=Py_None)
{
%ignore gdcm::binary_write(std::ostream &,uint32_t const &);
%ignore gdcm::binary_write(std::ostream &,uint16_t const &);
-//%ignore gdcm::File::File();
-//%ignore gdcm::DicomDir::DicomDir();
+%ignore gdcm::DicomDir::SetStartMethod(DicomDir::Method *method,void *arg = NULL);
+%ignore gdcm::DicomDir::SetProgressMethod(DicomDir::Method *method,void *arg = NULL);
+%ignore gdcm::DicomDir::SetEndMethod(DicomDir::Method *method,void *arg = NULL);
// Ignore all placed in gdcmCommon.h
%ignore GDCM_UNKNOWN;
Program: gdcm
Module: $RCSfile: gdcmDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/08/29 09:41:22 $
- Version: $Revision: 1.154 $
+ Date: $Date: 2005/08/29 12:29:50 $
+ Version: $Revision: 1.155 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
DicomDir::~DicomDir()
{
- SetStartMethod(NULL);
- SetProgressMethod(NULL);
- SetEndMethod(NULL);
+ SetStartMethod(NULL,NULL,NULL);
+ SetProgressMethod(NULL,NULL,NULL);
+ SetEndMethod(NULL,NULL,NULL);
ClearPatient();
if ( MetaElems )
CreateDicomDir();
}
+void DicomDir::SetStartMethod( DicomDir::Method *method, void *arg )
+{
+ SetStartMethod(method,arg,NULL);
+}
+
+void DicomDir::SetProgressMethod( DicomDir::Method *method, void *arg )
+{
+ SetProgressMethod(method,arg,NULL);
+}
+
+void DicomDir::SetEndMethod( DicomDir::Method *method, void *arg )
+{
+ SetEndMethod(method,arg,NULL);
+}
+
/**
* \brief Set the start method to call when the parsing of the
* directory starts.
break;
}
- f = new File( );
- f->SetLoadMode(LoadMode); // we allow user not to load Sequences, or Shadow
- // groups, or ......
- f->SetFileName( it->c_str() );
+ f = new File( );
+ f->SetLoadMode(LoadMode); // we allow user not to load Sequences, or Shadow
+ // groups, or ......
+ f->SetFileName( it->c_str() );
/*int res = */f->Load( );
// if ( !f )
Program: gdcm
Module: $RCSfile: gdcmDicomDir.h,v $
Language: C++
- Date: $Date: 2005/07/21 05:02:11 $
- Version: $Revision: 1.66 $
+ Date: $Date: 2005/08/29 12:29:50 $
+ Version: $Revision: 1.67 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// following method declarations. Refer to gdcmPython/gdcm.i
// for the reasons of this unnecessary notation at C++ level.
void SetStartMethod( DicomDir::Method *method,
- void *arg = NULL,
- DicomDir::Method *argDelete = NULL );
- void SetProgressMethod( DicomDir::Method *method,
- void *arg = NULL,
- DicomDir::Method *argDelete = NULL );
+ void *arg = NULL );
+ void SetProgressMethod( DicomDir::Method *method,
+ void *arg = NULL );
void SetEndMethod( DicomDir::Method *method,
- void *arg = NULL,
- DicomDir::Method *argDelete = NULL );
- void SetStartMethodArgDelete ( DicomDir::Method *m );
- void SetProgressMethodArgDelete( DicomDir::Method *m );
- void SetEndMethodArgDelete ( DicomDir::Method *m );
+ void *arg = NULL );
+ // Note: replace DicomDir::Method *method to void(*method)(void *) to
+ // avoid wrapping problems with the typemap conversions
+ void SetStartMethod( void(*method)(void *), // DicomDir::Method *method
+ void *arg,
+ void(*argDelete)(void *));
+ void SetProgressMethod( void(*method)(void *), // DicomDir::Method *method
+ void *arg,
+ void(*argDelete)(void *));
+ void SetEndMethod( void(*method)(void *), // DicomDir::Method *method
+ void *arg,
+ void(*argDelete)(void *));
+ void SetStartMethodArgDelete ( DicomDir::Method *method );
+ void SetProgressMethodArgDelete( DicomDir::Method *method );
+ void SetEndMethodArgDelete ( DicomDir::Method *method );
/// GetProgress GetProgress
float GetProgress() { return Progress; }