Skip to content
Snippets Groups Projects
Commit de42b790 authored by Paul McCarthy's avatar Paul McCarthy
Browse files

Changes to props package listener function signatures; a useful little

trace utility for debugging
parent 2746aa43
No related branches found
No related tags found
No related merge requests found
...@@ -59,7 +59,7 @@ class Options(props.HasProperties): ...@@ -59,7 +59,7 @@ class Options(props.HasProperties):
zCoordinate = props.Int(default=0, minval=0) zCoordinate = props.Int(default=0, minval=0)
def setOutputImage(self, value, valid, ctx): def setOutputImage(self, value, valid, *a):
""" """
When a (valid) input image file name is selected, the output When a (valid) input image file name is selected, the output
image is set to the same name, with a suffix of '_brain'. image is set to the same name, with a suffix of '_brain'.
...@@ -70,7 +70,7 @@ class Options(props.HasProperties): ...@@ -70,7 +70,7 @@ class Options(props.HasProperties):
self.outputImage = value + '_brain' self.outputImage = value + '_brain'
def clearT2Image(self, value, valid, ctx): def clearT2Image(self, value, *a):
""" """
This is a bit of a hack. If the user provides an invalid value This is a bit of a hack. If the user provides an invalid value
for the T2 image (when running bet with the -A2 flag), but then for the T2 image (when running bet with the -A2 flag), but then
......
#!/usr/bin/env python
#
# trace.py -
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
import logging
import inspect
log = logging.getLogger(__name__)
def trace(desc):
stack = inspect.stack()[1:]
lines = '{}\n'.format(desc)
for i, frame in enumerate(stack):
srcMod = frame[1]
srcLineNo = frame[2]
if frame[4] is not None: srcLine = frame[4][frame[5]]
else: srcLine = '<native>'
lines = lines + '{}{}:{}: {}\n'.format(
' ' * (i + 1),
srcMod, srcLineNo,
srcLine.strip())
log.debug(lines)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment