GDCM  2.4.5
SortImage.py
1 ############################################################################
2 #
3 # Program: GDCM (Grassroots DICOM). A DICOM library
4 #
5 # Copyright (c) 2006-2011 Mathieu Malaterre
6 # All rights reserved.
7 # See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8 #
9 # This software is distributed WITHOUT ANY WARRANTY; without even
10 # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 # PURPOSE. See the above copyright notice for more information.
12 #
13 ############################################################################
14 
15 """
16 Usage:
17 
18  python SortImage.py dirname
19 """
20 
21 import gdcm
22 import sys
23 
24 def PrintProgress(object, event):
25  assert event == "ProgressEvent"
26  print "Progress:", object.GetProgress()
27 
28 def MySort(ds1, ds2):
29  # compare ds1
30  return False
31 
32 if __name__ == "__main__":
33 
34  dirname = sys.argv[1]
35  d = gdcm.Directory()
36  d.Load( dirname )
37 
38  print d
39 
40  sorter = gdcm.Sorter()
41  sorter.SetSortFunction( MySort )
42  #sorter.AddObserver( "ProgressEvent", PrintProgress )
43  sorter.Sort( d.GetFilenames() )
44 
45  print "Sorter:"
46  print sorter

Generated on Fri Sep 25 2015 17:58:21 for GDCM by doxygen 1.8.9.1
SourceForge.net Logo