예제 #1
0
def tcl(cmd):
    global _tpycl
    try:
        _tpycl
    except NameError:
        # no tcl yet, so first bring in the adapters, then the actual code
        import tpycl
        _tpycl = tpycl.tpycl()

        packages = [
            'freesurfer', 'mrml', 'mrmlLogic', 'remoteio', 'teem', 'vtk',
            'vtkITK'
        ]
        for p in packages:
            _tpycl.py_package(p)

        _tpycl.tcl_eval("""
        set dir $::env(SLICER_HOME)/$::env(SLICER_SHARE_DIR)/Tcl
        source $dir/Slicer3Adapters.tcl
        ::Slicer3Adapters::Initialize
      """)

        # TODO: not clear why package require is not working
        # - instead, source the pkgIndex directly
        _tpycl.tcl_eval("""
        set dir $::env(SLICER_HOME)/$::env(SLICER_SHARE_DIR)/Tcl
        source $dir/pkgIndex.tcl
      """)

    return _tpycl.tcl_eval(cmd)
예제 #2
0
def tcl(cmd):
  global _tpycl
  try:
    _tpycl
  except NameError:
    # no tcl yet, so first bring in the adapters, then the actual code
    import tpycl
    _tpycl = tpycl.tpycl()

    packages = ['freesurfer', 'mrml', 'mrmlLogic', 'remoteio', 'teem', 'vtk', 'vtkITK']
    for p in packages:
      _tpycl.py_package(p)

    _tpycl.tcl_eval("""
        set dir $::env(SLICER_HOME)/lib/Slicer3/SlicerBaseGUI/Tcl
        source $dir/Slicer3Adapters.tcl
        ::Slicer3Adapters::Initialize
      """)
    
    # TODO: not clear why package require is not working 
    # - instead, source the pkgIndex directly
    _tpycl.tcl_eval("""
        set dir $::env(SLICER_HOME)/lib/Slicer3/SlicerBaseGUI/Tcl
        source $dir/pkgIndex.tcl
      """)

  return _tpycl.tcl_eval(cmd)
예제 #3
0
def tcl(cmd):
  global _tpycl
  try:
    import os
    os.environ['Slicer3_HOME']
  except KeyError:
    home = os.path.dirname(os.path.dirname(sys.executable))
    os.environ['Slicer3_HOME'] = home
  try:
    _tpycl
  except NameError:
    # no tcl yet, so first bring in the adapters, then the actual code
    import tpycl
    _tpycl = tpycl.tpycl()
    _tpycl.tcl_eval("""
        set dir $::env(Slicer3_HOME)/lib/Slicer3/SlicerBaseGUI/Tcl
        source $dir/Slicer3Adapters.tcl
        ::Slicer3Adapters::Initialize
      """)
    
    # TODO: not clear why package require is not working 
    # - instead, source the pkgIndex directly
    _tpycl.tcl_eval("""
        set dir $::env(Slicer3_HOME)/lib/Slicer3/SlicerBaseGUI/Tcl
        source $dir/pkgIndex.tcl
      """)

  return _tpycl.tcl_eval(cmd)
예제 #4
0
def tcl(cmd):
    global _tpycl
    try:
        _tpycl
    except NameError:
        # no tcl yet, so first bring in the adapters, then the actual code
        import tpycl
        _tpycl = tpycl.tpycl()

        packages = [
            'freesurfer', 'mrml', 'mrmlLogic', 'remoteio', 'teem', 'vtk',
            'vtkITK'
        ]
        for p in packages:
            _tpycl.py_package(p)

        import os
        tcl_dir = os.path.dirname(os.path.realpath(__file__)) + '/tcl/'
        _tpycl.tcl_eval("""
        set dir \"%s\"
        source $dir/Slicer3Adapters.tcl
        ::Slicer3Adapters::Initialize
      """ % tcl_dir)

    return _tpycl.tcl_eval(cmd)
예제 #5
0
def tcl(cmd):
    global _tpycl
    try:
        _tpycl
    except NameError:
        # no tcl yet, so first bring in the adapters, then the actual code
        import tpycl

        _tpycl = tpycl.tpycl()

        packages = ["freesurfer", "mrml", "mrmlLogic", "teem", "vtk", "vtkITK"]
        for p in packages:
            _tpycl.py_package(p)

        import os

        tcl_dir = os.path.dirname(os.path.realpath(__file__)) + "/tcl/"
        tcl_dir = tcl_dir.replace("\\", "/")
        _tpycl.tcl_eval(
            """
        set dir \"%s\"
        source $dir/Slicer3Adapters.tcl
        ::Slicer3Adapters::Initialize
      """
            % tcl_dir
        )

    return _tpycl.tcl_eval(cmd)
예제 #6
0
def tcl(cmd):
    global _tpycl
    try:
        _tpycl
    except NameError:
        # no tcl yet, so first bring in the adapters, then the actual code
        import tpycl
        _tpycl = tpycl.tpycl()

        packages = [
            'freesurfer', 'mrml', 'vtk', 'vtkAddon', 'vtkITK',
            'vtkSegmentationCore', 'vtkTeem'
        ]
        for p in packages:
            _tpycl.py_package(p)

        import os
        tcl_dir = os.path.dirname(os.path.realpath(__file__)) + '/tcl/'
        tcl_dir = tcl_dir.replace('\\', '/')
        _tpycl.tcl_eval("""
        set dir \"%s\"
        source $dir/Slicer3Adapters.tcl
        ::Slicer3Adapters::Initialize
      """ % tcl_dir)

    return _tpycl.tcl_eval(cmd)
예제 #7
0
def tcl(cmd):
  global _tpycl
  try:
    _tpycl
  except NameError:
    # no tcl yet, so first bring in the adapters, then the actual code
    import tpycl
    _tpycl = tpycl.tpycl()

    packages = ['freesurfer', 'mrml', 'mrmlLogic', 'remoteio', 'teem', 'vtk', 'vtkITK']
    for p in packages:
      _tpycl.py_package(p)

    _tpycl.tcl_eval("""
        set dir $::env(SLICER_HOME)/$::env(SLICER_SHARE_DIR)/Tcl
        source $dir/Slicer3Adapters.tcl
        ::Slicer3Adapters::Initialize
      """)

  return _tpycl.tcl_eval(cmd)
예제 #8
0
def tcl(cmd):
  global _tpycl
  try:
    _tpycl
  except NameError:
    # no tcl yet, so first bring in the adapters, then the actual code
    import tpycl
    _tpycl = tpycl.tpycl()

    packages = ['freesurfer', 'mrml', 'mrmlLogic', 'remoteio', 'teem', 'vtk', 'vtkITK']
    for p in packages:
      _tpycl.py_package(p)

    import os
    tcl_dir = os.path.dirname(os.path.realpath(__file__)) + '/tcl/'
    _tpycl.tcl_eval("""
        set dir \"%s\"
        source $dir/Slicer3Adapters.tcl
        ::Slicer3Adapters::Initialize
      """ % tcl_dir)

  return _tpycl.tcl_eval(cmd)