def render_image(png_reader): square = 8 color_map = vtk.vtkLookupTable() color_map.SetNumberOfColors(16) color_map.SetHueRange(0, 0.667) magnitude = vtk.vtkImageMagnitude() magnitude.SetInput(png_reader.GetOutput()) geometry = vtk.vtkImageDataGeometryFilter() geometry.SetInput(magnitude.GetOutput()) warp = vtk.vtkWarpScalar() warp.SetInput(geometry.GetOutput()) warp.SetScaleFactor(0.25) merge = vtk.vtkMergeFilter() merge.SetGeometry(warp.GetOutput()) merge.SetScalars(png_reader.GetOutput()) elevation_mtHood = vtk.vtkElevationFilter() elevation_mtHood.SetInput(merge.GetOutput()) elevation_mtHood.SetLowPoint(0, 0, 0) elevation_mtHood.SetHighPoint(0, 0, 50) mapper_3D_mtHood = vtk.vtkDataSetMapper() mapper_3D_mtHood.SetInput(elevation_mtHood.GetOutput()) mapper_3D_mtHood.SetLookupTable(color_map) mapper_2D_mtHood = vtk.vtkPolyDataMapper2D() mapper_2D_mtHood.SetInput(elevation_mtHood.GetOutput()) mapper_2D_mtHood.SetLookupTable(color_map) actor_2D_mtHood = vtk.vtkActor2D() actor_2D_mtHood.SetMapper(mapper_2D_mtHood) actor_2D_mtHood.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay() actor_2D_mtHood.GetPositionCoordinate().SetValue(0.25,0.25) actor_3D_mtHood = vtk.vtkActor() actor_3D_mtHood.SetMapper(mapper_3D_mtHood) renderer = vtk.vtkRenderer() renderWindow = vtk.vtkRenderWindow() renderWindow.AddRenderer(renderer) renderWindowInteractor = vtk.vtkRenderWindowInteractor() renderWindowInteractor.SetRenderWindow(renderWindow) renderer.AddActor(actor_3D_mtHood) renderer.SetBackground(.5, .5, .5) renderWindow.SetSize(600, 600) renderWindow.Render() renderWindowInteractor.Start()
def __init__(self, module_manager): SimpleVTKClassModuleBase.__init__( self, module_manager, vtk.vtkMergeFilter(), 'Processing.', ('vtkDataSet', 'vtkDataSet', 'vtkDataSet', 'vtkDataSet', 'vtkDataSet', 'vtkDataSet'), ('vtkDataSet', ), replaceDoc=True, inputFunctions=None, outputFunctions=None)
def __init__(self, module_manager): SimpleVTKClassModuleBase.__init__( self, module_manager, vtk.vtkMergeFilter(), "Processing.", ("vtkDataSet", "vtkDataSet", "vtkDataSet", "vtkDataSet", "vtkDataSet", "vtkDataSet"), ("vtkDataSet",), replaceDoc=True, inputFunctions=None, outputFunctions=None, )
def render_image(png_reader): colorLookup = vtk.vtkLookupTable() colorLookup.SetNumberOfColors(256) colorLookup.SetTableRange(0, 255) for ii in range(0, 256): colorLookup.SetTableValue(ii, 0, 0, 0, 1) magnitude = vtk.vtkImageMagnitude() magnitude.SetInput(png_reader.GetOutput()) geometry = vtk.vtkImageDataGeometryFilter() geometry.SetInput(magnitude.GetOutput()) warp = vtk.vtkWarpScalar() warp.SetInput(geometry.GetOutput()) warp.SetScaleFactor(0.25) merge = vtk.vtkMergeFilter() merge.SetGeometry(warp.GetOutput()) merge.SetGeometry(warp.GetOutput()) merge.SetScalars(png_reader.GetOutput()) mapper = vtk.vtkDataSetMapper() mapper.SetInput(merge.GetOutput()) mapper.ScalarVisibilityOn() mapper.SetLookupTable(colorLookup) # mapper.SetScalarRange(0,255) actor = vtk.vtkActor() actor.SetMapper(mapper) renderer = vtk.vtkRenderer() renderWindow = vtk.vtkRenderWindow() renderWindow.AddRenderer(renderer) renderWindowInteractor = vtk.vtkRenderWindowInteractor() renderWindowInteractor.SetRenderWindow(renderWindow) renderer.AddActor(actor) renderer.SetBackground(0.5, 0.5, 0.5) renderWindow.SetSize(600, 600) renderWindow.Render() renderWindowInteractor.Start()
def render_image(png_reader): colorLookup = vtk.vtkLookupTable() colorLookup.SetNumberOfColors(256) colorLookup.SetTableRange(0, 255) for ii in range(0, 256): colorLookup.SetTableValue(ii, 0, 0, 0, 1) magnitude = vtk.vtkImageMagnitude() magnitude.SetInput(png_reader.GetOutput()) geometry = vtk.vtkImageDataGeometryFilter() geometry.SetInput(magnitude.GetOutput()) warp = vtk.vtkWarpScalar() warp.SetInput(geometry.GetOutput()) warp.SetScaleFactor(0.25) merge = vtk.vtkMergeFilter() merge.SetGeometry(warp.GetOutput()) merge.SetGeometry(warp.GetOutput()) merge.SetScalars(png_reader.GetOutput()) mapper = vtk.vtkDataSetMapper() mapper.SetInput(merge.GetOutput()) mapper.ScalarVisibilityOn() mapper.SetLookupTable(colorLookup) #mapper.SetScalarRange(0,255) actor = vtk.vtkActor() actor.SetMapper(mapper) renderer = vtk.vtkRenderer() renderWindow = vtk.vtkRenderWindow() renderWindow.AddRenderer(renderer) renderWindowInteractor = vtk.vtkRenderWindowInteractor() renderWindowInteractor.SetRenderWindow(renderWindow) renderer.AddActor(actor) renderer.SetBackground(.5, .5, .5) renderWindow.SetSize(600, 600) renderWindow.Render() renderWindowInteractor.Start()
def __init__(self, parent, visualizer, **kws): """ Initialization """ VisualizationModule.__init__(self, parent, visualizer, **kws) self.descs = { "Normals": "Smooth surface with normals", "FeatureAngle": "Feature angle of normals", "Slice": "Select slice to be warped", "Scale": "Scale factor for warping" } self.luminance = vtk.vtkImageLuminance() #DataGeometry filter, image to polygons self.geometry = vtk.vtkImageDataGeometryFilter() self.colorMapper = None #warp scalars! self.warp = vtk.vtkWarpScalar() self.warp.SetScaleFactor(-0.1) #merge image and new warped data self.merge = vtk.vtkMergeFilter() self.normals = vtk.vtkPolyDataNormals() self.normals.SetFeatureAngle(90) #first the mapper self.mapper = vtk.vtkPolyDataMapper() #make the actor from the mapper self.actor = vtk.vtkActor() self.actor.SetMapper(self.mapper) self.renderer = self.parent.getRenderer() self.renderer.AddActor(self.actor) # iactor = self.wxrenwin.GetRenderWindow().GetInteractor() self.filterDesc = "Visualize 2D slice as 3D map"
def __init__(self, parent, visualizer, **kws): """ Initialization """ VisualizationModule.__init__(self, parent, visualizer, **kws) self.descs = {"Normals": "Smooth surface with normals", "FeatureAngle": "Feature angle of normals", "Slice": "Select slice to be warped", "Scale": "Scale factor for warping"} self.luminance = vtk.vtkImageLuminance() #DataGeometry filter, image to polygons self.geometry = vtk.vtkImageDataGeometryFilter() self.colorMapper = None #warp scalars! self.warp = vtk.vtkWarpScalar() self.warp.SetScaleFactor(-0.1) #merge image and new warped data self.merge = vtk.vtkMergeFilter() self.normals = vtk.vtkPolyDataNormals() self.normals.SetFeatureAngle (90) #first the mapper self.mapper = vtk.vtkPolyDataMapper() #make the actor from the mapper self.actor = vtk.vtkActor() self.actor.SetMapper(self.mapper) self.renderer = self.parent.getRenderer() self.renderer.AddActor(self.actor) # iactor = self.wxrenwin.GetRenderWindow().GetInteractor() self.filterDesc = "Visualize 2D slice as 3D map"
# Read in an image and compute a luminance value. The image is # extracted as a set of polygons (vtkImageDataGeometryFilter). We then # will warp the plane using the scalar (luminance) values. reader = vtk.vtkBMPReader() reader.SetFileName(VTK_DATA_ROOT + "/Data/masonry.bmp") luminance = vtk.vtkImageLuminance() luminance.SetInputConnection(reader.GetOutputPort()) geometry = vtk.vtkImageDataGeometryFilter() geometry.SetInputConnection(luminance.GetOutputPort()) warp = vtk.vtkWarpScalar() warp.SetInputConnection(geometry.GetOutputPort()) warp.SetScaleFactor(-0.1) # Use vtkMergeFilter to combine the original image with the warped # geometry. merge = vtk.vtkMergeFilter() merge.SetGeometryConnection(warp.GetOutputPort()) merge.SetScalarsConnection(reader.GetOutputPort()) mapper = vtk.vtkDataSetMapper() mapper.SetInputConnection(merge.GetOutputPort()) mapper.SetScalarRange(0, 255) actor = vtk.vtkActor() actor.SetMapper(mapper) # Create renderer stuff ren = vtk.vtkRenderer() renWin = vtk.vtkRenderWindow() renWin.AddRenderer(ren) iren = vtk.vtkRenderWindowInteractor() iren.SetRenderWindow(renWin)
probe.SetSourceData(output) probe.Update() probeTube = vtk.vtkTubeFilter() probeTube.SetInputData(probe.GetPolyDataOutput()) probeTube.SetNumberOfSides(5) probeTube.SetRadius(.05) probeMapper = vtk.vtkPolyDataMapper() probeMapper.SetInputConnection(probeTube.GetOutputPort()) probeMapper.SetScalarRange(output.GetScalarRange()) probeActor = vtk.vtkActor() probeActor.SetMapper(probeMapper) displayLine = vtk.vtkLineSource() displayLine.SetPoint1(0,0,0) displayLine.SetPoint2(1,0,0) displayLine.SetResolution(probeLine.GetResolution()) displayMerge = vtk.vtkMergeFilter() displayMerge.SetGeometryConnection(displayLine.GetOutputPort()) displayMerge.SetScalarsData(probe.GetPolyDataOutput()) displayMerge.Update() displayWarp = vtk.vtkWarpScalar() displayWarp.SetInputData(displayMerge.GetPolyDataOutput()) displayWarp.SetNormal(0,1,0) displayWarp.SetScaleFactor(.000001) displayWarp.Update() displayMapper = vtk.vtkPolyDataMapper() displayMapper.SetInputData(displayWarp.GetPolyDataOutput()) displayMapper.SetScalarRange(output.GetScalarRange()) displayActor = vtk.vtkActor() displayActor.SetMapper(displayMapper) outline = vtk.vtkStructuredGridOutlineFilter() outline.SetInputData(output)
def main(): fileName = get_program_parameters() colors = vtk.vtkNamedColors() # Set the background color. Match those in VTKTextbook.pdf. bkg = map(lambda x: x / 256.0, [60, 93, 144]) colors.SetColor("BkgColor", *bkg) # Read in an image and compute a luminance value. The image is extracted # as a set of polygons (vtkImageDataGeometryFilter). We then will # warp the plane using the scalar (luminance) values. # reader = vtk.vtkBMPReader() reader.SetFileName(fileName) # Convert the image to a grey scale. luminance = vtk.vtkImageLuminance() luminance.SetInputConnection(reader.GetOutputPort()) # Pass the data to the pipeline as polygons. geometry = vtk.vtkImageDataGeometryFilter() geometry.SetInputConnection(luminance.GetOutputPort()) # Warp the data in a direction perpendicular to the image plane. warp = vtk.vtkWarpScalar() warp.SetInputConnection(geometry.GetOutputPort()) warp.SetScaleFactor(-0.1) # Use vtkMergeFilter to combine the original image with the warped geometry. merge = vtk.vtkMergeFilter() merge.SetGeometryConnection(warp.GetOutputPort()) merge.SetScalarsConnection(reader.GetOutputPort()) mapper = vtk.vtkDataSetMapper() mapper.SetInputConnection(merge.GetOutputPort()) mapper.SetScalarRange(0, 255) actor = vtk.vtkActor() actor.SetMapper(mapper) # Create the rendering window, renderer, and interactive renderer. ren = vtk.vtkRenderer() renWin = vtk.vtkRenderWindow() renWin.AddRenderer(ren) iren = vtk.vtkRenderWindowInteractor() iren.SetRenderWindow(renWin) # Add the actors to the renderer, set the background and size. ren.AddActor(actor) ren.ResetCamera() ren.SetBackground(colors.GetColor3d("BkgColor")) # ren.GetActiveCamera().Azimuth(20) # ren.GetActiveCamera().Elevation(30) # ren.ResetCameraClippingRange() # ren.GetActiveCamera().Zoom(1.3) ren.GetActiveCamera().SetPosition(-100, -130, 325) ren.GetActiveCamera().SetFocalPoint(105, 114, -29) ren.GetActiveCamera().SetViewUp(0.51, 0.54, 0.67) ren.ResetCameraClippingRange() renWin.SetSize(512, 512) # Render the image. iren.Initialize() renWin.Render() iren.Start()
probe.SetSourceData(output) probe.Update() probeTube = vtk.vtkTubeFilter() probeTube.SetInputData(probe.GetPolyDataOutput()) probeTube.SetNumberOfSides(5) probeTube.SetRadius(.05) probeMapper = vtk.vtkPolyDataMapper() probeMapper.SetInputConnection(probeTube.GetOutputPort()) probeMapper.SetScalarRange(output.GetScalarRange()) probeActor = vtk.vtkActor() probeActor.SetMapper(probeMapper) displayLine = vtk.vtkLineSource() displayLine.SetPoint1(0, 0, 0) displayLine.SetPoint2(1, 0, 0) displayLine.SetResolution(probeLine.GetResolution()) displayMerge = vtk.vtkMergeFilter() displayMerge.SetGeometryConnection(displayLine.GetOutputPort()) displayMerge.SetScalarsData(probe.GetPolyDataOutput()) displayMerge.Update() displayWarp = vtk.vtkWarpScalar() displayWarp.SetInputData(displayMerge.GetPolyDataOutput()) displayWarp.SetNormal(0, 1, 0) displayWarp.SetScaleFactor(.000001) displayWarp.Update() displayMapper = vtk.vtkPolyDataMapper() displayMapper.SetInputData(displayWarp.GetPolyDataOutput()) displayMapper.SetScalarRange(output.GetScalarRange()) displayActor = vtk.vtkActor() displayActor.SetMapper(displayMapper) outline = vtk.vtkStructuredGridOutlineFilter() outline.SetInputData(output)
def __init__(self): # Create the RenderWindow, Renderer and both Actors self.renderer = vtk.vtkRenderer() self.renWin = vtk.vtkRenderWindow() self.renWin.AddRenderer(self.renderer) self.iren = vtk.vtkRenderWindowInteractor() self.iren.SetRenderWindow(self.renWin) self.iren.SetInteractorStyle(vtk.vtkInteractorStyleSwitch()) self.iren.GetInteractorStyle().SetCurrentStyleToTrackballCamera() # Start by loading some data. input_fname = sys.argv[1] if len(sys.argv) > 2: # selector have been provided self.selector = sys.argv[2] self.data = np.load(input_fname, mmap_mode='r') assert self.select_slice() else: # selector have NOT been provided self.selector = False self.data = np.load(input_fname) if not ( self.data.ndim == 2 ): # If dim not compatible with elevation, ask for a selector print('Incompatible data dimentionality : ', self.data.shape) self.selector = raw_input( 'Enter selector to cast input as 2D array (e.g. [42,:,:]) -> ' ) assert self.select_slice() convertor = npy_converter() self.image = convertor.convert(self.data) self.mi, self.ma = self.image.GetScalarRange() self.warp_factor = 0. self.warp_step = 0.001 geometry = vtk.vtkImageDataGeometryFilter() if vtk.vtkVersion.GetVTKMajorVersion() < 6: geometry.SetInput(self.image) else: geometry.SetInputData(self.image) self.warp = vtk.vtkWarpScalar() self.warp.SetInputConnection(geometry.GetOutputPort()) self.warp.SetScaleFactor(1) self.warp.UseNormalOn() self.warp.SetNormal(1, 0, 0) self.warp.Update() lut = vtk.vtkLookupTable() lut.SetTableRange(self.image.GetScalarRange()) lut.SetNumberOfColors(256) lut.SetHueRange(0.7, 0) lut.Build() merge = vtk.vtkMergeFilter() if vtk.vtkVersion.GetVTKMajorVersion() < 6: merge.SetGeometry(self.warp.GetOutput()) merge.SetScalars(self.image) else: merge.SetGeometryInputData(self.warp.GetOutput()) merge.SetScalarsData(self.image) merge.Update() self.outline = vtk.vtkOutlineFilter() self.outline.SetInputConnection(merge.GetOutputPort()) self.outline.Update() outlineMapper = vtk.vtkPolyDataMapper() if vtk.vtkVersion.GetVTKMajorVersion() < 6: outlineMapper.SetInputConnection(self.outline.GetOutputPort()) else: outlineMapper.SetInputData(self.outline.GetOutputDataObject(0)) box = vtk.vtkActor() box.SetMapper(outlineMapper) box.GetProperty().SetColor(0, 0, 0) self.renderer.AddActor(box) mapper = vtk.vtkPolyDataMapper() mapper.SetLookupTable(lut) mapper.SetScalarRange(self.image.GetScalarRange()) mapper.SetInputConnection(merge.GetOutputPort()) actor = vtk.vtkActor() actor.SetMapper(mapper) actor.GetProperty().ShadingOff() self.renderer.AddActor(actor) scalarBar = vtk.vtkScalarBarActor() scalarBar.SetTitle("") scalarBar.SetWidth(0.1) scalarBar.SetHeight(0.9) scalarBar.SetLookupTable(lut) #self.renderer.AddActor2D(scalarBar) self.build_axes() self.warp.SetScaleFactor(self.warp_factor) self.warp.Update() self.outline.Update() self.renderer.ResetCameraClippingRange() self.renderer.SetBackground(1, 1, 1) self.renWin.SetSize(500, 500) self.camera = self.renderer.GetActiveCamera() self.center_on_actor(actor) self.iren.AddObserver("CharEvent", self.on_keyboard_input) self.iren.Initialize() self.renWin.Render() self.iren.Start()
def main(argv): if len(argv) < 2: print "usage: ",argv[0]," <data> [flat]" exit(1) data_fn = argv[1] flat = False if len(argv) > 2: flat = True mapper = vtk.vtkPolyDataMapper() if data_fn.find('.vtk') != -1: reader = vtk.vtkPolyDataReader() reader.SetFileName(data_fn) reader.Update() data = reader.GetOutput() trianglize = vtk.vtkDelaunay2D() trianglize.SetInput(data) trianglize.Update() mapper.SetInputConnection(trianglize.GetOutputPort()) elif data_fn.find('.pgm') != -1: reader = vtk.vtkPNMReader() reader.SetFileName(data_fn) reader.Update() data = reader.GetOutput() geometry = vtk.vtkImageDataGeometryFilter() geometry.SetInputConnection(reader.GetOutputPort()) geometry.Update() if flat: merge = vtk.vtkMergeFilter() merge.SetGeometry(geometry.GetOutput()) merge.SetScalars(data) mapper.SetInputConnection(merge.GetOutputPort()) else: warp = vtk.vtkWarpScalar() warp.SetInputConnection(geometry.GetOutputPort()) warp.SetScaleFactor(0.3) # looked good warp.Update() merge = vtk.vtkMergeFilter() merge.SetGeometry(warp.GetOutput()) merge.SetScalars(data) mapper.SetInputConnection(merge.GetOutputPort()) elif data_fn.find('.dcm') != -1: reader =vtk.vtkDICOMImageReader() reader.SetFileName(data_fn) reader.Update() data = reader.GetOutput() geometry = vtk.vtkImageDataGeometryFilter() geometry.SetInput(data) geometry.Update() if flat: mapper.SetInputConnection(geometry.GetOutputPort()) else: warp = vtk.vtkWarpScalar() warp.SetInputConnection(geometry.GetOutputPort()) warp.Update() mapper.SetInputConnection(warp.GetOutputPort()) else: print "unrecognized data file:",data_fn exit(1) lut = vtk.vtkLookupTable() lut.SetNumberOfColors(10) lut.SetHueRange(0.5,0.3) lut.SetSaturationRange(0.6,0.5) lut.SetValueRange(1.0,0.5) lut.Build() mapper.ImmediateModeRenderingOff() mapper.SetLookupTable(lut) actor = vtk.vtkActor() actor.SetMapper(mapper) renderer = vtk.vtkRenderer() renderWindow = vtk.vtkRenderWindow() renderWindow.SetSize(700,700) renderWindow.AddRenderer(renderer) renderer.AddActor(actor) renderer.SetBackground(0.4,0.3,0.2) interactor = vtk.vtkRenderWindowInteractor() interactor.SetRenderWindow(renderWindow) renderWindow.Render() interactor.Start()
def elevation(self, data): self.data = data self.settings = wx.Panel(self) self.plot_type= self.type = 'elevation' self.image = self.array_to_2d_imagedata() geometry = vtk.vtkImageDataGeometryFilter() if vtk.vtkVersion.GetVTKMajorVersion()<6: geometry.SetInput(self.image) else: geometry.SetInputData(self.image) self.warp = vtk.vtkWarpScalar() self.warp.SetInputConnection(geometry.GetOutputPort()) self.warp.SetScaleFactor(1) self.warp.UseNormalOn() self.warp.SetNormal(0,0,1) self.warp.Update() lut =vtk.vtkLookupTable() lut.SetTableRange(self.image.GetScalarRange()) lut.SetNumberOfColors(256) lut.SetHueRange(0.7, 0) lut.Build() merge=vtk.vtkMergeFilter() if vtk.vtkVersion.GetVTKMajorVersion()<6: merge.SetGeometry(self.warp.GetOutput()) merge.SetScalars(self.image) else: merge.SetGeometryInputData(self.warp.GetOutput()) merge.SetScalarsData(self.image) merge.Update() self.outline = vtk.vtkOutlineFilter() self.outline.SetInputConnection(merge.GetOutputPort()) self.outline.Update() outlineMapper = vtk.vtkPolyDataMapper() if vtk.vtkVersion.GetVTKMajorVersion()<6: outlineMapper.SetInputConnection(self.outline.GetOutputPort()) else: outlineMapper.SetInputData(self.outline.GetOutputDataObject(0)) box=vtk.vtkActor() box.SetMapper(outlineMapper) box.GetProperty().SetColor(0,0,0) self.renderer.AddActor(box) self.actor_list.append(box) mapper=vtk.vtkPolyDataMapper() mapper.SetLookupTable(lut) mapper.SetScalarRange(self.image.GetScalarRange()) mapper.SetInputConnection(merge.GetOutputPort()) actor=vtk.vtkActor() actor.SetMapper(mapper) self.renderer.AddActor(actor) self.actor_list.append(actor) scalarBar = vtk.vtkScalarBarActor() scalarBar.SetTitle("") scalarBar.SetWidth(0.1) scalarBar.SetHeight(0.9) scalarBar.SetLookupTable(lut) self.renderer.AddActor2D(scalarBar) self.actor_list.append(scalarBar) self.build_axes(noZaxis = True) self.center_on_actor(actor) self.iren.Render() self.warp.SetScaleFactor(0) self.warp.Update() self.outline.Update() self.renderer.ResetCameraClippingRange() self.iren.Render() sb0 = wx.StaticBox(self.settings, wx.ID_ANY, label = "Scaling Panel") Sizer0 = wx.StaticBoxSizer(sb0, wx.HORIZONTAL) content1 = wx.StaticText(self.settings, -1, "X") self.x_Offset = wx.TextCtrl(self.settings, wx.ID_ANY, size = (45,27),style = wx.TE_PROCESS_ENTER ) self.Bind(wx.EVT_TEXT_ENTER, self.x_spacing_onmove ,self.x_Offset) self.x_Offset.SetValue('1.0') self.x_slider = wx.Slider(self.settings,id=wx.ID_ANY,value=100,minValue=0,maxValue=200, style= wx.SL_AUTOTICKS | wx.SL_HORIZONTAL | wx.SL_LABELS) self.x_slider.Bind(wx.EVT_SCROLL, self.x_spacing_onmove) content2 = wx.StaticText(self.settings, -1, "Y") self.y_Offset = wx.TextCtrl(self.settings, wx.ID_ANY,size = (45,27), style = wx.TE_PROCESS_ENTER ) self.Bind(wx.EVT_TEXT_ENTER, self.y_spacing_onmove ,self.y_Offset) self.y_Offset.SetValue('1.0') self.y_slider = wx.Slider(self.settings,id=wx.ID_ANY,value=100,minValue=0,maxValue=200, style= wx.SL_AUTOTICKS | wx.SL_HORIZONTAL | wx.SL_LABELS) self.y_slider.Bind(wx.EVT_SCROLL, self.y_spacing_onmove) sb1 = wx.StaticBox(self.settings, wx.ID_ANY, label = "Elevation Panel") Sizer1 = wx.StaticBoxSizer(sb1, wx.HORIZONTAL) content3 = wx.StaticText(self.settings, -1, "Warp") self.z_Offset = wx.TextCtrl(self.settings, wx.ID_ANY, size = (45,27),style = wx.TE_PROCESS_ENTER ) self.Bind(wx.EVT_TEXT_ENTER, self.z_spacing_onmove ,self.z_Offset) self.z_Offset.SetValue('1.0') self.z_slider = wx.Slider(self.settings,id=wx.ID_ANY,value=0,minValue=0,maxValue=100, style= wx.SL_HORIZONTAL ) self.z_slider.Bind(wx.EVT_SCROLL, self.z_spacing_onmove) # build sizer Sizer0.Add(content1, proportion=0, flag = wx.ALIGN_BOTTOM) Sizer0.Add(self.x_Offset,proportion=0, flag= wx.ALIGN_CENTER_VERTICAL) Sizer0.Add(self.x_slider,proportion=1, flag= wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) Sizer0.Add((20, -1),proportion= 0, flag= wx.ALIGN_CENTER_VERTICAL) Sizer0.Add(content2, proportion=0, flag = wx.ALIGN_CENTER_VERTICAL) Sizer0.Add(self.y_Offset,proportion=0, flag= wx.ALIGN_BOTTOM) Sizer0.Add(self.y_slider,proportion=1, flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) Sizer1.Add(content3, proportion=0, flag = wx.ALIGN_CENTER_VERTICAL) Sizer1.Add(self.z_Offset,proportion=0, flag= wx.ALIGN_CENTER_VERTICAL) Sizer1.Add(self.z_slider,proportion=1, flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) self.save_fig = wx.Button(self.settings, wx.ID_ANY, label="Save current view") self.save_fig.Bind(wx.EVT_BUTTON, self.Screen_shot) Sizer = wx.BoxSizer(wx.VERTICAL) HSizer = wx.BoxSizer(wx.HORIZONTAL) HSizer.Add(Sizer0, 1, wx.EXPAND, 0) HSizer.Add(Sizer1, 1, wx.EXPAND, 0) Sizer.Add(HSizer, 0, wx.EXPAND, 0) Sizer.Add(self.save_fig, 0, wx.EXPAND, 0) self.settings.SetSizer(Sizer) Sizer.Fit(self.settings) self.settings.Layout() self._mgr.AddPane(self.settings, wxaui.AuiPaneInfo().Center().Dock().Bottom().CloseButton(False).CaptionVisible(False)) self._mgr.Update()