Allow maximum number of particles to be configured.
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include "Options.hpp"
|
#include "Options.hpp"
|
||||||
|
#include "visualisations.hpp"
|
||||||
|
|
||||||
using namespace fmri;
|
using namespace fmri;
|
||||||
|
|
||||||
@@ -92,6 +93,7 @@ Options::Options(int argc, char * const argv[]):
|
|||||||
("layer-opacity", value_for(layerTransparancy_), "Opacity for layers")
|
("layer-opacity", value_for(layerTransparancy_), "Opacity for layers")
|
||||||
("interaction-opacity", value_for(interactionTransparancy_), "Opacity for interactions")
|
("interaction-opacity", value_for(interactionTransparancy_), "Opacity for interactions")
|
||||||
("layer-distance", value_for(LAYER_X_OFFSET), "Distance between layers")
|
("layer-distance", value_for(LAYER_X_OFFSET), "Distance between layers")
|
||||||
|
("interaction-limit", value_for(INTERACTION_LIMIT), "Maximum number of interactions per layer")
|
||||||
("dump,d", value<std::string>(&dumpPath), "dump convolutional images in this directory");
|
("dump,d", value<std::string>(&dumpPath), "dump convolutional images in this directory");
|
||||||
|
|
||||||
options_description composed = desc;
|
options_description composed = desc;
|
||||||
|
|||||||
@@ -14,8 +14,7 @@
|
|||||||
using namespace fmri;
|
using namespace fmri;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
// Maximum number of interactions shown
|
std::size_t fmri::INTERACTION_LIMIT = 10000;
|
||||||
static constexpr size_t INTERACTION_LIMIT = 10000;
|
|
||||||
|
|
||||||
typedef vector<pair<float, pair<size_t, size_t>>> EntryList;
|
typedef vector<pair<float, pair<size_t, size_t>>> EntryList;
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,20 @@
|
|||||||
#include "LayerInfo.hpp"
|
#include "LayerInfo.hpp"
|
||||||
|
|
||||||
namespace fmri {
|
namespace fmri {
|
||||||
|
/**
|
||||||
|
* Maximum number of interactions per layer.
|
||||||
|
*
|
||||||
|
* Controls the number of interactions per layer for performance
|
||||||
|
* reasons. Only the top INTERACTION_LIMIT interactions are shown
|
||||||
|
* to limit the amount of computations needed for animation.
|
||||||
|
*
|
||||||
|
* Note that this number currently applies only to InnerProduct
|
||||||
|
* type layers.
|
||||||
|
*
|
||||||
|
* This value is set from the options parser.
|
||||||
|
*/
|
||||||
|
extern std::size_t INTERACTION_LIMIT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a static visualisation of a layer state.
|
* Generate a static visualisation of a layer state.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -75,6 +75,14 @@ void float_parameter(std::vector<char *> &argv, std::string_view flag, double va
|
|||||||
argv.push_back(wrap_string(buffer));
|
argv.push_back(wrap_string(buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void int_parameter(std::vector<char*> &argv, std::string_view flag, int value)
|
||||||
|
{
|
||||||
|
char buffer[100];
|
||||||
|
argv.push_back(wrap_string(flag));
|
||||||
|
std::sprintf(buffer, "%d", value);
|
||||||
|
argv.push_back(wrap_string(buffer));
|
||||||
|
}
|
||||||
|
|
||||||
void set_default_path(Gtk::FileChooserButton& chooser, const char* path)
|
void set_default_path(Gtk::FileChooserButton& chooser, const char* path)
|
||||||
{
|
{
|
||||||
if (file_exists(path)) {
|
if (file_exists(path)) {
|
||||||
@@ -101,6 +109,7 @@ private:
|
|||||||
Gtk::Scale layerDistance;
|
Gtk::Scale layerDistance;
|
||||||
Gtk::Scale layerTransparancy;
|
Gtk::Scale layerTransparancy;
|
||||||
Gtk::Scale interactionTransparancy;
|
Gtk::Scale interactionTransparancy;
|
||||||
|
Gtk::SpinButton interactionLimit;
|
||||||
Gtk::Button startButton;
|
Gtk::Button startButton;
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
@@ -125,6 +134,7 @@ Launcher::Launcher()
|
|||||||
layerDistance(Gtk::Adjustment::create(10, 0, 100, 0, 0.1, 0)),
|
layerDistance(Gtk::Adjustment::create(10, 0, 100, 0, 0.1, 0)),
|
||||||
layerTransparancy(Gtk::Adjustment::create(1, 0, 1, 0.0, 1.f / 256)),
|
layerTransparancy(Gtk::Adjustment::create(1, 0, 1, 0.0, 1.f / 256)),
|
||||||
interactionTransparancy(Gtk::Adjustment::create(1, 0, 1, 0.0, 1.f / 256)),
|
interactionTransparancy(Gtk::Adjustment::create(1, 0, 1, 0.0, 1.f / 256)),
|
||||||
|
interactionLimit(Gtk::Adjustment::create(10000, 4096, std::numeric_limits<int>::max()), 10000),
|
||||||
startButton("Start FMRI")
|
startButton("Start FMRI")
|
||||||
{
|
{
|
||||||
set_default_size(400, -1);
|
set_default_size(400, -1);
|
||||||
@@ -162,6 +172,7 @@ Launcher::Launcher()
|
|||||||
addRowWithLabel("Layer distance", layerDistance);
|
addRowWithLabel("Layer distance", layerDistance);
|
||||||
addRowWithLabel("Layer transparancy", layerTransparancy);
|
addRowWithLabel("Layer transparancy", layerTransparancy);
|
||||||
addRowWithLabel("Interaction transparancy", interactionTransparancy);
|
addRowWithLabel("Interaction transparancy", interactionTransparancy);
|
||||||
|
addRowWithLabel("Interaction limit", interactionLimit);
|
||||||
|
|
||||||
startButton.signal_clicked().connect(sigc::mem_fun(*this, &Launcher::start));
|
startButton.signal_clicked().connect(sigc::mem_fun(*this, &Launcher::start));
|
||||||
grid.attach_next_to(startButton, Gtk::PositionType::POS_BOTTOM, 2, 1);
|
grid.attach_next_to(startButton, Gtk::PositionType::POS_BOTTOM, 2, 1);
|
||||||
@@ -201,6 +212,7 @@ void Launcher::start()
|
|||||||
float_parameter(argv, "--layer-opacity", layerTransparancy.get_value());
|
float_parameter(argv, "--layer-opacity", layerTransparancy.get_value());
|
||||||
float_parameter(argv, "--interaction-opacity", interactionTransparancy.get_value());
|
float_parameter(argv, "--interaction-opacity", interactionTransparancy.get_value());
|
||||||
float_parameter(argv, "--layer-distance", layerDistance.get_value());
|
float_parameter(argv, "--layer-distance", layerDistance.get_value());
|
||||||
|
int_parameter(argv, "--interaction-limit", interactionLimit.get_value());
|
||||||
|
|
||||||
if (labelChooser.get_file()) {
|
if (labelChooser.get_file()) {
|
||||||
argv.push_back(wrap_string("-l"));
|
argv.push_back(wrap_string("-l"));
|
||||||
|
|||||||
Reference in New Issue
Block a user