From b577a3a4bd2609f87a5d4298e03d67bf97aaed3b Mon Sep 17 00:00:00 2001 From: valerio <valerio@5a81b35b-ba03-0410-adc8-b2c5c5119f08> Date: Mon, 21 Jun 2010 14:37:00 +0000 Subject: [PATCH] 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 --- examples/img/create_split_image.py | 3 ++- examples/img/fft_li.py | 7 ++++--- examples/img/modulate_image.py | 4 +++- examples/img/spoke_pattern.py | 4 ---- examples/img/view_phase_diff.py | 3 ++- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/examples/img/create_split_image.py b/examples/img/create_split_image.py index 30ae40808..1da640423 100644 --- a/examples/img/create_split_image.py +++ b/examples/img/create_split_image.py @@ -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) diff --git a/examples/img/fft_li.py b/examples/img/fft_li.py index 9ee75c6fb..73681183e 100644 --- a/examples/img/fft_li.py +++ b/examples/img/fft_li.py @@ -1,15 +1,16 @@ 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 diff --git a/examples/img/modulate_image.py b/examples/img/modulate_image.py index d81fd59cb..bed29c565 100644 --- a/examples/img/modulate_image.py +++ b/examples/img/modulate_image.py @@ -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 diff --git a/examples/img/spoke_pattern.py b/examples/img/spoke_pattern.py index 2e188f157..33a242c47 100644 --- a/examples/img/spoke_pattern.py +++ b/examples/img/spoke_pattern.py @@ -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 diff --git a/examples/img/view_phase_diff.py b/examples/img/view_phase_diff.py index 98de6364c..4a395a50b 100644 --- a/examples/img/view_phase_diff.py +++ b/examples/img/view_phase_diff.py @@ -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 -- GitLab