Text archives Help
- From: brownlee@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [Manta] r2032 - in trunk: Interface Model/Materials SwigInterface scenes/csafe/python scenes/csafe/src scenes/csafe/swig
- Date: Tue, 5 Feb 2008 20:35:40 -0700 (MST)
Author: brownlee
Date: Tue Feb 5 20:35:36 2008
New Revision: 2032
Modified:
trunk/Interface/Scene.cc
trunk/Interface/Scene.h
trunk/Model/Materials/Volume.h
trunk/SwigInterface/manta.i
trunk/scenes/csafe/python/Configuration.py
trunk/scenes/csafe/python/Histogram.py
trunk/scenes/csafe/python/SceneInfo.py
trunk/scenes/csafe/python/csafe_demo.cfg
trunk/scenes/csafe/python/csafe_demo.py
trunk/scenes/csafe/src/CDSWIGIFY.h
trunk/scenes/csafe/swig/csafe.i
Log:
fixed compile error with swig, quieted some warnings from csafe demo, added
nrrdlist loading and better quit functionality to the interface
Modified: trunk/Interface/Scene.cc
==============================================================================
--- trunk/Interface/Scene.cc (original)
+++ trunk/Interface/Scene.cc Tue Feb 5 20:35:36 2008
@@ -62,11 +62,11 @@
}
namespace Manta {
- MANTA_DECLARE_RTTI_BASECLASS(Scene::Bookmark, ConcreteClass,
readwriteMethod);
- MANTA_REGISTER_CLASS(Scene::Bookmark);
+ MANTA_DECLARE_RTTI_BASECLASS(Bookmark, ConcreteClass, readwriteMethod);
+ MANTA_REGISTER_CLASS(Bookmark);
}
-void Scene::Bookmark::readwrite(ArchiveElement* archive)
+void Bookmark::readwrite(ArchiveElement* archive)
{
archive->readwrite("name", name);
archive->readwrite("cameradata", cameradata);
Modified: trunk/Interface/Scene.h
==============================================================================
--- trunk/Interface/Scene.h (original)
+++ trunk/Interface/Scene.h Tue Feb 5 20:35:36 2008
@@ -8,6 +8,16 @@
#include <vector>
namespace Manta {
+ class Scene;
+ class ArchiveElement;
+ struct Bookmark {
+ void readwrite(ArchiveElement* archive);
+ private:
+ friend class Scene;
+ std::string name;
+ BasicCameraData cameradata;
+ };
+
class Archive;
class Background;
class LightSet;
@@ -81,14 +91,7 @@
}
void readwrite(ArchiveElement*);
- struct Bookmark {
- void readwrite(ArchiveElement* archive);
- private:
- friend class Scene;
- std::string name;
- BasicCameraData cameradata;
- };
-
+
void setAnimationStartTime(double start) {
animationStartTime = start;
}
Modified: trunk/Model/Materials/Volume.h
==============================================================================
--- trunk/Model/Materials/Volume.h (original)
+++ trunk/Model/Materials/Volume.h Tue Feb 5 20:35:36 2008
@@ -36,6 +36,7 @@
namespace Manta
{
+
struct RGBAColor
{
RGBAColor(Color c, float opacity) : color(c), a(opacity) {}
@@ -146,17 +147,21 @@
inline bool operator & (const VMCell& v) {
return (course_hash & v.course_hash) != 0;
}
- void print(bool print_endl = true) {
+ friend ostream& operator<<(ostream& out,const VMCell& cell) {
for( int i = 0; i < 64; i++) {
- unsigned long long bit= course_hash & (1ULL << i);
+ unsigned long long bit= cell.course_hash & (1ULL << i);
if (bit)
- cout << "1";
+ out << "1";
else
- cout << "0";
+ out << "0";
}
- if (print_endl) cout << endl;
+ return out;
}
};
+ struct CellData {
+ VMCell cell;
+ };
+
const int packetSize = 32; //TODO: look this up
const int numPacklets = 32/4;
struct RayPacketInfo {
@@ -220,10 +225,6 @@
static float resolutionFactor;
float splitLength; //above this length we split packets.
-
- struct CellData {
- VMCell cell;
- };
vector <CellData> cellVector;
Modified: trunk/SwigInterface/manta.i
==============================================================================
--- trunk/SwigInterface/manta.i (original)
+++ trunk/SwigInterface/manta.i Tue Feb 5 20:35:36 2008
@@ -285,6 +285,7 @@
%}
//TODO: these are quick fixes, should actually fix these functions with SWIG
-Carson
+%ignore Manta::DynBVH::firstIntersects;
%ignore Manta::DynBVH::finishUpdate;
%ignore Manta::DynBVH::parallelTopDownUpdate;
Modified: trunk/scenes/csafe/python/Configuration.py
==============================================================================
--- trunk/scenes/csafe/python/Configuration.py (original)
+++ trunk/scenes/csafe/python/Configuration.py Tue Feb 5 20:35:36 2008
@@ -1,5 +1,5 @@
-import sys, os, time, traceback, types
+import sys, os, time, traceback, types, random
import wx
import SceneInfo
import Histogram
@@ -157,3 +157,29 @@
scene.nrrdFiles.append(lines[i].strip())
scene.frame.LayoutWindow()
print "Done reading Configuration file"
+
+
+def ReadNRRDList(scene, filename):
+ f = open(filename, 'r')
+
+ ###clear old values
+ scene.nrrdFiles = []
+ scene.nrrdFiles2 = []
+
+ ###read in new values
+ lines = f.readlines()
+ for i in range(len(lines)-1):
+ vol = lines[i].strip()
+ i+=1
+ sphere = lines[i].strip()
+ scene.nrrdFiles.append(sphere)
+ scene.nrrdFiles2.append(vol)
+
+def WriteNRRDList(scene, filename):
+ f = open(filename, 'w')
+ if (len(scene.nrrdFiles) != len(scene.nrrdFiles2)):
+ print "ERROR: nrrdlists need to have the same number of
sphere and volume files"
+ else:
+ for i in range(len(scene.nrrdFiles)):
+ f.write(str(scene.nrrdFiles2[i])+"\n")
+ f.write(str(scene.nrrdFiles[i])+"\n")
Modified: trunk/scenes/csafe/python/Histogram.py
==============================================================================
--- trunk/scenes/csafe/python/Histogram.py (original)
+++ trunk/scenes/csafe/python/Histogram.py Tue Feb 5 20:35:36 2008
@@ -46,9 +46,9 @@
self.dragWidth = 1.0
self.cropMin = 0.0 #selected region from [0,1]
self.cropMax = 1.0
- if (varIndex == 3): #TODO: take this out!
- self.cropMin = -0.5
- self.cropMax = 1.5;
+ #if (varIndex == 3): #TODO: take this out!
+ # self.cropMin = -0.5
+ # self.cropMax = 1.5;
self.colorMin = -99999.0
self.colorMax = 99999.0
self.dMin = dataMin
@@ -602,7 +602,6 @@
self.parent.GetSizer().Layout()
self.parent.Refresh()
else:
- print "clicked"
#self.SetSizer(self.vs)
#self.vs.Fit(self)
#self.vs.Clear(False)
Modified: trunk/scenes/csafe/python/SceneInfo.py
==============================================================================
--- trunk/scenes/csafe/python/SceneInfo.py (original)
+++ trunk/scenes/csafe/python/SceneInfo.py Tue Feb 5 20:35:36 2008
@@ -15,4 +15,4 @@
self.sceneName = "Untitled"
self.sceneWD = "/"
self.histogramBMPLoaded = False
-
+ self.bgColor = wx.Colour(90,90,90)
Modified: trunk/scenes/csafe/python/csafe_demo.cfg
==============================================================================
--- trunk/scenes/csafe/python/csafe_demo.cfg (original)
+++ trunk/scenes/csafe/python/csafe_demo.cfg Tue Feb 5 20:35:36 2008
@@ -276,6 +276,6 @@
4
8
1
-/home/collab/brownlee/Data-Explosion/vol/temp_CC_M02_0002.nrrd
+/home/sci/brownlee/Data-Explosion/vol/temp_CC_M02_0002.nrrd
1
-/home/collab/brownlee/Data-Explosion/sphere/spheredata002.crop.nhdr
+/home/sci/brownlee/Data-Explosion/sphere/spheredata002.crop.nhdr
Modified: trunk/scenes/csafe/python/csafe_demo.py
==============================================================================
--- trunk/scenes/csafe/python/csafe_demo.py (original)
+++ trunk/scenes/csafe/python/csafe_demo.py Tue Feb 5 20:35:36 2008
@@ -59,18 +59,21 @@
class MyFrame(wx.Frame):
def __init__(self, parent, ID, title):
wx.Frame.__init__(self, parent, ID, title,
- wx.DefaultPosition, wx.Size(200, 150))
- self.SetForegroundColour(wx.Colour(255,0,0))
- self.SetBackgroundColour(wx.Colour(90,90,90))
+ wx.DefaultPosition, wx.Size(200, 150))
self.scene = SceneInfo.Scene()
+ #self.SetForegroundColour(wx.Colour(255,0,0))
+ self.SetBackgroundColour(self.scene.bgColor)
menuBar = wx.MenuBar()
menuFile = wx.Menu()
menuFile.Append(101, "&About", "")
menuFile.Append(102, "&Save", "")
menuFile.Append(103, "Save As...", "")
menuFile.Append(104, "Load", "")
+ menuFile.Append(107, "Import NrrdList")
+ menuFile.Append(108, "Export NrrdList")
+ menuFile.Append(106, "Import Transfer Function")
menuFile.Append(105, "Export Transfer Function")
- menuFile.Append(106, "Import Transfer Function")
+ menuFile.Append(109, "&Quit", "")
menuBar.Append(menuFile, "File")
menuScene = wx.Menu()
@@ -92,8 +95,12 @@
self.Bind(wx.EVT_MENU, self.Menu106, id=106)
self.Bind(wx.EVT_MENU, self.Menu201, id=201)
self.Bind(wx.EVT_MENU, self.Menu202, id=202)
+ self.Bind(wx.EVT_MENU, self.Menu107, id=107)
+ self.Bind(wx.EVT_MENU, self.Menu108, id=108)
+ self.Bind(wx.EVT_MENU, self.Menu109, id=109)
self.Bind(wx.EVT_MENU, self.Menu203, id=203)
self.Bind(wx.EVT_MENU, self.Menu204, id=204)
+ self.SetBackgroundColour(self.scene.bgColor)
def Menu101(self, evt):
self.log.write("about")
@@ -128,19 +135,48 @@
self.scene.sceneName = dlg.GetFilename()
print "filename: " + self.scene.sceneName
+ ################ Export Transfer Function #################
def Menu105(self,evt):
self.log.write("export transfer function")
+ ################ Import Transfer Function #################
def Menu106(self,evt):
self.log.write("import transfer function")
+
+ ################ Import NRRDLIST #################
+ def Menu107(self, e):
+ dlg = wx.FileDialog(self, message="Open file",
+ defaultDir=os.getcwd(),
+ defaultFile="",
+ wildcard="*",
+ style=wx.OPEN|wx.CHANGE_DIR)
+ if dlg.ShowModal() == wx.ID_OK:
+ filename = dlg.GetPath()
+ Configuration.ReadNRRDList(self.scene, filename)
+
+ ################ Export NRRDLIST #################
+ def Menu108(self, e):
+ dlg = wx.FileDialog(self, message="Save file as...",
defaultDir=os.getcwd(),
+ defaultFile="", wildcard="*", style=wx.SAVE)
+ if dlg.ShowModal() == wx.ID_OK:
+ path = dlg.GetPath()
+ Configuration.WriteNRRDList(self.scene, path)
+
+ ################ Quit #################
+ def Menu109(self, e):
+ exit()
+ ################ Add/Remove Files #################
def Menu201(self, evt):
frame = SceneMenus.AddRemoveFilesFrame(self, -1, "Add/Remove Files",
self.scene)
frame.Show(True)
+ ################ Scene Properties #################
def Menu202(self, evt):
frame = SceneMenus.ScenePropertiesFrame(self, -1, "Scene Properties",
self.scene)
frame.Show(True)
+
+ ################ Generate Scene #################
def Menu203(self, evt):
self.BuildScene()
@@ -240,7 +276,6 @@
def InitializeScene(self,frame, engine):
# Create a scene object.
- print "warg?\n";
scene = manta_new(Scene())
eye = manta_new(Vector(0.340429, 0.161851, -0.441882))
lookat = manta_new( Vector( 0.0411403, 0.0475211, 0.0508046))
@@ -340,14 +375,14 @@
self.tPanel = tPanel = TransferF.TransferFGroup(self, 300, 100,
self.defaultTransferF, "empty")
self.scene.tPanel = tPanel
- tPanel.SetBackgroundColour(wx.Colour(90,90,90))
+ tPanel.SetBackgroundColour(self.scene.bgColor)
self.Bind(wx.EVT_LEFT_DOWN, self.OnKeyDown)
self.vs = vs = wx.BoxSizer( wx.VERTICAL )
data = []
for i in range(0, 1000):
data.append(( random.random() + random.random())/2.0 + 0.0)
- color = wx.Colour(90,90,90)
+ color = self.scene.bgColor
self.scene.histoVS = hvs = wx.BoxSizer(wx.VERTICAL)
self.scene.frame = self
histoGroup0 = Histogram.HistogramGroup(self, histValues1, dataMin1,
dataMax1, 300, 40.0, t0, tPanel, self.scene, 8, "volume")
@@ -395,16 +430,20 @@
hvs.Add(self.tPanel, 0, wx.ALIGN_CENTRE|wx.ALL, 1 )
vs.Add(hvs,0,wx.ALIGN_CENTER|wx.ALL,1)
+ hvs2 = wx.BoxSizer(wx.VERTICAL)
animCtrlTitle = wx.StaticBox(self, -1)
animCtrlSizer = wx.StaticBoxSizer(animCtrlTitle, wx.HORIZONTAL)
animCtrlSizer.Add(self.backB, -1, wx.ALIGN_CENTRE, 1)
animCtrlSizer.Add(self.playB, -1, wx.ALIGN_CENTRE, 1)
animCtrlSizer.Add(self.forwardB, -1, wx.ALIGN_CENTRE, 1)
- vs.Add(animCtrlSizer, wx.ALIGN_CENTRE, 5)
+ hvs2.Add(animCtrlSizer, wx.ALIGN_CENTER|wx.ALL,1)
+ vs.Add(hvs2, wx.ALIGN_CENTRE|wx.ALL, 5)
+ vs.AddSpacer(100,100)
vs.Layout()
self.SetSizer(vs)
vs.Fit(self)
+ self.SetBackgroundColour(self.scene.bgColor)
self.Refresh()
def OnClickBack(self, evt):
@@ -428,9 +467,9 @@
self.test.forwardAnimation()
def initialize_scene( frame, engine ):
- frame = MyFrame(None, -1, "Histogram")
+ frame = MyFrame(None, -1, "CSAFE Demo")
frame.Show(True)
- frame.InitializeScene(frame, engine)
+ frame.InitializeScene(frame, engine)
def usage():
Modified: trunk/scenes/csafe/src/CDSWIGIFY.h
==============================================================================
--- trunk/scenes/csafe/src/CDSWIGIFY.h (original)
+++ trunk/scenes/csafe/src/CDSWIGIFY.h Tue Feb 5 20:35:36 2008
@@ -5,6 +5,7 @@
*/
#include <Interface/MantaInterface.h>
+#include <Core/Color/Color.h>
using namespace Manta;
int* SWIGIFYCreateIntArray(int size)
Modified: trunk/scenes/csafe/swig/csafe.i
==============================================================================
--- trunk/scenes/csafe/swig/csafe.i (original)
+++ trunk/scenes/csafe/swig/csafe.i Tue Feb 5 20:35:36 2008
@@ -32,9 +32,7 @@
*/
%module csafe
-%{
-#include <vector.h>
-%}
+#pragma SWIG nowarn=401,503,512
%include "std_string.i"
%include "std_vector.i"
@@ -57,19 +55,32 @@
class AccelerationStructure;
class OpaqueShadower;
class LitMaterial;
+ class RGBAColorMap;
+ //class AlignedAllocator<class T>;
};
%}
%import mantainterface.i
-%{
+//namespace Manta {
+// %template(AlignedAllocator_Volume_float)
Manta::AlignedAllocator<Manta::Volume<float> >;
+// %template(AlignedAllocator_Box4) Manta::AlignedAllocator<Manta::Box4>;
+//}
+%warnfilter(401) Manta::Box4;
+//%warnfilter(503) Volume;
+%{
#include <Model/Materials/Volume.h>
#include <CDSWIGIFY.h>
#include <CDTest.h>
+//#include <Core/Util/AlignedAllocator.h>
%}
-%template(vector_ColorSlice) ::std::vector<ColorSlice>;
+//%ignore Manta::Volume;
+//%ignore Manta::AlignedAllocator;
+%ignore Manta::Box4;
%include <CDTest.h>
%include <Model/Materials/Volume.h>
%include <CDSWIGIFY.h>
+%template(vector_ColorSlice) ::std::vector<ColorSlice>;
+
- [Manta] r2032 - in trunk: Interface Model/Materials SwigInterface scenes/csafe/python scenes/csafe/src scenes/csafe/swig, brownlee, 02/05/2008
Archive powered by MHonArc 2.6.16.