changeset 236:4fb328f81012

- SWIG fixes. Graphics updates.
author tomwalters
date Tue, 19 Oct 2010 19:48:37 +0000
parents d21844facd3a
children af02b6addf7a
files experiments/README.txt src/Modules/Output/Graphics/Devices/GraphicsOutputDeviceCairo.cc src/Modules/Output/Graphics/GraphicsView.cc src/Modules/Output/Graphics/GraphicsView.h swig/aim_modules.i
diffstat 5 files changed, 17 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/experiments/README.txt	Tue Oct 19 07:30:08 2010 +0000
+++ b/experiments/README.txt	Tue Oct 19 19:48:37 2010 +0000
@@ -1,1 +1,1 @@
-Scripts to run
\ No newline at end of file
+Scripts to run various experiments on scale-invariant feature representations. Most of these are related to experiments in Tom Walters' PhD thesis: 'Auditory-Based processing of communication sounds'.
--- a/src/Modules/Output/Graphics/Devices/GraphicsOutputDeviceCairo.cc	Tue Oct 19 07:30:08 2010 +0000
+++ b/src/Modules/Output/Graphics/Devices/GraphicsOutputDeviceCairo.cc	Tue Oct 19 19:48:37 2010 +0000
@@ -42,6 +42,7 @@
   m_iFileNumber = 0;
   m_iVertexType = VertexTypeNone;
   m_bUseMemoryBuffer=false;
+  m_pParam->DefaultString("output.img.format", ".png");
 }
 
 bool GraphicsOutputDeviceCairo::Initialize(const char *sDir) {
@@ -56,7 +57,7 @@
   if ( !OpenFile(0) ) {
     //! \todo Better error message that is more specific about the cause.
     LOG_ERROR(_T("Could not open output directory '%s' using graphics format '%s'."),
-      m_sDir, m_pParam->GetString("output.img.format") );
+      m_sDir, m_pParam->DefaultString("output.img.format", ".png") );
     return false;
   }
   CloseFile();
--- a/src/Modules/Output/Graphics/GraphicsView.cc	Tue Oct 19 07:30:08 2010 +0000
+++ b/src/Modules/Output/Graphics/GraphicsView.cc	Tue Oct 19 19:48:37 2010 +0000
@@ -30,7 +30,7 @@
   module_type_ = "output";
   module_version_ = "$Id: $";
   
-  m_pDev = NULL;
+  m_pDev = new GraphicsOutputDeviceCairo();
   m_bPlotLabels = false;
   m_pAxisX = new GraphAxisSpec();
   AIM_ASSERT(m_pAxisX);
@@ -40,7 +40,7 @@
   AIM_ASSERT(m_pAxisFreq);
   initialized_ = true;
 
-  if (!m_pAxisY->Initialize(m_pParam,
+  if (!m_pAxisY->Initialize(parameters_,
                             _S("graph.y"),
                             -1,
                             1,
@@ -48,13 +48,13 @@
     LOG_ERROR("Axis initialization failed");
     initialized_ = false;
   }
-  m_fMarginLeft = m_pParam->GetFloat(_S("graph.margin.left"));
-  m_fMarginRight = m_pParam->GetFloat(_S("graph.margin.right"));
-  m_fMarginTop = m_pParam->GetFloat(_S("graph.margin.top"));
-  m_fMarginBottom = m_pParam->GetFloat(_S("graph.margin.bottom"));
-  m_bPlotLabels = m_pParam->GetBool(_S("graph.plotlabels"));
+  m_fMarginLeft = parameters_->GetFloat(_S("graph.margin.left"));
+  m_fMarginRight = parameters_->GetFloat(_S("graph.margin.right"));
+  m_fMarginTop = parameters_->GetFloat(_S("graph.margin.top"));
+  m_fMarginBottom = parameters_->GetFloat(_S("graph.margin.bottom"));
+  m_bPlotLabels = parameters_->GetBool(_S("graph.plotlabels"));
 
-  const char *sGraphType = m_pParam->GetString(_S("graph.type"));
+  const char *sGraphType = parameters_->GetString(_S("graph.type"));
   if (strcmp(sGraphType, _S("line"))==0)
     m_iGraphType = GraphTypeLine;
   else if (strcmp(sGraphType, _S("colormap"))==0)
@@ -66,11 +66,11 @@
     initialized_ = false;
   }
 
-  if (strcmp(m_pParam->GetString(_S("graph.mindistance")),"auto") == 0)
+  if (strcmp(parameters_->GetString(_S("graph.mindistance")),"auto") == 0)
     // -1 means detect later, based on type and Fire() argument
     m_fMinPlotDistance = -1;
   else
-    m_fMinPlotDistance = m_pParam->GetFloat(_S("graph.mindistance"));
+    m_fMinPlotDistance = parameters_->GetFloat(_S("graph.mindistance"));
 }
 
 GraphicsView::~GraphicsView() {
@@ -90,7 +90,7 @@
 
   float y_min = bank.centre_frequency(0);
   float y_max = bank.centre_frequency(bank.channel_count() - 1);
-  if (!m_pAxisFreq->Initialize(m_pParam,
+  if (!m_pAxisFreq->Initialize(parameters_,
                                "graph.freq",
                                y_min,
                                y_max,
@@ -101,7 +101,7 @@
 
   float x_min = 0.0;
   float x_max = 1000.0 * bank.buffer_length() / bank.sample_rate();
-  if (!m_pAxisX->Initialize(m_pParam,
+  if (!m_pAxisX->Initialize(parameters_,
                             "graph.x",
                             x_min,
                             x_max,
--- a/src/Modules/Output/Graphics/GraphicsView.h	Tue Oct 19 07:30:08 2010 +0000
+++ b/src/Modules/Output/Graphics/GraphicsView.h	Tue Oct 19 19:48:37 2010 +0000
@@ -134,9 +134,6 @@
   //! \brief Where to plot to
   GraphicsOutputDevice *m_pDev;
 
-  //! \brief Main parameter store
-  Parameters *m_pParam;
-
   //! \brief Axes specifications
   GraphAxisSpec *m_pAxisX, *m_pAxisY, *m_pAxisFreq;
 
--- a/swig/aim_modules.i	Tue Oct 19 07:30:08 2010 +0000
+++ b/swig/aim_modules.i	Tue Oct 19 19:48:37 2010 +0000
@@ -52,7 +52,8 @@
  public:
   explicit Module(Parameters *parameters);
   virtual ~Module();
-  virtual bool Initialize(const SignalBank &input);
+  virtual bool Initialize(const SignalBank &input,
+                          Parameters *global_parameters);
   bool initialized() const;
   bool AddTarget(Module* target_module);
   bool RemoveTarget(Module* target_module);