code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
# 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 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 |
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
import vtkdevide
class extractGrid(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
ModuleBase.__init__(self, module_manager)
self._config.sampleRate = (... | 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 |
# imageGaussianSmooth copyright (c) 2003 by Charl P. Botha cpbotha@ieee.org
# $Id: resampleImage.py 3229 2008-09-04 17:06:13Z cpbotha $
# performs image smoothing by convolving with a Gaussian
import gen_utils
from module_base import ModuleBase
from module_mixins import IntrospectModuleMixin
import module_utils... | Python |
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
import vtkdevide
class extractHDomes(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
ModuleBase.__init__(self, module_manager)
self._imageMath... | 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 |
import input_array_choice_mixin
from input_array_choice_mixin import InputArrayChoiceMixin
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
INTEG_TYPE = ['RK2', 'RK4', 'RK45']
INTEG_TYPE_TEXTS = ['Runge-Kutta 2', 'Runge-Kutta 4', 'Runge-Kutta 45']
IN... | Python |
# $Id$
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
class extractImageComponents(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
ModuleBase.__init__(self, module_manager)
self._extract = vtk.... | 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 ScriptedConfigModuleMixin
import module_utils
import vtk
import vtktudoss
class FastSurfaceToDistanceField(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
# initialise our base class
ModuleBas... | 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 |
# 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 |
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 |
from module_base import ModuleBase
from module_mixins import NoConfigModuleMixin
import module_utils
import vtk
class transformVolumeData(NoConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
# initialise our base class
ModuleBase.__init__(self, module_manager)
self._imageR... | 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 |
# this one was generated with:
# for i in *.py; do n=`echo $i | cut -f 1 -d .`; \
# echo -e "class $n:\n kits = ['vtk_kit']\n cats = ['Filters']\n" \
# >> blaat.txt; done
class appendPolyData:
kits = ['vtk_kit']
cats = ['Filters']
help = """DeVIDE encapsulation of the vtkAppendPolyDataFilter that
... | 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 |
# 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 |
# 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
class VolumeRender(
ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_mana... | 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 |
# imageGaussianSmooth copyright (c) 2003 by Charl P. Botha cpbotha@ieee.org
# $Id$
# performs image smoothing by convolving with a Gaussian
import gen_utils
from module_base import ModuleBase
from module_mixins import IntrospectModuleMixin
import module_utils
import vtk
class imageGaussianSmooth(IntrospectModuleMixin... | 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 |
# dumy __init__ so this directory can function as a package
| Python |
# dumy __init__ so this directory can function as a package
| Python |
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
class imageMask(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
# initialise our base class
ModuleBase.__init__(self, module_manager)
# se... | Python |
import gen_utils
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
class morphGradient(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
# initialise our base class
ModuleBase.__init__(self, module_manager... | Python |
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
class wsMeshSmooth(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
# initialise our base class
ModuleBase.__init__(self, module_manager)
... | Python |
# dumy __init__ so this directory can function as a package
| Python |
__author__ = 'Francois'
# PerturbPolyPoints.py by Francois Malan - 2012-12-06
# Randomly perturbs each polydata vertex by a uniformly sampled magnitude and random direction
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import vtk
import numpy
import math
import rando... | Python |
# DicomAligner.py by Francois Malan - 2011-06-23
# Revised as version 2.0 on 2011-07-07
from module_base import ModuleBase
from module_mixins import NoConfigModuleMixin
from module_kits.misc_kit import misc_utils
import wx
import os
import vtk
import itk
import math
import numpy
class DICOMAligner(
NoConfigModule... | 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 |
# 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 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 NoConfigModuleMixin
import module_utils
import vtk
class transformPolyData(NoConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
# initialise our base class
ModuleBase.__init__(self, module_manager)
... | 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 |
# todo:
# * vtkVolumeMapper::SetCroppingRegionPlanes(xmin,xmax,ymin,ymax,zmin,zmax)
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
class MIPRender(
ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
# ini... | 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 |
import gen_utils
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
EMODES = {
1:'Point seeded regions',
2:'Cell seeded regions',
3:'Specified regions',
4:'Largest region',
5:'All regions',
6:'Closest po... | 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 |
# 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 |
# 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 |
# __init__.py by Charl P. Botha <cpbotha@ieee.org>
# $Id$
# used to be module list, now dummy file
| Python |
# $Id: BMPRDR.py 1853 2006-02-01 17:16:28Z cpbotha $
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
import wx
class BMPReader(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
ModuleBase.__init__(self, mo... | Python |
# $Id$
from module_base import ModuleBase
from module_mixins import FilenameViewModuleMixin
import module_utils
import vtk
class vtpRDR(FilenameViewModuleMixin, ModuleBase):
def __init__(self, module_manager):
# call parent constructor
ModuleBase.__init__(self, module_manager)
self._read... | Python |
# $Id$
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
import wx
class metaImageRDR(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
ModuleBase.__init__(self, module_manager)
self._reader = vtk.... | Python |
# $Id: vtpWRT.py 2401 2006-12-20 20:29:15Z cpbotha $
from module_base import ModuleBase
from module_mixins import FilenameViewModuleMixin
import module_utils
import types
from modules.viewers.slice3dVWRmodules.selectedPoints import outputSelectedPoints
class points_reader(FilenameViewModuleMixin, ModuleBase):
def... | Python |
# $Id$
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
import wx
class pngRDR(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
ModuleBase.__init__(self, module_manager)
self._reader = vtk.vtkPNG... | Python |
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
import module_utils
import vtk
import wx
class JPEGReader(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
ModuleBase.__init__(self, module_manager)
self._reader = vtk.vtkJPEGRea... | Python |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
from module_base import ModuleBase
from module_kits.misc_kit import misc_utils
from module_mixins import \
IntrospectModuleMixin
import module_utils
import gdcm
import vtk
import vtkgdcm
import wx
from module_kits.misc_... | Python |
# $Id$
from module_base import ModuleBase
from module_mixins import FilenameViewModuleMixin
import module_utils
import vtk
import os
class vtkPolyDataRDR(FilenameViewModuleMixin, ModuleBase):
def __init__(self, module_manager):
"""Constructor (initialiser) for the PD reader.
This is almost ... | Python |
# $Id$
from module_base import ModuleBase
from module_mixins import FilenameViewModuleMixin
import module_utils
import vtk
class plyRDR(FilenameViewModuleMixin, ModuleBase):
def __init__(self, module_manager):
# call parent constructor
ModuleBase.__init__(self, module_manager)
self._re... | Python |
import gen_utils
from module_base import ModuleBase
from module_mixins import vtkPipelineConfigModuleMixin
from module_mixins import FileOpenDialogModuleMixin
import module_utils
import vtk
import wx
class rawVolumeRDR(ModuleBase,
vtkPipelineConfigModuleMixin,
FileOpenDialogModule... | Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
class BMPReader:
kits = ['vtk_kit']
cats = ['Readers']
help = """Reads a series of BMP files.
Set the file pattern by making use of the file browsing dialog. Replace
the increasing index by a %d format s... | Python |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
import gen_utils
from module_kits.misc_kit import misc_utils
import os
from module_base import ModuleBase
from module_mixins import \
IntrospectModuleMixin, FileOpenDialogModuleMixin
import module_utils
import stat
impo... | Python |
# dumy __init__ so this directory can function as a package
| Python |
# dumy __init__ so this directory can function as a package
| Python |
# $Id$
from module_base import ModuleBase
from module_mixins import FilenameViewModuleMixin
import module_utils
import vtk
import os
class objRDR(FilenameViewModuleMixin, ModuleBase):
def __init__(self, module_manager):
"""Constructor (initialiser) for the PD reader.
This is almost standard... | 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, WX_OPEN
import module_utils
import vtk
class TIFFReader(ScriptedConfigModuleMixin, ModuleBase):
def __init__(self, module_mana... | Python |
# $Id$
from module_base import ModuleBase
from module_mixins import FilenameViewModuleMixin
import module_utils
import vtk
class vtiRDR(FilenameViewModuleMixin, ModuleBase):
def __init__(self, module_manager):
# call parent constructor
ModuleBase.__init__(self, module_manager)
self._re... | Python |
# $Id$
from module_base import ModuleBase
from module_mixins import FilenameViewModuleMixin
import module_utils
import vtk
import os
class stlRDR(FilenameViewModuleMixin, ModuleBase):
def __init__(self, module_manager):
"""Constructor (initialiser) for the PD reader.
This is almost standard... | Python |
# $Id$
from module_base import ModuleBase
from module_mixins import FilenameViewModuleMixin
import module_utils
import vtk
class vtkStructPtsRDR(FilenameViewModuleMixin, ModuleBase):
def __init__(self, module_manager):
# call parent constructor
ModuleBase.__init__(self, module_manager)
... | 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 |
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 |
# $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 |
# 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 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 |
# 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 |
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 |
# $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 |
# 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 |
# 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 |
# 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 |
# 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 |
# 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 |
# 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 |
# 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 |
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 |
# 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 |
# 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 |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
# I could have done this with just a module variable, but I found this
# Borg thingy too nice not to use. See:
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531
class CounterBorg:
"""Borg-pattern (similar ... | 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 ConfigParser
import sys, os, fnmatch
import re
import copy
import gen_utils
import glob
from meta_module import MetaModule
import modules
import mutex
from random import choice
from module_base import DefaultConfigClas... | Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
import itk
import re
from module_kits.misc_kit.misc_utils import get_itk_img_type_and_dim
from module_kits.misc_kit.misc_utils import \
get_itk_img_type_and_dim_shortstring
get_img_type_and_dim = get_itk_img_type_an... | Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
"""itk_kit package driver file.
Inserts the following modules in sys.modules: itk, InsightToolkit.
@author: Charl P. Botha <http://cpbotha.net/>
"""
import os
import re
import sys
VERSION = ''
def setDLFlags():
# bro... | Python |
# $Id: __init__.py 1945 2006-03-05 01:06:37Z cpbotha $
# 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.
"""matplotlib_kit package driver file.
Inserts the following modules in sys.modu... | Python |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
import gdcm
def sort_ipp(filenames):
"""STOP PRESS. This is currently incomplete. I'm waiting to see
what's going to happen with the IPPSorter in GDCM.
Given a list of filenames, make use of the gdcm scanne... | Python |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
"""gdcm_kit driver module.
This pre-loads GDCM2, the second generation Grass Roots Dicom library,
used since 2008 by DeVIDE for improved DICOM loading / saving support.
"""
import os
import sys
VERSION = ''
def init(modul... | Python |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
import re
# map from itk type string to string
ITKTSTR_STRING = {
'C' : 'char',
'D' : 'double',
'F' : 'float',
'L' : 'long',
'S' : 'short'
}
# map from itk type sign to string
... | Python |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
class MedicalMetaData:
def __init__(self):
self.medical_image_properties = None
self.direction_cosines = None
def close(self):
del self.medical_image_properties
del self.direction_cosin... | Python |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
class SubjectMixin(object):
def __init__(self):
# dictionary mapping from event name to list of observer
# callables
self._observers = {}
def add_observer(self, event_name, observer):
... | Python |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
import sys
VERSION = 'INTEGRATED'
# debug print command: if DEBUG is true, outputs to stdout, if not
# then outputs nothing.
# import with: from module_kits.misc_kit import dprint
DEBUG=False
if DEBUG:
def dprint(*msg):
... | Python |
import code
from code import softspace
import os
import sys
import wx
import new
def sanitise_text(text):
"""When we process text before saving or executing, we sanitise it
by changing all CR/LF pairs into LF, and then nuking all remaining CRs.
This consistency also ensures that the files we save have the ... | 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 |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
import wx
from wx import py
from wx import stc
class DVEditWindow(py.editwindow.EditWindow):
"""DeVIDE EditWindow.
This fixes all of the py screwups by providing a re-usable Python
EditWindow component. The Py ... | Python |
import wx
from wx import py
class DVShell(py.shell.Shell):
"""DeVIDE shell.
Once again, PyCrust makes some pretty bad calls here and there. With this
override we fix some of them.
1. passing locals=None will result in shell.Shell setting locals to
__main__.__dict__ (!!) in contrast to the defaul... | 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 |
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.