Skip to content
Snippets Groups Projects
Commit fa2d9dad authored by marco's avatar marco
Browse files

unbreak examples and make sure they run from dng

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2397 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent edb95a98
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,11 @@ def CreateSplitImage(imagelist, start_at_y=True):
count+=1
return result
imagelist=io.LoadImageList(sys.argv[1:-1])
if len(sys.argv)<3:
imagelist=io.LoadImageList(['circle.png', 'square.png'])
else:
imagelist=io.LoadImageList(sys.argv[1:-1])
result=CreateSplitImage(imagelist)
v_result=gui.CreateDataViewer(result)
io.SaveImage(result,sys.argv[-1])
import sys
import ost.img.alg
images=io.LoadImageList(sys.argv[1:])
if len(sys.argv)<2:
images=io.LoadImageList(['square.png'])
else:
images=io.LoadImageList(sys.argv[1:])
viewers=[]
i=1
for im in images:
......
......@@ -2,15 +2,12 @@ import math
import sys
import ost.img.alg
if len(sys.argv)!=2:
raise RuntimeError('Wrong number of command line arguments. The name of the output file should be the only argument.')
# Tweakable parameters
wedge_start = 80 # Width of wedge at the narrower point
wedge_end = 2000 # Width of wedge at the broader point
wedge_start = 20 # Width of wedge at the narrower point
wedge_end = 500 # Width of wedge at the broader point
number_of_bands = 11 # Number of alternating bands (must be odd)
size_of_image_x = 2000 # Size of the image (X)
size_of_image_y = 2000 # Size of the image (Y)
size_of_image_x = 500 # Size of the image (X)
size_of_image_y = 500 # Size of the image (Y)
pixel_sampling = 1.0 * Units.A # Pixel width
threshold = 2.0 * Units.A # Threshold for low pass filtering
amplitude = 255 # amplitude of the obscillations
......@@ -43,7 +40,8 @@ filter=ost.img.alg.GaussianLowPassFilter(threshold)
image.ApplyIP(filter)
# Image is saved
io.SaveImage(image,sys.argv[1])
if len(sys.argv)==2:
io.SaveImage(image,sys.argv[1])
# Viewer is launched to show the result
v=gui.CreateDataViewer(image)
\ No newline at end of file
......@@ -2,8 +2,12 @@ import sys
import math
import ost.img.alg
image1=io.LoadImage(sys.argv[1])
image2=io.LoadImage(sys.argv[2])
if len(sys.argv)==2:
image1=io.LoadImage(sys.argv[1])
image2=io.LoadImage(sys.argv[2])
else:
image1=io.LoadImage('square.png')
image2=io.LoadImage('circle.png')
if image1.GetExtent() != image2.GetExtent():
raise RuntimeError('The input images should have the same size.')
image1.CenterSpatialOrigin()
......
def test1():
global surf
prot=io.LoadPDB("fragment.pdb")
surf=io.LoadSurface("fragment","msms")
surf.Attach(prot,5.0)
scene.Add(gfx.Surface("surf",surf))
scene["surf"].SetColor(gfx.RED,"ele=O")
scene["surf"].SetColor(gfx.BLUE,"ele=N")
scene.CenterOn("surf")
scene.SetFog(False)
# turn on full contribution from light
scene.SetLightProp(1,1,1)
# use a material with 10% global ambient light,
# 90% diffuse light, and full specular with small
# hilights
scene["surf"].SetMat(0.1,0.9,1,128)
# turn on ambient occlusion
# this may take seconds to calculate
scene["surf"].AmbientOcclusion(True)
# blend the ambient occlusion 100% into the surface,
# reducing the color intensity
scene["surf"].AmbientOcclusionWeight(1)
# blend the local color 30% percent into the surface
scene["surf"].AmbientLocalWeight(0.3)
scene.AutoAutoslab(False)
scene.Autoslab()
def test2():
global plist
plist=gfx.PrimList("t")
plist.AddPoint(geom.Vec3(-1,-1,0), gfx.RED)
plist.AddPoint(geom.Vec3(1,-1,0), gfx.GREEN)
plist.AddPoint(geom.Vec3(1,1,0), gfx.YELLOW)
plist.AddPoint(geom.Vec3(-1,1,0), gfx.BLUE)
plist.AddPoint(geom.Vec3(0,0,4), gfx.MAGENTA)
plist.SetMat(1,1,1,64)
scene.SetLightProp(0,1,0)
plist.SetRadius(1.5)
plist.SetSphereDetail(4)
plist.SetRenderMode(gfx.CUSTOM)
plist.AmbientOcclusion(True)
scene.Add(plist)
scene.CenterOn(plist)
scene.AutoAutoslab(False)
scene.Autoslab()
plist.AmbientOcclusion(True)
test1()
aln=io.LoadAlignment('sh2.aln')
v=gui.SequenceViewerV2()
v=gui.SequenceViewer()
v.AddAlignment(aln)
v.Show()
......@@ -26,6 +26,4 @@ scene.SetCenter(go.GetCenter())
scene.AutoAutoslab(True)
anim=Anim(cg,go)
print "enter anim.start(10) to start trajectory animation; use anim.stop() to turn it off again."
anim.start(10)
......@@ -29,6 +29,4 @@ scene.SetCenter(go.GetCenter())
scene.AutoAutoslab(True)
anim=Anim(cg,go)
print "enter anim.start(10) to start trajectory animation; use anim.stop() to turn it off again."
anim.start(10)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment