Commit 9647607e526434f638a76c1b5f11992017479510
1 parent
7eed215f
Exists in
xmartlabs-command-line
and in
1 other branch
Create option in app.py to import and then save the project
Showing
4 changed files
with
47 additions
and
0 deletions
Show diff stats
@@ -0,0 +1,27 @@ | @@ -0,0 +1,27 @@ | ||
1 | +FROM ubuntu:16.04 | ||
2 | + | ||
3 | +RUN apt-get update | ||
4 | +RUN apt-get install -y \ | ||
5 | + cython \ | ||
6 | + python-concurrent.futures \ | ||
7 | + python-gdcm \ | ||
8 | + python-matplotlib \ | ||
9 | + python-nibabel \ | ||
10 | + python-numpy \ | ||
11 | + python-pil \ | ||
12 | + python-psutil \ | ||
13 | + python-scipy \ | ||
14 | + python-serial \ | ||
15 | + python-skimage \ | ||
16 | + python-vtk6 \ | ||
17 | + python-vtkgdcm \ | ||
18 | + python-wxgtk3.0 \ | ||
19 | + xvfb # For a virtual X server. | ||
20 | + | ||
21 | +WORKDIR /usr/local/app | ||
22 | + | ||
23 | +COPY . . | ||
24 | + | ||
25 | +RUN python setup.py build_ext --inplace | ||
26 | + | ||
27 | +RUN Xvfb :10 -ac -screen 0 1024x768x24 & |
app.py
@@ -245,6 +245,12 @@ def parse_comand_line(): | @@ -245,6 +245,12 @@ def parse_comand_line(): | ||
245 | parser.add_option("-i", "--import", | 245 | parser.add_option("-i", "--import", |
246 | action="store", | 246 | action="store", |
247 | dest="dicom_dir") | 247 | dest="dicom_dir") |
248 | + | ||
249 | + parser.add_option("-s", "--save", | ||
250 | + action="store", | ||
251 | + dest="save", | ||
252 | + help="To save the project after an import.") | ||
253 | + | ||
248 | options, args = parser.parse_args() | 254 | options, args = parser.parse_args() |
249 | 255 | ||
250 | # If debug argument... | 256 | # If debug argument... |
@@ -256,6 +262,11 @@ def parse_comand_line(): | @@ -256,6 +262,11 @@ def parse_comand_line(): | ||
256 | if options.dicom_dir: | 262 | if options.dicom_dir: |
257 | import_dir = options.dicom_dir | 263 | import_dir = options.dicom_dir |
258 | Publisher.sendMessage('Import directory', import_dir) | 264 | Publisher.sendMessage('Import directory', import_dir) |
265 | + | ||
266 | + if options.save: | ||
267 | + Publisher.sendMessage('Save project', os.path.abspath(options.save)) | ||
268 | + return True | ||
269 | + | ||
259 | return True | 270 | return True |
260 | 271 | ||
261 | # Check if there is a file path somewhere in what the user wrote | 272 | # Check if there is a file path somewhere in what the user wrote |
invesalius/control.py
@@ -98,6 +98,8 @@ class Controller(): | @@ -98,6 +98,8 @@ class Controller(): | ||
98 | 98 | ||
99 | Publisher.subscribe(self.SetBitmapSpacing, 'Set bitmap spacing') | 99 | Publisher.subscribe(self.SetBitmapSpacing, 'Set bitmap spacing') |
100 | 100 | ||
101 | + Publisher.subscribe(self.OnSaveProject, 'Save project') | ||
102 | + | ||
101 | def SetBitmapSpacing(self, pubsub_evt): | 103 | def SetBitmapSpacing(self, pubsub_evt): |
102 | proj = prj.Project() | 104 | proj = prj.Project() |
103 | proj.spacing = pubsub_evt.data | 105 | proj.spacing = pubsub_evt.data |
@@ -334,6 +336,10 @@ class Controller(): | @@ -334,6 +336,10 @@ class Controller(): | ||
334 | session.OpenProject(filepath) | 336 | session.OpenProject(filepath) |
335 | Publisher.sendMessage("Enable state project", True) | 337 | Publisher.sendMessage("Enable state project", True) |
336 | 338 | ||
339 | + def OnSaveProject(self, pubsub_evt): | ||
340 | + path = pubsub_evt.data | ||
341 | + self.SaveProject(path) | ||
342 | + | ||
337 | def SaveProject(self, path=None): | 343 | def SaveProject(self, path=None): |
338 | Publisher.sendMessage('Begin busy cursor') | 344 | Publisher.sendMessage('Begin busy cursor') |
339 | session = ses.Session() | 345 | session = ses.Session() |