diff --git a/examples/img/create_split_image.py b/examples/img/create_split_image.py index 084244455aa1de3a693cfb13297556c161c1c899..30ae4080888ad6d2932f9ac860cea2ffcadb5e52 100644 --- a/examples/img/create_split_image.py +++ b/examples/img/create_split_image.py @@ -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]) diff --git a/examples/img/fft_li.py b/examples/img/fft_li.py index f272d4c22f52cd0746db2bb4d4e4e07d1468c0e3..983a45c92a4805501369b1a6e1c0237ea49d1a69 100644 --- a/examples/img/fft_li.py +++ b/examples/img/fft_li.py @@ -1,7 +1,9 @@ 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: diff --git a/examples/img/spoke_pattern.py b/examples/img/spoke_pattern.py index 7a11e42a1e60a0337e96ce01dac6e9c701c03618..2e188f157303be03a2f03c0659361d15a35970c4 100644 --- a/examples/img/spoke_pattern.py +++ b/examples/img/spoke_pattern.py @@ -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 diff --git a/examples/img/view_phase_diff.py b/examples/img/view_phase_diff.py index 0228a0e02fcc36190d8308940409b58daf0e0f00..98de6364c9797d9e69949590ea78c71b9bb4c3f6 100644 --- a/examples/img/view_phase_diff.py +++ b/examples/img/view_phase_diff.py @@ -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() diff --git a/examples/misc/ambient_occlusion.py b/examples/misc/ambient_occlusion.py deleted file mode 100644 index 3ed9da4e8c072a70a20e7d02489064c0f0b511fe..0000000000000000000000000000000000000000 --- a/examples/misc/ambient_occlusion.py +++ /dev/null @@ -1,53 +0,0 @@ -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() diff --git a/examples/seq/seq_viewer.py b/examples/seq/seq_viewer.py index 2d52392538ffe8bb8df25093f087535f928ece7b..1ca2535e805a2b00cf0dcaff5fd8cea1a178163c 100644 --- a/examples/seq/seq_viewer.py +++ b/examples/seq/seq_viewer.py @@ -1,4 +1,4 @@ aln=io.LoadAlignment('sh2.aln') -v=gui.SequenceViewerV2() +v=gui.SequenceViewer() v.AddAlignment(aln) v.Show() diff --git a/examples/trj/test_trj.py b/examples/trj/test_trj.py index ae23e827465a0580c6e33f69a4c256a7f6b11366..0c3ed1f310eacb6e6e2a2dcc03af26a3aa077258 100644 --- a/examples/trj/test_trj.py +++ b/examples/trj/test_trj.py @@ -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) diff --git a/examples/trj/test_trj_blur.py b/examples/trj/test_trj_blur.py index dbbab5f8d1676c3febd75beed47b5b849fe3cf44..2a762bda8fa11fcafb498db87c36ee6396383a28 100644 --- a/examples/trj/test_trj_blur.py +++ b/examples/trj/test_trj_blur.py @@ -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)