GDCM: SortImage.py

GDCM 3.0.25

SortImage.py
1
14
15"""
16Usage:
17
18 python SortImage.py dirname
19"""
20
21import gdcm
22import sys
23
24def PrintProgress(object, event):
25 assert event == "ProgressEvent"
26 print "Progress:", object.GetProgress()
27
28def MySort(ds1, ds2):
29 # compare ds1
30 return False
31
32if __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