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

Module name change iplt -> img

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@1743 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 139a2ff4
Branches
Tags
No related merge requests found
Showing
with 64 additions and 41 deletions
......@@ -19,7 +19,7 @@ option(ENABLE_GUI "whether the graphical user interface should be enabled"
ON)
option(ENABLE_GFX "whether graphics support should be enabled"
ON)
option(ENABLE_IPLT "whether the image processing module should be compiled"
option(ENABLE_IMG "whether the image processing module should be compiled"
ON)
option(USE_DOUBLE_PRECISION "whether to compile in double precision"
OFF)
......@@ -72,10 +72,10 @@ else()
set(_SHADER OFF)
endif()
if (ENABLE_IPLT)
set(_IPLT ON)
if (ENABLE_IMG)
set(_IMG ON)
else()
set(_IPLT OFF)
set(_IMG OFF)
endif()
if (COMPOUND_LIB)
......@@ -184,7 +184,7 @@ find_package(PNG REQUIRED)
find_package(Eigen 2.0.0 REQUIRED)
find_package(Python 2.2.1 REQUIRED)
if (ENABLE_IPLT)
if (ENABLE_IMG)
find_package(FFTW REQUIRED)
find_package(TIFF REQUIRED)
endif()
......@@ -216,7 +216,7 @@ message(STATUS
"OpenStructure will be built with the following options:\n"
" Graphical interface (-DENABLE_UI) : ${_UI}\n"
" OpenGL support (-DENABLE_GFX) : ${_OPENGL}\n"
" Image Processing support (-DENABLE_IPLT) : ${_IPLT}\n"
" Image Processing support (-DENABLE_IMG) : ${_IMG}\n"
" Shader support (-DUSE_SHADER) : ${_SHADER}\n"
" Optimize (-DOPTIMIZE) : ${_OPT}\n"
" Double Precision (-DUSE_DOUBLE_PRECISION) : ${_DOUBLE_PREC}\n"
......
File moved
import sys
from math import *
from ost.iplt.alg import *
from ost.img.alg import *
from ost.geom import *
......@@ -30,8 +30,8 @@ def CreateSplitImage(imagelist, start_at_y=True):
if(start_angle<7.0*pi/4.0 and end_angle>7.0*pi/4.0):
pol.AddNode(Rotate(startpoint,7.0*pi/4.0))
pol.AddNode(Rotate(startpoint,end_angle))
m=iplt.Mask(pol)
result+=image.Apply(iplt.alg.MaskImage(m))
m=img.Mask(pol)
result+=image.Apply(img.alg.MaskImage(m))
count+=1
return result
......
import sys
import ost.iplt.alg
import ost.img.alg
images=io.LoadImageList(sys.argv[1:])
viewers=[]
i=1
for im in images:
im.CenterSpatialOrigin()
im.ApplyIP(iplt.alg.DFT())
im.ApplyIP(img.alg.DFT())
v=gui.CreateDataViewer(im)
v.SetName(sys.argv[i])
viewers.append(v)
......
import math
import ost.iplt.alg
import ost.img.alg
class modulator(iplt.RealFunction):
class modulator(img.RealFunction):
def __init__(self,f):
iplt.RealFunction.__init__(self)
img.RealFunction.__init__(self)
self.f = f
def Func(self,point):
return math.sin(point[0]*self.f)*math.sin(point[1]*self.f)
im = iplt.CreateImage(iplt.Size(400,200))
im.ApplyIP(iplt.alg.Randomize())
im = img.CreateImage(img.Size(400,200))
im.ApplyIP(img.alg.Randomize())
im2 = im * modulator( 0.1 )
im2.SetSpatialOrigin(iplt.Point(0,200))
im2.SetSpatialOrigin(img.Point(0,200))
im3 = iplt.CreateImage(iplt.Size(400,400))
im3 = img.CreateImage(img.Size(400,400))
im3.Paste(im)
im3.Paste(im2)
......
import math
import sys
import ost.iplt.alg
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.')
......@@ -16,7 +16,7 @@ threshold = 2.0 * Units.A # Threshold for low pass filtering
amplitude = 255 # amplitude of the obscillations
# Image is created
image=iplt.CreateImage(iplt.Size(size_of_image_x,size_of_image_y))
image=img.CreateImage(img.Size(size_of_image_x,size_of_image_y))
image.CenterSpatialOrigin()
image.SetSpatialSampling(pixel_sampling)
......@@ -36,10 +36,10 @@ for y in range (start_y,end_y+1):
factor=(0.5+outer_bands)*math.pi/half_wedge
if float(x)>-half_wedge and float(x)<half_wedge:
value=255*math.cos(float(x)*factor)
image.SetReal(iplt.Point(x,y),value)
image.SetReal(img.Point(x,y),value)
# Image is low-pass filtered
filter=ost.iplt.alg.GaussianLowPassFilter(threshold)
filter=ost.img.alg.GaussianLowPassFilter(threshold)
image.ApplyIP(filter)
# Image is saved
......
File moved
File moved
File moved
File moved
File moved
File moved
import sys
import math
import ost.iplt.alg
import ost.img.alg
image1=io.LoadImage(sys.argv[1])
image2=io.LoadImage(sys.argv[2])
......@@ -8,13 +8,13 @@ if image1.GetExtent() != image2.GetExtent():
raise RuntimeError('The input images should have the same size.')
image1.CenterSpatialOrigin()
image2.CenterSpatialOrigin()
image1.ApplyIP(ost.iplt.alg.DFT())
image2.ApplyIP(ost.iplt.alg.DFT())
ex_it=iplt.ExtentIterator(image1.GetExtent())
diff_image=iplt.CreateImage(image1.GetExtent())
image1.ApplyIP(ost.img.alg.DFT())
image2.ApplyIP(ost.img.alg.DFT())
ex_it=img.ExtentIterator(image1.GetExtent())
diff_image=img.CreateImage(image1.GetExtent())
for pixel in ex_it:
phase1=iplt.Phase(image1.GetComplex(pixel))
phase2=iplt.Phase(image2.GetComplex(pixel))
phase1=img.Phase(image1.GetComplex(pixel))
phase2=img.Phase(image2.GetComplex(pixel))
phase_diff=phase1-phase2
diff_image.SetReal(pixel,180.0*float(phase_diff)/math.pi)
v=gui.CreateDataViewer(diff_image)
......
import math,random
from ost import iplt
mh=iplt.CreateMap(iplt.Size(100, 25, 25))
for p in iplt.ExtentIterator(mh.GetExtent()):
from ost import img
mh=img.CreateMap(img.Size(100, 25, 25))
for p in img.ExtentIterator(mh.GetExtent()):
val=5*math.sin(0.4*math.sqrt(p[0]*p[0]+p[1]*p[1]))+7*math.cos(0.6*math.sqrt(p[2]*p[2]+p[1]*p[1]))
mh.SetReal(p,val*(1.0+0.0*random.random()))
......
import math,random
from ost import iplt
from ost import img
vmax=-10000.0
vmin=+10000.0
mh=iplt.CreateMap(iplt.Size(32,32,32))
for p in iplt.ExtentIterator(mh.GetExtent()):
mh=img.CreateMap(img.Size(32,32,32))
for p in img.ExtentIterator(mh.GetExtent()):
val=5*math.sin(0.4*math.sqrt(p[0]*p[0]+p[1]*p[1]))+7*math.cos(0.6*math.sqrt(p[2]*p[2]+p[1]*p[1]))
mh.SetReal(p,val)
vmin=min(vmin,val)
vmax=max(vmax,val)
print vmin, vmax
for p in iplt.ExtentIterator(mh.GetExtent()):
for p in img.ExtentIterator(mh.GetExtent()):
mh.SetReal(p,(mh.GetReal(p)-vmin)/(vmax-vmin))
pl = gfx.PrimList("box")
......
......@@ -26,6 +26,6 @@ except ImportError:
try:
from ost import iplt
from ost import img
except ImportError:
pass
......@@ -18,10 +18,10 @@ if (PROFILE)
else()
set(profiling_enabled 0)
endif()
if (ENABLE_IPLT)
set(iplt_enabled 1)
if (ENABLE_IMG)
set(img_enabled 1)
else()
set(iplt_enabled 0)
set(img_enabled 0)
endif()
if (_DOUBLE_PREC)
set(double_prec 1)
......
......@@ -26,7 +26,7 @@
#define OST_SHADER_SUPPORT_ENABLED @shader_support@
#define OST_PROFILING_ENABLED @profiling_enabled@
#define OST_ANIMATIONS_ENABLED @animations_enabled@
#define OST_IPLT_ENABLED @iplt_enabled@
#define OST_IMG_ENABLED @img_enabled@
#define OST_DOUBLE_PRECISION @double_prec@
#define OST_STATIC_PROPERTY_WORKAROUND @static_props@
#endif
......@@ -12,7 +12,7 @@ set(OST_GFX_PYMOD_SOURCES
export_color_ops.cc
)
if (ENABLE_IPLT)
if (ENABLE_IMG)
set(OST_GFX_PYMOD_SOURCES ${OST_GFX_PYMOD_SOURCES} export_map.cc)
endif()
......
......@@ -27,7 +27,7 @@ using namespace ost::gfx;
namespace ost_gfx {
#if OST_IPLT_ENABLED
#if OST_IMG_ENABLED
inline void color_by_01(GfxObj* go,
const mol::EntityView& ev,
const String& prop,
......@@ -37,7 +37,7 @@ inline void color_by_01(GfxObj* go,
}
inline void color_by_02(GfxObj* go,
const ::iplt::MapHandle& mh,
const ::img::MapHandle& mh,
const String& prop,
const Gradient& g, float minv, float maxv)
{
......@@ -46,7 +46,7 @@ inline void color_by_02(GfxObj* go,
inline void color_by_11(GfxObj* go,
const ::iplt::MapHandle& mh,
const ::img::MapHandle& mh,
const String& prop,
const Gradient& g)
{
......@@ -54,7 +54,7 @@ inline void color_by_11(GfxObj* go,
}
inline void color_by_12(GfxObj* go,
const ::iplt::MapHandle& mh,
const ::img::MapHandle& mh,
const String& prop,
const Color& c1, const Color& c2)
{
......@@ -63,7 +63,7 @@ inline void color_by_12(GfxObj* go,
inline void color_by_04(GfxObj* go,
const ::iplt::MapHandle& mh,
const ::img::MapHandle& mh,
const String& prop,
const Color& c1, const Color& c2, float minv, float maxv)
{
......@@ -140,7 +140,7 @@ inline void color_by_10(GfxObj* go,
.def("ColorBy",ost_gfx::color_by_09)\
.def("ColorBy",ost_gfx::color_by_10)
#if OST_IPLT_ENABLED
#if OST_IMG_ENABLED
# define COLOR_BY_DEF_MAP() \
.def("ColorBy",ost_gfx::color_by_01)\
.def("ColorBy",ost_gfx::color_by_02)\
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment