code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
from module_base import ModuleBase
from module_mixins import NoConfigModuleMixin
import module_utils
import vtk
IMAGE_DATA = 0
POLY_DATA = 1
class StreamerVTK(NoConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
ModuleBase.__init__(self, module_manager)
self._image_data_streamer ... | Python |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
class RegionGrowing(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
... | Python |
import gen_utils
from module_base import ModuleBase
from module_mixins import NoConfigModuleMixin
import module_utils
import vtk
class polyDataNormals(NoConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
# initialise our base class
ModuleBase.__init__(self, module_manager)
... | Python |
import gen_utils
from module_base import ModuleBase
from module_mixins import NoConfigModuleMixin
import module_utils
import vtk
import vtkdevide
class greyReconstruct(NoConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
# initialise our base class
ModuleBase.__init__(self, module_... | Python |
import gen_utils
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
class opening(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
# initialise our base class
ModuleBase.__init__(self, module_manager)
... | Python |
import operator
from module_base import ModuleBase
from module_mixins import IntrospectModuleMixin
import module_utils
import vtk
import vtkdevide
import wx
from module_mixins import ColourDialogMixin
class shellSplatSimple(IntrospectModuleMixin,
ColourDialogMixin, ModuleBase):
def __init_... | Python |
# todo:
# * vtkVolumeMapper::SetCroppingRegionPlanes(xmin,xmax,ymin,ymax,zmin,zmax)
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
import vtkdevide
import vtktudoss
class ExpVolumeRender(
ScriptedConfigModuleMixin, ModuleBase):
def __init... | Python |
import gen_utils
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import wx
import vtk
class closing(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
# initialise our base class
ModuleBase.__init__(self, mod... | Python |
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
class marchingCubes(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
# call parent constructor
ModuleBase.__init__(self, module_manager)
self.... | Python |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
from module_base import ModuleBase
from module_mixins import NoConfigModuleMixin
import module_utils
import vtk
import numpy
class FitEllipsoidToMask(NoConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
... | Python |
# dumy __init__ so this directory can function as a package
| Python |
# dumy __init__ so this directory can function as a package
| Python |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
class ICPTransform(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
... | Python |
import gen_utils
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
class seedConnect(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
# call parent constructor
ModuleBase.__init__(self, module_manager)... | Python |
from module_base import ModuleBase
from module_mixins import vtkPipelineConfigModuleMixin
import module_utils
import vtk
class contourFLTBase(ModuleBase, vtkPipelineConfigModuleMixin):
def __init__(self, module_manager, contourFilterText):
# call parent constructor
ModuleBase.__init__(self, modul... | Python |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
import input_array_choice_mixin # need this for constants
reload(input_array_choice_mixin)
from input_array_... | Python |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
import input_array_choice_mixin
reload(input_array_choice_mixin)
from input_array_choice_mixin import InputA... | Python |
import gen_utils
from module_base import ModuleBase
from module_mixins import NoConfigModuleMixin
import module_utils
import vtk
class clipPolyData(NoConfigModuleMixin, ModuleBase):
"""Given an input polydata and an implicitFunction, this will clip
the polydata.
All points that are inside the implicit fun... | Python |
# landmark_transform.py copyright (c) 2003 by Charl P. Botha <cpbotha@ieee.org>
# $Id$
# see module documentation
import gen_utils
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
class landmarkTransform(ScriptedConfigModuleMixin, ModuleBase):
... | Python |
import gen_utils
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
OPS = ['add', 'subtract', 'multiply', 'divide', 'invert',
'sin', 'cos', 'exp', 'log', 'abs', 'sqr', 'sqrt', 'min',
'max', 'atan', 'atan2', 'multiply by k', 'add c', 'conj... | Python |
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
import vtkdevide
class selectConnectedComponents(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
# call parent constructor
ModuleBase.__init__(self, mo... | Python |
# dumy __init__ so this directory can function as a package
| Python |
# TODO: simplify module!! all this muck was necessary due to the old
# demand-driven model. Keep the code around, it could be used as
# illustrative case.
import gen_utils
from module_base import ModuleBase
from module_mixins import NoConfigModuleMixin
import module_utils
import vtk
import vtkdevide
class modifyHom... | Python |
import gen_utils
from module_base import ModuleBase
from module_mixins import NoConfigModuleMixin
import module_utils
import wx
import vtk
class imageGradientMagnitude(NoConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
# initialise our base class
ModuleBase.__init__(self, module... | Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
class ImageLogic(ScriptedConfigModuleMixin, ModuleBase):
# get these values from vtkImageMathematic... | Python |
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
class contour(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
# call parent constructor
ModuleBase.__init__(self, module_manager)
self._conto... | Python |
# Modified by FrancoisMalan 2011-12-06 so that it can handle an input with larger
# extent than its source. Changes constitute the padder module and pad_source method
import gen_utils
from module_base import ModuleBase
from module_mixins import NoConfigModuleMixin
import module_utils
import vtk
class prob... | Python |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
from module_base import ModuleBase
from module_mixins import IntrospectModuleMixin
import module_kits.vtk_kit
import module_utils
import vtk
import wx
from module_kits.misc_kit.devide_types import MedicalMetaData
class EditM... | Python |
# decimateFLT.py copyright (c) 2003 by Charl P. Botha http://cpbotha.net/
# $Id$
# module that triangulates and decimates polygonal input
import gen_utils
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
import gen_utils
from module_base import Modul... | Python |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
import vtk
DEFAULT_SELECTION_STRING = 'Default active array'
class InputArrayChoiceMixin:
def __init__(self):
self._config.vectorsSelection = DEFAULT_SELECTION_STRING
self._config.input_array_names = []
... | Python |
# glenoidMouldDesigner.py copyright 2003 Charl P. Botha http://cpbotha.net/
# $Id$
# devide module that designs glenoid moulds by making use of insertion
# axis and model of scapula
# this module doesn't satisfy the event handling requirements of DeVIDE yet
# if you call update on the output PolyData, this module won'... | Python |
from module_base import ModuleBase
from module_mixins import NoConfigModuleMixin
import module_utils
import vtk
class transformImageToTarget(NoConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
# initialise our base class
ModuleBase.__init__(self, module_manager)
... | Python |
import gen_utils
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
class imageMedian3D(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
# initialise our base class
ModuleBase.__init__(self, module_m... | Python |
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
import vtkdevide
class imageFillHoles(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
ModuleBase.__init__(self, module_manager)
self._imageBorderMask =... | Python |
from module_base import ModuleBase
from module_mixins import IntrospectModuleMixin
import module_utils
import vtk
import vtkdevide
import wx
class histogramSegment(IntrospectModuleMixin, ModuleBase):
"""Mooooo! I'm a cow.
$Revision: 1.9 $
"""
_gridCols = [('Type', 0), ('Number of Handles',0)]
_g... | Python |
from module_kits.misc_kit.mixins import SubjectMixin
import geometry
from module_base import ModuleBase
from module_mixins import IntrospectModuleMixin
import module_utils
import Measure2DFrame
reload(Measure2DFrame)
import vtk
import vtktudoss
import wx
class M2DMeasurementInfo:
pass
class M2DWidget:
"""Cla... | Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
from external.ObjectListView import ColumnDefn, EVT_CELL_EDIT_FINISHING
import itk
from module_kits import itk_kit
import module_utils
import vtk
import wx
####################################################################... | Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
class CodeRunner:
kits = ['wx_kit', 'vtk_kit']
cats = ['Viewers']
help = \
"""CodeRunner facilitates the direct integration of Python code into a
DeVIDE network.
The top part contains three editor int... | Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
import comedi_utils
reload(comedi_utils)
import vtk
import vtktudoss
from module_kits import vtk_kit
import wx
###########################################################################
# 2D:
# * Checkerboard.
# * differe... | Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
# Hello there person reading this source!
# At the moment, I'm trying to get a fully-functioning DICOM browser
# out the door as fast as possible. As soon as the first version is
# out there and my one user can start giving ... | Python |
# - make our own window control for colour-sequence bar
# - this should also have separate (?) line with HSV colour vertices
# - on this line, there should be vertical lines indicating the current
# position of all the opacity transfer function vertices
# - abstract floatcanvas-derived linear function editor into wx_... | Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
import cStringIO
import vtk
from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor
import wx
# wxPython 2.8.8.1 wx.aui bugs severely on GTK. See:
# http://trac.wxwidgets.org/ticket/9716
# Until this is fi... | Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
from module_kits.vtk_kit.utils import DVOrientationWidget
import operator
import vtk
import wx
class SyncSliceViewers:
"""Class to link a number of CMSliceViewer instances w.r.t.
camera.
FIXME: consider adding o... | Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
# skeleton of an AUI-based viewer module
# copy and modify for your own purposes.
# set to False for 3D viewer, True for 2D image viewer
IMAGE_VIEWER = True
# import the frame, i.e. the wx window containing everything
impor... | Python |
import vtk
import wx
from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor
import external.PyAUI as PyAUI
from resources.python import measure2d_panels
reload(measure2d_panels)
class Measure2DFrame(wx.Frame):
def __init__(self, parent, id=-1, title="", pos=wx.DefaultPosition,
... | Python |
from external import wxPyPlot
import gen_utils
from module_base import ModuleBase
from module_mixins import IntrospectModuleMixin
import module_utils
try:
import Numeric
except:
import numarray as Numeric
import vtk
import wx
class histogram1D(IntrospectModuleMixin, ModuleBase):
"""Calculates and sh... | Python |
# slice3d_vwr.py copyright (c) 2002-2010 Charl P. Botha
# next-generation of the slicing and dicing devide module
# TODO: 'refresh' handlers in set_input()
# TODO: front-end / back-end module split (someday)
# should we use background renderer for gradient background, or
# built-in VTK functionality?
BACKGROUND_RENDE... | Python |
# dumy __init__ so this directory can function as a package
| Python |
# dumy __init__ so this directory can function as a package
| Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
# skeleton of an AUI-based viewer module
# copy and modify for your own purposes.
# set to False for 3D viewer, True for 2D image viewer
IMAGE_VIEWER = True
MATCH_MODE_PASSTHROUGH = 0
MATCH_MODE_LANDMARK_SS = 1
MATCH_MODE_... | Python |
# check python24/lib/code.py - exceptions raised only result in
# printouts. perhaps we want a real exception?
import code # deep magic
import md5
from module_base import ModuleBase
from module_mixins import IntrospectModuleMixin, WindowRenameMixin
import module_utils
import sys
import module_kits.wx_kit
from module_... | Python |
# implicits.py copyright (c) 2003 Charl P. Botha <cpbotha@ieee.org>
# $Id$
import gen_utils
from modules.viewers.slice3dVWRmodules.shared import s3dcGridMixin
import vtk
import wx
# -------------------------------------------------------------------------
class implicitInfo:
def __init__(self):
self.name... | Python |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
import operator
import module_utils
import vtk
import wx
class sliceDirection:
"""Class encapsulating all logic behind a single direction.
This class contains the IPWs and related paraphernalia for all layers
(pr... | Python |
# tdObjects.py copyright (c) 2003 by Charl P. Botha <cpbotha@ieee.org>
# $Id$
# class that controls the 3-D objects list
import gen_utils
reload(gen_utils)
import math
import module_kits
from module_kits.vtk_kit import misc
from modules.viewers.slice3dVWRmodules.shared import s3dcGridMixin
import operator
import vtk
i... | Python |
# shared.py copyright (c) 2003 Charl P. Botha <cpbotha@ieee.org>
# $Id$
#
import wx
class s3dcGridMixin(object):
"""
"""
def _handlerGridRangeSelect(self, event):
"""This event handler is a fix for the fact that the row
selection in the wxGrid is deliberately broken. It's also
... | Python |
# selectedPoints.py copyright (c) 2003 Charl P. Botha <cpbotha@ieee.org>
# $Id$
#
from module_kits.misc_kit.mixins import SubjectMixin
from modules.viewers.slice3dVWRmodules.shared import s3dcGridMixin
import operator
import vtk
import wx
# -------------------------------------------------------------------------
c... | Python |
# sliceDirections.py copyright (c) 2003 Charl P. Botha <cpbotha@ieee.org>
# $Id$
# class encapsulating all instances of the sliceDirection class
import gen_utils
# the following two lines are only needed during prototyping of the modules
# that they import
import modules.viewers.slice3dVWRmodules.sliceDirection
reloa... | Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
import cStringIO
from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor
import wx
# wxPython 2.8.8.1 wx.aui bugs severely on GTK. See:
# http://trac.wxwidgets.org/ticket/9716
# Until this is fixed, use th... | Python |
#Hacked out of from a class contained in Charl Botha's comedi_utils.py
#Incorporated edits by by Corine Slagboom & Noeska Smit which formed part of their comedi_utils used as part of their Emphysema Viewer.
#Final version by Francois Malan (2010-2011)
from module_kits.vtk_kit.utils import DVOrientationWidget
impo... | Python |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
# NOTES:
# you can't put the RWI in a StaticBox, it never manages to appear.
# mode: add / subtract
# tool: new region growing, level set (with existing mask), draw
# closed polygon, delete
# ARGH. region growing results in... | Python |
# dumy __init__ so this directory can function as a package
| Python |
# Modified by Francois Malan, LUMC / TU Delft
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor
import wx
import wx.lib.inspection
import vtk
# wxPython 2.8.8.1 wx.aui bugs severely on GTK. See:
# ht... | Python |
# $Id$
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
import vtkdevide
class histogram2D(ScriptedConfigModuleMixin, ModuleBase):
"""This module takes two inputs and creates a 2D histogram with input 2
vs input 1, i.e. input 1 on x-axis and... | Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
import csv
import geometry
import glob
import os
import math
from module_base import ModuleBase
from module_mixins import IntrospectModuleMixin,\
FileOpenDialogModuleMixin
import module_utils
import vtk
import vtkgdcm... | Python |
from wxPython._controls import wxLIST_MASK_STATE
from wxPython._controls import wxLIST_STATE_SELECTED
import os.path
# Modified by Francois Malan, LUMC / TU Delft
# December 2009
#
# based on the SkeletonAUIViewer:
# skeleton of an AUI-based viewer module
# Copyright (c) Charl P. Botha, TU Delft.
# set to False for 3D... | Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
import cStringIO
from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor
import wx
# wxPython 2.8.8.1 wx.aui bugs severely on GTK. See:
# http://trac.wxwidgets.org/ticket/9716
# Until this is fixed, use th... | Python |
from module_base import ModuleBase
from module_mixins import IntrospectModuleMixin
import module_utils
import operator
HTML_START = '<html><body>'
HTML_END = '</body></html>'
def render_actions(lines):
ms = '<p><b><ul>%s</ul></b></p>'
# this should yield: <li>thing 1\n<li>thing 2\n<li>thing 3 etc
bullets ... | Python |
# __init__.py by Charl P. Botha <cpbotha@ieee.org>
# $Id$
# used to be module list, now dummy file
| Python |
# dumy __init__ so this directory can function as a package
| Python |
#!/usr/bin/env python
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
import re
import getopt
import mutex
import os
import re
import stat
import string
import sys
import time
import traceback
import ConfigParser
# we need to import this explicitly, else... | Python |
# snippet to save polydata of all selected objects to disc, transformed with
# the currently active object motion for that object. This snippet should be
# run within a slice3dVWR introspection context.
# $Id$
import os
import tempfile
import vtk
className = obj.__class__.__name__
if className == 'slice3dVWR':
... | Python |
# short DeVIDE matplotlib demo.
from pylab import *
# close previous figure if it exists
try:
obj.mpl_close_figure(numpy_test_figure)
except NameError:
pass
numpy_test_figure = obj.mpl_new_figure()
# this example from http://matplotlib.sourceforge.net/screenshots/log_shot.py
dt = 0.01
t = arange(dt, 20.0, d... | Python |
# EXPERIMENTAL. DO NOT USE UNLESS YOU ARE JORIK. (OR JORIS)
import vtk
className = obj.__class__.__name__
if className == 'slice3dVWR':
ipw = obj.sliceDirections._sliceDirectionsDict.values()[0]._ipws[0]
if ipw.GetInput():
mins, maxs = ipw.GetInput().GetScalarRange()
else:
mins, maxs... | Python |
# this snippet will rotate the camera in the slice3dVWR that you have
# selected whilst slowly increasing the isovalue of the marchingCubes that
# you have selected and dump every frame as a PNG to the temporary directory
# this is ideal for making movies of propagating surfaces in distance fields
# 1. right click on ... | Python |
import vtk
import wx
className = obj.__class__.__name__
if className == 'slice3dVWR':
sds = obj.sliceDirections.getSelectedSliceDirections()
if len(sds) > 0:
opacityText = wx.GetTextFromUser(
'Enter a new opacity value (0.0 to 1.0) for all selected '
'slices.')
o... | Python |
# snippet to be ran in the introspection window of a slice3dVWR to
# export the whole scene as a RIB file. Before you can do this,
# both BACKGROUND_RENDERER and GRADIENT_BACKGROUND in slice3dVWR.py
# should be set to False.
obj._orientation_widget.Off()
rw = obj._threedRenderer.GetRenderWindow()
re = vtk.vtkRIBExp... | Python |
# short DeVIDE matplotlib demo.
from pylab import *
# close previous figure if it exists
try:
obj.mpl_close_figure(numpy_test_figure)
except NameError:
pass
numpy_test_figure = obj.mpl_new_figure()
a = arange(-30, 30, 0.01)
plot(a, sin(a) / a, label='sinc(x)')
plot(a, cos(a), label='cos(x)')
legend()
grid()... | Python |
# link cameras of all selected slice3dVWRs
# after having run this, all selected slice3dVWRs will have linked
# cameras, so if you change the view in anyone, all will follow.
# 1. run this in the main DeVIDE introspection window after having
# selected a number of slice3dVWRs
# 2. to unlink views, type unlink_slic... | Python |
# to use this code:
# 1. load into slice3dVWR introspection window
# 2. execute with ctrl-enter or File | Run current edit
# 3. in the bottom window type lm1 = get_lookmark()
# 4. do stuff
# 5. to restore lookmark, do set_lookmark(lm1)
# keep on bugging me to:
# 1. fix slice3dVWR
# 2. build this sort of functionality ... | Python |
# $Id$
# to use a shader on an actor, do this first before export:
# a = vtk.vtkRIBProperty()
# a.SetVariable('Km', 'float')
# a.SetParameter('Km', '1')
# a.SetDisplacementShader('dented')
# actor.SetProperty(a)
import os
import tempfile
import vtk
className = obj.__class__.__name__
if className == 'slice3dVWR':
... | Python |
# snippet to change the LookupTables (colourmaps) of the selected objects
# this should be run in the introspection context of a slice3dVWR
# $Id$
import os
import tempfile
import vtk
className = obj.__class__.__name__
if className == 'slice3dVWR':
# find all polydata objects
so = obj._tdObjects._getSelecte... | Python |
# convert old-style (up to DeVIDE 8.5) to new-style DVN network files
#
# usage:
# load your old network in DeVIDE 8.5, then execute this snippet in
# the main Python introspection window. To open the main Python
# introspection window, select from the main DeVIDE menu: "Window |
# Python Shell". In the window ... | Python |
# this is an extremely simple example of a DeVIDE snippet
# Open the Python shell (under Window in the Main Window), click on the
# "Load Snippet" button and select this file.
# it will print the directory where devide is installed and then show
# the main application help
print devideApp.get_appdir()
devideApp.showH... | Python |
# this DeVIDE snippet will determine the surface area of all selected
# 3D objects in a marked slice3dVWR
# in short:
# 1. right click on a slice3dVWR in the graphEditor
# 2. select "Mark Module" from the drop-down menu
# 3. accept "slice3dVWR" as suggestion for the mark index name
# 4. execute this snippet
import vt... | Python |
# $Id$
import os
import tempfile
import vtk
className = obj.__class__.__name__
if className == 'slice3dVWR':
rw = obj._threedRenderer.GetRenderWindow()
try:
e = vtk.vtkGL2PSExporter()
except AttributeError:
print "Your VTK was compiled without GL2PS support."
else:
e.S... | Python |
import vtk
className = obj.__class__.__name__
if className == 'slice3dVWR':
rw = obj.threedFrame.threedRWI.GetRenderWindow()
rw.SetStereoTypeToCrystalEyes()
#rw.SetStereoTypeToRedBlue()
rw.SetStereoRender(1)
rw.Render()
else:
print "This snippet must be run from a slice3dVWR introspection win... | Python |
# short DeVIDE matplotlib demo.
from pylab import *
# close previous figure if it exists
try:
obj.mpl_close_figure(numpy_test_figure)
except NameError:
pass
# square figure and square axes looks better for polar plots
numpy_test_figure = obj.mpl_new_figure(figsize=(8,8))
ax = axes([0.1, 0.1, 0.8, 0.8], polar... | Python |
# snippet that illustrates programmatic setting of Window/Level
# in the slice3dVWR introspection interface
W = 500
L = 1000
sds = obj.sliceDirections._sliceDirectionsDict.values()
for sd in sds:
ipw = sd._ipws[0]
ipw.SetWindowLevel(W, L, 0)
| Python |
# this snippet will rotate the camera in the slice3dVWR that you have
# selected and dump every frame as a PNG to the temporary directory
# you can modify this snippet if you want to make movies of for instance
# deforming surfaces and whatnot
# 1. right click on a slice3dVWR in the graphEditor
# 2. select "Mark Modul... | Python |
import vtk
import wx
def makeBorderPD(ipw):
# setup source
ps = vtk.vtkPlaneSource()
ps.SetOrigin(ipw.GetOrigin())
ps.SetPoint1(ipw.GetPoint1())
ps.SetPoint2(ipw.GetPoint2())
fe = vtk.vtkFeatureEdges()
fe.SetInput(ps.GetOutput())
tubef = vtk.vtkTubeFilter()
tubef.SetNumberOfSides... | Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
import ConfigParser
from ConfigParser import NoOptionError
import copy
from module_kits.misc_kit.mixins import SubjectMixin
from module_manager import PickledModuleState, PickledConnection
import os
import time
import types
... | Python |
# python rules. severely.
# (c) 2007 cpbotha
import glob
import sys
import os
import shutil
import zipfile
def main():
cwd = os.path.abspath(os.curdir)
hhp_dir = os.path.join(cwd, 'devidehelp_tmphhp')
os.chdir(hhp_dir)
htb_list = glob.glob('*.html') + \
glob.glob('*.png') + \
glob.... | Python |
# example driver script for offline / command-line processing with DeVIDE
# the following variables are magically set in this script:
# interface - instance of ScriptInterface, with the following calls:
# meta_modules = load_and_realise_network()
# execute_network(self, meta_modules)
# clear_network(self)
# in... | Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
import counter
class MetaModule:
"""Class used to store module-related information.
Every instance is contained in a single MetaModule. This is why the
cycle-proof module split has not been implemented as Meta... | Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
"""
"""
import mutex
#########################################################################
class SchedulerException(Exception):
pass
class CyclesDetectedException(SchedulerException):
pass
################... | Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
"""Module containing base class for devide modules.
author: Charl P. Botha <cpbotha@ieee.org>
"""
#########################################################################
class GenericObject(object):
"""Generic object ... | Python |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
# importing this module shouldn't directly cause other large imports
# do large imports in the init() hook so that you can call back to the
# ModuleManager progress handler methods.
"""geometry_kit package driver file.
Inser... | Python |
import math
import numpy
epsilon = 1e-12
def abs(v1):
return numpy.absolute(v1)
def norm(v1):
"""Given vector v1, return its norm.
"""
v1a = numpy.array(v1)
norm = numpy.sqrt(numpy.sum(v1a * v1a))
return norm
def normalise_line(p1, p2):
"""Given two points, return normal vector, magnitu... | Python |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
import wx
def get_system_font_size():
# wx.SYS_ANSI_FIXED_FONT seems to return reliable settings under
# Windows and Linux. SYS_SYSTEM_FONT doesn't do so well on Win.
ft = wx.SystemSettings.GetFont(wx.SYS_ANSI_FI... | Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
import os
import sys
import module_kits.wx_kit
from module_kits.wx_kit.python_shell_mixin import PythonShellMixin
import wx
class Tab:
def __init__(self, editwindow, interp):
self.editwindow = editwindow
... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.