Commit 848b9e313983559afcf6a0e295e34676fb129c0b

Authored by tatiana
1 parent 9ab6e228

FIX: Import dicom from command line

Showing 1 changed file with 12 additions and 11 deletions   Show diff stats
invesalius/invesalius.py
@@ -64,8 +64,8 @@ def parse_comand_line(): @@ -64,8 +64,8 @@ def parse_comand_line():
64 parser.add_option("-i", "--import", action="store", dest="dicom_dir") 64 parser.add_option("-i", "--import", action="store", dest="dicom_dir")
65 65
66 options, args = parser.parse_args() 66 options, args = parser.parse_args()
67 - print "ARRRRRGHs", args  
68 - 67 + print "opt", options
  68 + print "arg", args
69 69
70 if options.debug: 70 if options.debug:
71 # The user passed the debug option? 71 # The user passed the debug option?
@@ -76,7 +76,7 @@ def parse_comand_line(): @@ -76,7 +76,7 @@ def parse_comand_line():
76 session = Session() 76 session = Session()
77 session.debug = 1 77 session.debug = 1
78 78
79 - elif options.dicom_dir: 79 + if options.dicom_dir:
80 # The user passed directory to me? 80 # The user passed directory to me?
81 import_dir = options.dicom_dir 81 import_dir = options.dicom_dir
82 ps.Publisher().sendMessage('Import directory', import_dir) 82 ps.Publisher().sendMessage('Import directory', import_dir)
@@ -85,14 +85,15 @@ def parse_comand_line(): @@ -85,14 +85,15 @@ def parse_comand_line():
85 # print "Hey, guy, you need to pass a inv3 file to me!" 85 # print "Hey, guy, you need to pass a inv3 file to me!"
86 86
87 # Check if there is a file path somewhere in what the user wrote 87 # Check if there is a file path somewhere in what the user wrote
88 - i = len(args)  
89 - while i:  
90 - i -= 1  
91 - file = args[i]  
92 - if os.path.isfile(file):  
93 - path = os.path.abspath(file)  
94 - ps.Publisher().sendMessage('Open project', path)  
95 - i = 0 88 + else:
  89 + i = len(args)
  90 + while i:
  91 + i -= 1
  92 + file = args[i]
  93 + if os.path.isfile(file):
  94 + path = os.path.abspath(file)
  95 + ps.Publisher().sendMessage('Open project', path)
  96 + i = 0
96 97
97 98
98 def print_events(data): 99 def print_events(data):