Skip to content
Snippets Groups Projects
Commit b577a3a4 authored by valerio's avatar valerio
Browse files

Improved img examples

Now they open in the MDI and throw no exceptions

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2429 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 82d6e837
Branches
Tags
No related merge requests found
......@@ -42,4 +42,5 @@ else:
result=CreateSplitImage(imagelist)
v_result=gui.CreateDataViewer(result)
io.SaveImage(result,sys.argv[-1])
main_area=gui.GostyApp.Instance().perspective.main_area
main_area.AddWidget("Split Image", v_result)
import sys
import ost.img.alg
if len(sys.argv)<2:
images=io.LoadImageList(['square.png'])
images=io.LoadImageList(['square.png','circle.png'])
else:
images=io.LoadImageList(sys.argv[1:])
viewers=[]
i=1
main_area=gui.GostyApp.Instance().perspective.main_area
for im in images:
im.CenterSpatialOrigin()
im.ApplyIP(img.alg.DFT())
v=gui.CreateDataViewer(im)
v.SetName(sys.argv[i])
viewers.append(v)
i+=1
main_area.AddWidget('Image' + str(i), v)
i+=1
\ No newline at end of file
......@@ -20,4 +20,6 @@ im3 = img.CreateImage(img.Size(400,400))
im3.Paste(im)
im3.Paste(im2)
v=gui.CreateDataViewer(im3)
\ No newline at end of file
v=gui.CreateDataViewer(im3)
main_area=gui.GostyApp.Instance().perspective.main_area
main_area.AddWidget("Modulated Image", v)
\ No newline at end of file
......@@ -39,9 +39,5 @@ for y in range (start_y,end_y+1):
filter=ost.img.alg.GaussianLowPassFilter(threshold)
image.ApplyIP(filter)
# Image is saved
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
......@@ -22,4 +22,5 @@ for pixel in ex_it:
phase_diff=phase1-phase2
diff_image.SetReal(pixel,180.0*float(phase_diff)/math.pi)
v=gui.CreateDataViewer(diff_image)
v.SetName("Phase difference (in degrees)")
main_area=gui.GostyApp.Instance().perspective.main_area
main_area.AddWidget("Phase difference (in degrees)", v)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment