GDCM 3.2.1

SortImage.py
1
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
gdcm::Directory
Class for manipulation directories.
Definition gdcmDirectory.h:43
gdcm::Sorter
Sorter.
Definition gdcmSorter.h:40