Text archives Help
- From:
- To:
- Subject: [Manta] r2351 - in trunk: Model/Readers StandAlone SwigInterface scenes/csafe/python
- Date: Fri, 5 Dec 2008 17:43:15 -0700 (MST)
Author: dav
Date: Fri Dec 5 17:43:12 2008
New Revision: 2351
Modified:
trunk/Model/Readers/VolumeNRRD.h
trunk/StandAlone/manta.cc
trunk/SwigInterface/CMakeLists.txt
trunk/scenes/csafe/python/Configuration.py
trunk/scenes/csafe/python/Histogram.py
trunk/scenes/csafe/python/csafe_demo.py
Log:
M scenes/csafe/python/Histogram.py
* Better tooltip.
M scenes/csafe/python/csafe_demo.py
* Add some initial help pages.
* Default saving to the directory that the app was run from.
* Better command line arg parsing.
* Fix error where "Generate" was disabled after .cfg was read.
M scenes/csafe/python/Configuration.py
* Removed the evil tabs...
* Handle missing config file error better.
* Validate that the NRRDs read in the .cfg file exist.
M StandAlone/manta.cc
* At least report an error (warning?) when an invalid arg is found... even if
we can't exit.
M SwigInterface/CMakeLists.txt
* CMake now barfs if SWIG isn't new enough (1.3.23+)
M Model/Readers/VolumeNRRD.h
* It is an 'error' if we die after the message, not a warning. ;)
* Removed some evil 'endl's.
Modified: trunk/Model/Readers/VolumeNRRD.h
==============================================================================
--- trunk/Model/Readers/VolumeNRRD.h (original)
+++ trunk/Model/Readers/VolumeNRRD.h Fri Dec 5 17:43:12 2008
@@ -21,31 +21,31 @@
GridArray3<T>* loadNRRDToGrid(std::string file,
std::vector<std::pair<std::string, std::string> >* keyValuePairs = NULL )
{
GridArray3<T>* grid = new GridArray3<T>();
- cout << "READING NRRD: " << file << " ";
+ cout << "READING NRRD: " << file << "\n";
Nrrd *new_nrrd = nrrdNew();
////////////////////////////////////////////////////////////////////////////
// Attempt to open the nrrd
if (nrrdLoad( new_nrrd, file.c_str(), 0 )) {
- char *reason = biffGetDone( NRRD );
- std::cout << "WARNING Loading Nrrd Failed: " << reason << std::endl;
+ char * reason = biffGetDone( NRRD );
+ std::cout << "ERROR: Loading Nrrd Failed: " << reason << "\n";
exit(__LINE__);
}
// Check to make sure the nrrd is the proper dimensions.
if (new_nrrd->dim != 3) {
- std::cout << "WARNING Nrrd must three dimension RGB" << std::endl;
- exit(__LINE__);
+ std::cout << "\nERROR Nrrd must by a three dimension RGB.\n\n";
+ exit(__LINE__);
}
// Check that the nrrd is the correct type.
// if (new_nrrd->type != nrrdTypeFloat) {
- // std::cout << "WARNING Nrrd must be type nrrdTypeDouble" <<
std::endl;
+ // std::cout << "ERROR Nrrd must be type nrrdTypeDouble" <<
std::endl;
// exit(__LINE__);
// }
// Check that the nrrd could be a RGBA volume.
// if (new_nrrd->axis[0].size != 3) {
- // std::cout << "WARNING Nrrd first axis must be RGB size 3."
<< std::endl;
+ // std::cout << "ERROR Nrrd first axis must be RGB size 3." <<
std::endl;
// exit(__LINE__);
// }
Modified: trunk/StandAlone/manta.cc
==============================================================================
--- trunk/StandAlone/manta.cc (original)
+++ trunk/StandAlone/manta.cc Fri Dec 5 17:43:12 2008
@@ -440,15 +440,15 @@
usage(factory);
}
}
-#if 0
else {
// We should barf about unknown commands. For the stack stuff,
args
// should probably be parsed out some other way instead of on the
// general command line.
- cerr << "ERROR: Unknown argument\n";
+ cerr << "ERROR: Unknown argument: " << arg << "\n";
+#if 0
throw IllegalArgument( string(argv[0]), i, args );
- }
#endif
+ }
}
}
catch (Exception& e) {
Modified: trunk/SwigInterface/CMakeLists.txt
==============================================================================
--- trunk/SwigInterface/CMakeLists.txt (original)
+++ trunk/SwigInterface/CMakeLists.txt Fri Dec 5 17:43:12 2008
@@ -24,6 +24,12 @@
STRING(REGEX MATCH "SWIG Version ${MANTA_THREE_PART_VERSION_REGEX}"
version-string ${swig-output})
STRING(REGEX MATCH ${MANTA_THREE_PART_VERSION_REGEX} version-string
${version-string})
+ COMPARE_VERSION_STRINGS(${version-string} "1.3.23"
swig-version-compare)
+ IF(swig-version-compare LESS 0)
+ # version < 1.3.23
+ MESSAGE( FATAL_ERROR "Swig must be at least version 1.3.23. You have
version ${version-string}." )
+ ENDIF(swig-version-compare LESS 0)
+
COMPARE_VERSION_STRINGS(${version-string} "1.3.31"
swig-version-compare)
IF(swig-version-compare GREATER 0)
# version > 1.3.31
Modified: trunk/scenes/csafe/python/Configuration.py
==============================================================================
--- trunk/scenes/csafe/python/Configuration.py (original)
+++ trunk/scenes/csafe/python/Configuration.py Fri Dec 5 17:43:12 2008
@@ -19,27 +19,27 @@
f = open(filename, 'w')
ts = scene.frame.transferFunctions
for i in range(len(ts)):
- t = ts[i]
- f.write('[Transfer Function]\n')
- f.write(t.label+'\n')
- f.write(str(t.id)+'\n')
- f.write(str(len(t.colors))+'\n')
- for j in range(len(t.colors)):
- c = t.colors[j]
- f.write(str(c[0])+' '+str(c[1])+' '+str(c[2])+'
'+str(c[3])+' '+str(c[4])+'\n')
- f.write('\n\n')
+ t = ts[i]
+ f.write('[Transfer Function]\n')
+ f.write(t.label+'\n')
+ f.write(str(t.id)+'\n')
+ f.write(str(len(t.colors))+'\n')
+ for j in range(len(t.colors)):
+ c = t.colors[j]
+ f.write(str(c[0])+' '+str(c[1])+' '+str(c[2])+' '+str(c[3])+'
'+str(c[4])+'\n')
+ f.write('\n\n')
histoGroups = scene.frame.histoGroups
for i in range(len(histoGroups)):
- h = histoGroups[i]
- f.write('[Histogram]\n')
- f.write(h.title+'\n')
- f.write(str(h.varIndex)+'\n')
- f.write(str(h.group)+'\n')
- f.write(str(h.histogram.zoomDMin)+'
'+str(h.histogram.zoomDMax)+'\n')
- f.write(str(h.dataMin)+' '+str(h.dataMax)+'\n')
- f.write(str(h.histogram.cropDMin)+'
'+str(h.histogram.cropDMax)+'\n')
- f.write(str(h.transferFID)+'\n')
- f.write('\n\n')
+ h = histoGroups[i]
+ f.write('[Histogram]\n')
+ f.write(h.title+'\n')
+ f.write(str(h.varIndex)+'\n')
+ f.write(str(h.group)+'\n')
+ f.write(str(h.histogram.zoomDMin)+' '+str(h.histogram.zoomDMax)+'\n')
+ f.write(str(h.dataMin)+' '+str(h.dataMax)+'\n')
+ f.write(str(h.histogram.cropDMin)+' '+str(h.histogram.cropDMax)+'\n')
+ f.write(str(h.transferFID)+'\n')
+ f.write('\n\n')
f.write('[Scene Properties]\n')
f.write(str(scene.duration)+'\n')
f.write(str(scene.ridx)+'\n')
@@ -47,184 +47,205 @@
f.write(str(int(scene.cidx))+'\n')
f.write(str(scene.numThreads)+'\n')
for j in range(3):
- f.write(str(scene.volumeMinBound[j])+" ")
+ f.write(str(scene.volumeMinBound[j])+" ")
f.write("\n")
for j in range(3):
- f.write(str(scene.volumeMaxBound[j])+" ")
+ f.write(str(scene.volumeMaxBound[j])+" ")
f.write("\n")
f.write(str(len(scene.nrrdFiles2))+'\n')
for i in range(len(scene.nrrdFiles2)):
- f.write(scene.nrrdFiles2[i]+'\n')
+ f.write(scene.nrrdFiles2[i]+'\n')
print scene.nrrdFiles
print len(scene.nrrdFiles)
f.write(str(len(scene.nrrdFiles))+'\n')
for i in range(len(scene.nrrdFiles)):
- f.write(scene.nrrdFiles[i]+'\n')
+ f.write(scene.nrrdFiles[i]+'\n')
f.close()
def ReadConfiguration(scene, filename):
- f = open(filename, 'r')
-
- ###clear old values
- #for i in range(len(scene.frame.transferFunctions)):
- # scene.frame.transferFunctions[i].Destroy()
- scene.frame.transferFunctions = []
- for i in range(len(scene.frame.histoGroups)):
- scene.frame.histoGroups[i].Destroy()
- scene.frame.histoGroups = []
- scene.nrrdFiles = []
- scene.nrrdFiles2 = []
-
- ###read in new values
- lines = f.readlines()
- for i in range(len(lines)):
- ##### Transfer Function####
- if lines[i].find("[Transfer Function]") != -1:
- i+=1
- name = lines[i].strip()
- print name
- i+=1
- id = int(lines[i].strip())
- i+=1
- num = int(lines[i].strip())
- colors = []
- slices = manta_new(vector_ColorSlice())
- for j in range(num):
- i+=1
- line = lines[i].split()
- pos = float(line[0])
- r = float(line[1])
- g = float(line[2])
- b = float(line[3])
- a = float(line[4])
- #colors.append( (pos, r, g, b, a) )
- print pos
- slices.push_back(ColorSlice(pos,
RGBAColor(Color(RGBColor(r,g,b)), a)))
-
-
scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame, colors,
id, name, manta_new(RGBAColorMap(slices))))
- #### Histogram ####
- elif lines[i].find("[Histogram]") != -1:
- i +=1
- name = lines[i].strip()
- i += 1
- index = int(float(lines[i].strip()))
- i += 1
- group = int(float(lines[i].strip()))
- i += 1
- zoomInto = lines[i].split()
- zoomIntoMin = float(zoomInto[0])
- zoomIntoMax = float(zoomInto[1])
- i+=1
- cropDisplay = lines[i].split()
- cropDisplayMin = float(cropDisplay[0])
- cropDisplayMax = float(cropDisplay[1])
- i+=1
- cropColor = lines[i].split()
- cropColorMin = float(cropColor[0])
- cropColorMax = float(cropColor[1])
- i+=1
- transferFID = int(lines[i].strip())
- histValues1 = []
- for i in range(scene.histogramBuckets):
- histValues1.append(5.0)
- histoGroup =
Histogram.HistogramGroup(scene.frame.panel, scene, index, name, transferFID)
- histoGroup.SetBackgroundColour(wx.Colour(90,90,90))
- histoGroup.group = group
- scene.frame.histoGroups.append(histoGroup)
- #TODO: read these in
- if (group == 1):
-
scene.test.setVolCMap(scene.frame.transferFunctions[transferFID].cmap)
-
scene.frame.transferFunctions[transferFID].cmap.scaleAlphas(.00125)
- #if (group == 0):
- #scene.test.setClipMinMax(index,
cropDisplayMin, cropDisplayMax)
- #scene.test.setSphereCMinMax(index,
cropColorMin, cropColorMax)
- #else:
- # scene.test.setVolCMinMax(cropColorMin,
cropColorMax)
- ##### Scene Properties ####
- elif lines[i].find("[Scene Properties]") != -1:
- i+=1
- scene.duration = float(lines[i].strip())
- scene.test.setDuration(scene.duration)
- i+=1
- scene.ridx = int(float(lines[i].strip()))
- scene.test.setRidx(scene.ridx)
- i+=1
- scene.radius = float(lines[i].strip())
- scene.test.setRadius(scene.radius)
- i+=1
- scene.cidx = int(float(lines[i].strip()))
- scene.test.setCidx(scene.cidx)
- i+=1
- scene.numThreads = int(float(lines[i].strip()))
- scene.engine.changeNumWorkers(scene.numThreads)
- i+=1
- minBound = lines[i].split()
- i+=1
- maxBound = lines[i].split()
- for j in range(3):
- scene.volumeMinBound[j] = float(minBound[j])
- scene.volumeMaxBound[j] = float(maxBound[j])
- minVector = Vector(scene.volumeMinBound[0],
scene.volumeMinBound[1],
- scene.volumeMinBound[2])
- maxVector = Vector(scene.volumeMaxBound[0],
scene.volumeMaxBound[1],
- scene.volumeMaxBound[2])
- scene.test.setVolumeMinMaxBounds(minVector,
maxVector)
- print "setting numWorkers to: " +
str(scene.numThreads)
- i+=1
- numVol = int(float(lines[i].strip()))
- for j in range(numVol):
- i+=1
- scene.nrrdFiles2.append(lines[i].strip())
- i+=1
- numSphere = int(float(lines[i].strip()))
- for j in range(numSphere):
- i+=1
- scene.nrrdFiles.append(lines[i].strip())
- id = len(scene.frame.transferFunctions)
- scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame,
[], id, "InvRainbowIso", manta_new(RGBAColorMap(0))))
- scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame,
[], id+1, "InvRainbow", manta_new(RGBAColorMap(1))))
- scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame,
[], id+2, "Rainbow", manta_new(RGBAColorMap(2))))
- scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame,
[], id+3, "InvGrayscale", manta_new(RGBAColorMap(3))))
- scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame,
[], id+4, "InvBlackBody", manta_new(RGBAColorMap(4))))
- scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame,
[], id+5, "BlackBody", manta_new(RGBAColorMap(5))))
- scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame,
[], id+6, "GreyScale", manta_new(RGBAColorMap(6))))
- scene.frame.LayoutWindow()
- print "Done reading Configuration file"
+ try:
+ f = open(filename, 'r')
+ except IOError, (errno, strerror):
+ print ""
+ print "ERROR opening configuration file '%s': %s. Goodbye." %
(filename, strerror)
+ print ""
+ os._exit( -1 ) # We're done... force exit.
+
+ ### Clear old values
+ # for i in range(len(scene.frame.transferFunctions)):
+ # scene.frame.transferFunctions[i].Destroy()
+ scene.frame.transferFunctions = []
+ for i in range(len(scene.frame.histoGroups)):
+ scene.frame.histoGroups[i].Destroy()
+ scene.frame.histoGroups = []
+ scene.nrrdFiles = []
+ scene.nrrdFiles2 = []
+
+ ###read in new values
+ lines = f.readlines()
+ for i in range(len(lines)):
+ ##### Transfer Function####
+ if lines[i].find("[Transfer Function]") != -1:
+ i+=1
+ name = lines[i].strip()
+ print name
+ i+=1
+ id = int(lines[i].strip())
+ i+=1
+ num = int(lines[i].strip())
+ colors = []
+ slices = manta_new(vector_ColorSlice())
+ for j in range(num):
+ i+=1
+ line = lines[i].split()
+ pos = float(line[0])
+ r = float(line[1])
+ g = float(line[2])
+ b = float(line[3])
+ a = float(line[4])
+ #colors.append( (pos, r, g, b, a) )
+ print pos
+ slices.push_back(ColorSlice(pos,
RGBAColor(Color(RGBColor(r,g,b)), a)))
+
+
scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame, colors,
id, name, manta_new(RGBAColorMap(slices))))
+ #### Histogram ####
+ elif lines[i].find("[Histogram]") != -1:
+ i +=1
+ name = lines[i].strip()
+ i += 1
+ index = int(float(lines[i].strip()))
+ i += 1
+ group = int(float(lines[i].strip()))
+ i += 1
+ zoomInto = lines[i].split()
+ zoomIntoMin = float(zoomInto[0])
+ zoomIntoMax = float(zoomInto[1])
+ i+=1
+ cropDisplay = lines[i].split()
+ cropDisplayMin = float(cropDisplay[0])
+ cropDisplayMax = float(cropDisplay[1])
+ i+=1
+ cropColor = lines[i].split()
+ cropColorMin = float(cropColor[0])
+ cropColorMax = float(cropColor[1])
+ i+=1
+ transferFID = int(lines[i].strip())
+ histValues1 = []
+ for i in range(scene.histogramBuckets):
+ histValues1.append(5.0)
+ histoGroup = Histogram.HistogramGroup(scene.frame.panel, scene,
index, name, transferFID)
+ histoGroup.SetBackgroundColour(wx.Colour(90,90,90))
+ histoGroup.group = group
+ scene.frame.histoGroups.append(histoGroup)
+ #TODO: read these in
+ if (group == 1):
+
scene.test.setVolCMap(scene.frame.transferFunctions[transferFID].cmap)
+
scene.frame.transferFunctions[transferFID].cmap.scaleAlphas(.00125)
+ # if (group == 0):
+ # scene.test.setClipMinMax(index, cropDisplayMin,
cropDisplayMax)
+ # scene.test.setSphereCMinMax(index, cropColorMin,
cropColorMax)
+ # else:
+ # scene.test.setVolCMinMax(cropColorMin, cropColorMax)
+
+ ##### Scene Properties ####
+ elif lines[i].find("[Scene Properties]") != -1:
+ i+=1
+ scene.duration = float(lines[i].strip())
+ scene.test.setDuration(scene.duration)
+ i+=1
+ scene.ridx = int(float(lines[i].strip()))
+ scene.test.setRidx(scene.ridx)
+ i+=1
+ scene.radius = float(lines[i].strip())
+ scene.test.setRadius(scene.radius)
+ i+=1
+ scene.cidx = int(float(lines[i].strip()))
+ scene.test.setCidx(scene.cidx)
+ i+=1
+ scene.numThreads = int(float(lines[i].strip()))
+ scene.engine.changeNumWorkers(scene.numThreads)
+ i+=1
+ minBound = lines[i].split()
+ i+=1
+ maxBound = lines[i].split()
+ for j in range(3):
+ scene.volumeMinBound[j] = float(minBound[j])
+ scene.volumeMaxBound[j] = float(maxBound[j])
+ minVector = Vector(scene.volumeMinBound[0],
scene.volumeMinBound[1],
+ scene.volumeMinBound[2])
+ maxVector = Vector(scene.volumeMaxBound[0],
scene.volumeMaxBound[1],
+ scene.volumeMaxBound[2])
+ scene.test.setVolumeMinMaxBounds(minVector, maxVector)
+ print "setting numWorkers to: " + str(scene.numThreads)
+ i+=1
+ numVol = int(float(lines[i].strip()))
+ for j in range(numVol):
+ i += 1
+ nrrd = lines[i].strip()
+ if not os.path.exists( nrrd ) :
+ print ""
+ print "ERROR file '" + nrrd + "' does not exist. Config
file appears to be invalid. Goodbye."
+ print ""
+ os._exit( -1 ) # We're done... force exit.
+ scene.nrrdFiles2.append( nrrd )
+ i+=1
+ numSphere = int(float(lines[i].strip()))
+ for j in range(numSphere):
+ i+=1
+ nrrd = lines[i].strip()
+ if not os.path.exists( nrrd ) :
+ print ""
+ print "ERROR file '" + nrrd + "' does not exist. Config
file appears to be invalid. Goodbye."
+ print ""
+ os._exit( -1 ) # We're done... force exit.
+ scene.nrrdFiles.append( nrrd )
+
+ id = len(scene.frame.transferFunctions)
+ scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame,
[], id, "InvRainbowIso", manta_new(RGBAColorMap(0))))
+ scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame,
[], id+1, "InvRainbow", manta_new(RGBAColorMap(1))))
+ scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame,
[], id+2, "Rainbow", manta_new(RGBAColorMap(2))))
+ scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame,
[], id+3, "InvGrayscale", manta_new(RGBAColorMap(3))))
+ scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame,
[], id+4, "InvBlackBody", manta_new(RGBAColorMap(4))))
+ scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame,
[], id+5, "BlackBody", manta_new(RGBAColorMap(5))))
+ scene.frame.transferFunctions.append(TransferF.TransferF(scene.frame,
[], id+6, "GreyScale", manta_new(RGBAColorMap(6))))
+
+ scene.frame.LayoutWindow()
+ print "Done reading Configuration file"
def ReadNRRDList(scene, filename):
- f = open(filename, 'r')
+ f = open(filename, 'r')
- ###clear old values
- scene.nrrdFiles = []
- scene.nrrdFiles2 = []
-
- ###read in new values
- lines = f.readlines()
- i = 0
- while i in range(len(lines)-1):
- vol = lines[i].strip()
- while (vol == "" and i < len(lines)-1):
- i +=1
- vol = lines[i].strip()
- i+=1
- sphere = lines[i].strip()
- while(sphere == "" and i < len(lines) -1):
- i += 1
- sphere = lines[i].strip()
- if (sphere == "" or vol == ""):
- return
- print "volume file: " + str(vol) + " sphere file: " +
str(sphere)
- scene.nrrdFiles.append(sphere)
- scene.nrrdFiles2.append(vol)
- i += 1
+ ###clear old values
+ scene.nrrdFiles = []
+ scene.nrrdFiles2 = []
+
+ ###read in new values
+ lines = f.readlines()
+ i = 0
+ while i in range(len(lines)-1):
+ vol = lines[i].strip()
+ while (vol == "" and i < len(lines)-1):
+ i +=1
+ vol = lines[i].strip()
+ i+=1
+ sphere = lines[i].strip()
+ while(sphere == "" and i < len(lines) -1):
+ i += 1
+ sphere = lines[i].strip()
+ if (sphere == "" or vol == ""):
+ return
+ print "volume file: " + str(vol) + " sphere file: " + str(sphere)
+ scene.nrrdFiles.append(sphere)
+ scene.nrrdFiles2.append(vol)
+ i += 1
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")
+ 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 Fri Dec 5 17:43:12 2008
@@ -544,7 +544,7 @@
self.visibilityB = visibilityB
colorB = wx.BitmapButton(self, -1, self.bmpColor, (0,0),
style=wx.NO_BORDER)
- colorB.SetToolTip( wx.ToolTip( "Edit this color map (in color map
editor, below)" ) )
+ colorB.SetToolTip( wx.ToolTip( "Color data using this color map.
(Also opens this color map in color map editor, below.)" ) )
self.colorB = colorB
self.rulerB = wx.BitmapButton(self, -1, self.bmpRuler, (0,0),
style=wx.NO_BORDER)
Modified: trunk/scenes/csafe/python/csafe_demo.py
==============================================================================
--- trunk/scenes/csafe/python/csafe_demo.py (original)
+++ trunk/scenes/csafe/python/csafe_demo.py Fri Dec 5 17:43:12 2008
@@ -57,6 +57,15 @@
import SceneMenus
import SceneInfo
import Configuration
+import Help
+
+##########################################################################################
+
+ZOOM_HELP_ID = 208
+COLORMAP_HELP_ID = 209
+
+
+##########################################################################################
"""
\class window with controls
@@ -98,7 +107,10 @@
# Keep track of toggleTooltipsMenuItem so it can be updated as
needed.
self.toggleTooltipsMenuItem = menuHelp.Append( 207, "Turn Off
Tooltips" )
-
+ menuHelp.AppendSeparator()
+ menuHelp.Append( ZOOM_HELP_ID, "Help on Zooming" )
+ menuHelp.Append( COLORMAP_HELP_ID, "Help on Colormaps" )
+
menuBar.Append(menuFile, "File")
menuBar.Append(menuScene, "Scene")
menuBar.Append(menuHelp, "Help")
@@ -120,11 +132,20 @@
self.Bind(wx.EVT_MENU, self.Menu204, id=204)
self.Bind(wx.EVT_MENU, self.Menu110, id=110)
self.Bind(wx.EVT_MENU, self.Menu205, id=205)
- self.Bind(wx.EVT_MENU, self.MenuVolPositionSize, id = 206)
- self.Bind(wx.EVT_MENU, self.ToggleTooltips, id=207)
+ self.Bind(wx.EVT_MENU, self.MenuVolPositionSize, id=206)
+ self.Bind(wx.EVT_MENU, self.ToggleTooltips, id=207)
+ self.Bind(wx.EVT_MENU, self.ShowHelp, id=ZOOM_HELP_ID)
+ self.Bind(wx.EVT_MENU, self.ShowHelp, id=COLORMAP_HELP_ID)
self.SetBackgroundColour(self.scene.bgColor)
+ def ShowHelp( self, evt ) :
+ id = evt.GetId()
+ if( id == ZOOM_HELP_ID ):
+ Help.showZoomHelp()
+ elif( id == COLORMAP_HELP_ID ):
+ Help.showColormapHelp()
+
def ToggleTooltips( self, evt ):
if setup.tooltipsOn == True :
self.toggleTooltipsMenuItem.SetText( "Turn On Tooltips" )
@@ -193,7 +214,7 @@
self.Menu103(evt)
def Menu103(self,evt):
- dlg = wx.FileDialog( self, message="Save file as...",
defaultDir=os.getcwd(),
+ dlg = wx.FileDialog( self, message="Save file as...",
defaultDir=setup.original_path,
defaultFile="", wildcard="*", style=wx.SAVE )
if dlg.ShowModal() == wx.ID_OK:
path = dlg.GetPath()
@@ -240,7 +261,7 @@
################ Export NRRDLIST #################
def Menu108(self, e):
- dlg = wx.FileDialog(self, message="Save file as...",
defaultDir=os.getcwd(),
+ dlg = wx.FileDialog(self, message="Save file as...",
defaultDir=setup.original_path,
defaultFile="", wildcard="*", style=wx.SAVE)
if dlg.ShowModal() == wx.ID_OK:
path = dlg.GetPath()
@@ -599,6 +620,7 @@
class Setup(wx.Object):
def __init__(self):
self.csafe_scene_path = sys.path[0] + "/"
+ self.original_path = os.getcwd()
self.num_workers = None
self.cfg = ""
self.nrrdlist = ""
@@ -620,13 +642,24 @@
print "setup"
-def usage():
+def usage( badArgs=[] ):
+
+ if len( badArgs) != 0 :
+ print ""
+ print "Error parsing command line. The following argument(s) where
not recognized:"
+ print ""
+ for arg in badArgs :
+ print " " + arg
+ print ""
print "Usage: python test.py [options]"
+ print ""
print "Where options contains one or more of:"
- print "--np=<int> the number of threads to use"
- print "--cfg=<string> load a configuration file"
- print "--nrrdlist=<string> load a nrrdlist"
- print "--g generate scene when starting up"
+ print ""
+ print " --np=<int> : the number of threads to use"
+ print " --cfg=<string> : load a configuration file"
+ print " --nrrdlist=<string> : load a nrrdlist"
+ print " --g : automatically/immediately generate scene
when starting up"
+ print ""
def main():
global setup
@@ -683,11 +716,16 @@
"g"
] )
- except getopt.GetoptError:
- usage()
+ except getopt.GetoptError, error:
+ usage( [error.msg] )
+ sys.exit(2)
+
+ if len( args ) > 0 :
+ usage( args )
sys.exit(2)
for o, a in opts:
+
if o in ("-n", "--np"):
if (a == "nprocs"):
setup.num_workers = Thread.numProcessors(),
@@ -805,8 +843,10 @@
frame1.scene.mantaApp = app
if (setup.cfg != ""):
- frame1.generateMenuItem.Enable( True );
Configuration.ReadConfiguration(frame1.scene, setup.cfg)
+ if( len( frame1.scene.nrrdFiles ) > 0 or len( frame1.scene.nrrdFiles
) > 0 ) :
+ frame1.generateMenuItem.Enable( True );
+
if (setup.nrrdlist != ""):
Configuration.ReadNRRDList(frame1.scene, setup.nrrdlist)
if (setup.uda != ""):
- [Manta] r2351 - in trunk: Model/Readers StandAlone SwigInterface scenes/csafe/python, dav, 12/05/2008
Archive powered by MHonArc 2.6.16.