Commit 874717c3655160e046106cae1b6f845a171131db
1 parent
e5557a24
Exists in
master
and in
68 other branches
ENH: Change location of vtkoutput.txt #FIX:56
Showing
3 changed files
with
18 additions
and
3 deletions
Show diff stats
invesalius/constants.py
... | ... | @@ -285,9 +285,16 @@ RAYCASTING_TYPES = [_(filename.split(".")[0]) for filename in |
285 | 285 | os.listdir(folder) if |
286 | 286 | os.path.isfile(os.path.join(folder,filename))] |
287 | 287 | |
288 | + | |
289 | +LOG_FOLDER = os.path.join(os.path.expanduser('~'), '.invesalius', 'logs') | |
290 | +if not os.path.isdir(LOG_FOLDER): | |
291 | + os.makedirs(LOG_FOLDER) | |
292 | + | |
288 | 293 | folder = os.path.join(os.path.expanduser('~'), '.invesalius', 'presets') |
289 | 294 | if not os.path.isdir(folder): |
290 | 295 | os.makedirs(folder) |
296 | + | |
297 | + | |
291 | 298 | USER_RAYCASTING_PRESETS_DIRECTORY = folder |
292 | 299 | RAYCASTING_TYPES += [_(filename.split(".")[0]) for filename in |
293 | 300 | os.listdir(folder) if | ... | ... |
invesalius/data/imagedata_utils.py
... | ... | @@ -18,6 +18,7 @@ |
18 | 18 | #-------------------------------------------------------------------------- |
19 | 19 | |
20 | 20 | import math |
21 | +import os | |
21 | 22 | import vtk |
22 | 23 | import vtkgdcm |
23 | 24 | import wx.lib.pubsub as ps |
... | ... | @@ -215,10 +216,11 @@ def ExtractVOI(imagedata,xi,xf,yi,yf,zi,zf): |
215 | 216 | |
216 | 217 | def CreateImageData(filelist, zspacing, size, bits): |
217 | 218 | message = _("Generating multiplanar visualization...") |
218 | - | |
219 | + | |
219 | 220 | if not const.VTK_WARNING: |
221 | + log_path = os.path.join(const.LOG_FOLDER, 'vtkoutput.txt') | |
220 | 222 | fow = vtk.vtkFileOutputWindow() |
221 | - fow.SetFileName('vtkoutput.txt') | |
223 | + fow.SetFileName(log_path) | |
222 | 224 | ow = vtk.vtkOutputWindow() |
223 | 225 | ow.SetInstance(fow) |
224 | 226 | ... | ... |
invesalius/invesalius.py
... | ... | @@ -195,7 +195,13 @@ if __name__ == '__main__': |
195 | 195 | |
196 | 196 | # wxPython log |
197 | 197 | #sys.stdout = open("stdout.log" ,"w") |
198 | - sys.stderr = open("stderr.log", "w") | |
198 | + | |
199 | + folder_log = os.path.join(os.path.expanduser('~'), '.invesalius', 'logs') | |
200 | + if not os.path.isdir(folder_log): | |
201 | + os.makedirs(folder_log) | |
202 | + | |
203 | + path = os.path.join(folder_log, "stderr.log") | |
204 | + sys.stderr = open(path, "w") | |
199 | 205 | |
200 | 206 | # Add current directory to PYTHONPATH |
201 | 207 | sys.path.append(".") | ... | ... |