Skip to content
Snippets Groups Projects
Commit 0ade56ad authored by Simon Oehrl's avatar Simon Oehrl
Browse files

Merge branch 'revert-f3bd8a22' into 'stable'

Revert "Merge branch 'feature/#7_remove_conan' into 'stable'"

See merge request VR-Group/nest-streaming-module!4
parents f3bd8a22 cc15fbed
No related branches found
No related tags found
1 merge request!4Revert "Merge branch 'feature/#7_remove_conan' into 'stable'"
Showing
with 47 additions and 956 deletions
.vscode
build
......@@ -40,7 +40,7 @@ set( MODULE_NAME ${SHORT_NAME}module )
# 2) Add all your sources here
set( MODULE_SOURCES
streamingmodule.h streamingmodule.cpp
streaming_recording_backend.h streaming_recording_backend.cpp
recording_backend_nesci_contra.h recording_backend_nesci_contra.cpp
)
# 3) We require a header name like this:
......@@ -179,17 +179,6 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE
)
#--------------------------------------------------------------------
set(CMAKE_CXX_STANDARD 14)
if (NOT CONTRA_TRANSPORT)
set(CONTRA_TRANSPORT shared_memory)
endif()
find_package(contra COMPONENTS contra ${CONTRA_TRANSPORT} REQUIRED)
find_package(nesci COMPONENTS producer REQUIRED)
#--------------------------------------------------------------------
# on OS X
set( CMAKE_MACOSX_RPATH ON )
......@@ -242,13 +231,14 @@ add_custom_target( dist
COMMENT "Creating a source distribution from ${MODULE_NAME}..."
)
add_subdirectory(demos)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup( TARGETS )
if ( BUILD_SHARED_LIBS )
# When building shared libraries, also create a module for loading at runtime
# with the `Install` command.
add_library( ${MODULE_NAME}_module MODULE ${MODULE_SOURCES} )
target_link_libraries( ${MODULE_NAME}_module nesci::producer contra::${CONTRA_TRANSPORT} )
target_link_libraries( ${MODULE_NAME}_module CONAN_PKG::nesci CONAN_PKG::contra )
set_target_properties( ${MODULE_NAME}_module
PROPERTIES
COMPILE_FLAGS "${NEST_CXXFLAGS} -DLTX_MODULE"
......@@ -262,7 +252,7 @@ endif ()
# Build dynamic/static library for standard linking from NEST.
add_library( ${MODULE_NAME}_lib ${MODULE_SOURCES} )
target_link_libraries( ${MODULE_NAME}_lib nesci::producer contra::${CONTRA_TRANSPORT} )
target_link_libraries( ${MODULE_NAME}_lib CONAN_PKG::nesci CONAN_PKG::contra )
if ( BUILD_SHARED_LIBS )
# Dynamic libraries are initiated by a `global` variable of the `SLIModule`,
# which is included, when the flag `LINKED_MODULE` is set.
......@@ -306,6 +296,7 @@ if ( NOT CMAKE_CROSSCOMPILING )
)
endif ()
message( "" )
message( "-------------------------------------------------------" )
message( "${MODULE_NAME} Configuration Summary" )
......
set noparent
filter=-readability/check,-build/c++tr1,-build/c++11,-build/c++14
linelength=80
headers=h,hpp
......@@ -3,15 +3,15 @@
## Prerequisites
* CMake >= 3.6.0 (https://cmake.org/)
* Python 2.7 (https://www.python.org/)
* NEST: the latest release of NEST does currently not support modules. Thus, a custom version is required that can be found [here](https://github.com/jougs/nest-simulator/tree/feature/custom-recording-backend). You need to checkout and build the branch `feature/custom-recording-backend`
* Conan (`pip install conan`)
* NEST: the latest release of NEST does currently not support modules. Thus, a custom version is required that can be found [here](https://github.com/jougs/nest-simulator/tree/feature/custom-recording-backend).
## Building
1. Create a build directory
2. Open terminal in build directory
3. Run CMake: `cmake -Dwith-nest=${PATH_TO_NEST_INSTALLATION} ${PATH_TO_NEST_STREAMING_MODULE_SOURCE}`
4. Run Conan: `conan install ${PATH_TO_NEST_STREAMING_MODULE_SOURCE} --build=missing`
5. Build: `cmake --build .`
6. Install: `cmake --build . --target install`
4. Build: `cmake --build .`
5. Install: `cmake --build . --target install`
## How to use the nest-streaming-module?
The *nest-streaming-module* registers a new RecordingBackend to the simulator. When registering a `RecordingDevice` using PyNEST the used recording backend can be specified in the `record_to` parameter. If you want to stream the data, set this parameter to `['streaming']`. Clients that receive the data can be either written in Python or C++. See https://devhub.vr.rwth-aachen.de/VR-Group/nesci-contra-demos for examples.
\ No newline at end of file
# conanfile.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# NEST is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with NEST. If not, see <http://www.gnu.org/licenses/>
from conans import ConanFile, CMake
class nest(ConanFile):
name = "NEST"
version = "18.05"
license = "GNU General Public License, Version 2"
description = """NEST is a simulator for spiking neural network models that focuses on the dynamics, size and structure of neural systems rather than on the exact morphology of individual neurons."""
settings = "os", "compiler", "build_type", "arch"
requires = (("contra/18.05@RWTH-VR/develop"),
("nesci/18.05@RWTH-VR/develop"))
generators = "cmake"
def configure(self):
pass
def imports(self):
pass
#-------------------------------------------------------------------------------
# nest-streaming-module
#
# Copyright (c) 2018 RWTH Aachen University, Germany,
# Virtual Reality & Immersive Visualization Group.
#-------------------------------------------------------------------------------
# License
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
option(BUILD_BRUNEL_SIMULATION "Build the brunel simulation" ON)
option(BUILD_QVTK_DEMO "Build the QVTK visualization demo" OFF)
if (${BUILD_BRUNEL_SIMULATION})
add_subdirectory(brunel_simulation)
endif (${BUILD_BRUNEL_SIMULATION})
if (${BUILD_QVTK_DEMO})
add_subdirectory(QVTK-Demo)
endif (${BUILD_QVTK_DEMO})
#-------------------------------------------------------------------------------
# QVTK-Demo
#
# Copyright (c) 2017-2018 RWTH Aachen University, Germany,
# Virtual Reality & Immersive Visualization Group.
#-------------------------------------------------------------------------------
# License
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
add_subdirectory(qvtk-app)
add_subdirectory(qvtk-lib)
#-------------------------------------------------------------------------------
# QVTK-Demo
#
# Copyright (c) 2017-2018 RWTH Aachen University, Germany,
# Virtual Reality & Immersive Visualization Group.
#-------------------------------------------------------------------------------
# License
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
This is a brief summary on how to get the QVTK-Demo running.
Prerequisites:
-QT (Version 5.9 or higher is advised! -older versions might work aswell but havent been tested).
-Get this first and build it.
-The Visualization Toolkit(VTK) (The demo was originally build with version 8.0.1. Newer versions should work too but havent been tested).
-Ŵhen building VTK with CMake make sure you enable VTK_BUILD_QT_DESIGNER_PLUGIN, VTK_Group_Qt and set VTK_QT_VERSION to 5.
Installing:
When running CMake enable BUILD_QVTK_DEMO and BUILD_BRUNEL_SIMULATION.
Running the Demo:
To run the Demo start both, the QVTK-Demo(qvtk-app) and the Brunel Simulation(run_sim.sh) from your build folder.
#-------------------------------------------------------------------------------
# QVTK-Demo
#
# Copyright (c) 2017-2018 RWTH Aachen University, Germany,
# Virtual Reality & Immersive Visualisation Group.
#-------------------------------------------------------------------------------
# License
#
# This framework is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# In the future, we may decide to add a commercial license
# at our own discretion without further notice.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesse r General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------
set(CMAKE_AUTOMOC ON)
set(QVTK_APP_API_HEADER_DIR include/qvtk_app)
file(GLOB QVTK_APP_SOURCES src/*.cpp)
file(GLOB QVTK_APP_HEADERS include/qvtk_app/*.hpp)
file(GLOB QVTK_APP_API_HEADERS ${QVTK_APP_API_HEADER_DIR}/*.hpp)
file(GLOB QVTK_APP_SUPPRESS_WARNING_HEADERS include/qvtk_app/suppress_warnings/Qt *.hpp)
add_executable(qvtk_app
${QVTK_APP_SOURCES}
${QVTK_APP_HEADERS}
${QVTK_APP_API_HEADERS}
${QVTK_APP_SUPPRESS_WARNING_HEADERS}
)
target_include_directories(
qvtk_app PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_BINARY_DIR}
)
#add_test_cpplint(NAME "qvtk_app--cpplint"
# ${QVTK_APP_SOURCES}
# ${QVTK_APP_HEADERS}
# ${QVTK_APP_API_HEADERS}
# ${QVTK_APP_SUPPRESS_WARNING_HEADERS}
#)
set_warning_levels_RWTH(qvtk_app
SUPPRESS_WARNINGS_HEADER ${CMAKE_CURRENT_BINARY_DIR}/include/qt_app/suppress_warnings.hpp
)
include_directories(include)
# --- dependencies ---
# VTK
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
target_include_directories(qvtk_app PUBLIC ${VTK_INCLUDE_DIR})
#vtkexperiment
target_include_directories(qvtk_app PUBLIC ${QVTK_LIB_INCLUDE_DIRS})
target_link_libraries(qvtk_app PUBLIC qvtk-lib debug ${VTK_LIBRARIES} optimized ${VTK_LIBRARIES})
//------------------------------------------------------------------------------
// QVTK-Demo
//
// Copyright (c) 2017-2018 RWTH Aachen University, Germany,
// Virtual Reality & Immersive Visualisation Group.
//------------------------------------------------------------------------------
// License
//
// This framework is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In the future, we may decide to add a commercial license
// at our own discretion without further notice.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
#ifndef QVTK_APP_INCLUDE_QVTK_APP_APPLICATION_HPP_
#define QVTK_APP_INCLUDE_QVTK_APP_APPLICATION_HPP_
#include "QApplication"
#include "qvtk-lib/main_window.hpp"
#include "qvtk-lib/point_data.hpp"
class Application
{
public:
Application(int *argc, char **argv);
~Application() {}
int Run();
private:
QApplication qt_app_;
vtkexp::PointData points_;
vtkexp::MainWindow window_;
};
#endif // QVTK_APP_INCLUDE_QVTK_APP_APPLICATION_HPP_
//------------------------------------------------------------------------------
// QVTK-Demo
//
// Copyright (c) 2017-2018 RWTH Aachen University, Germany,
// Virtual Reality & Immersive Visualisation Group.
//------------------------------------------------------------------------------
// License
//
// This framework is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In the future, we may decide to add a commercial license
// at our own discretion without further notice.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
#include "qvtk_app/application.hpp"
Application::Application(int *argc, char **argv)
: qt_app_{*argc, argv}, points_(6, 6, 1), window_{&points_} {}
int Application::Run()
{
window_.show();
return qt_app_.exec();
}
//------------------------------------------------------------------------------
// QVTK-Demo
//
// Copyright (c) 2017-2018 RWTH Aachen University, Germany,
// Virtual Reality & Immersive Visualisation Group.
//------------------------------------------------------------------------------
// License
//
// This framework is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In the future, we may decide to add a commercial license
// at our own discretion without further notice.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
#include "qvtk_app/application.hpp"
int main(int argc, char **argv)
{
Application app(&argc, argv);
return app.Run();
}
#-------------------------------------------------------------------------------
# QVTK-Demo
#
# Copyright (c) 2017-2018 RWTH Aachen University, Germany,
# Virtual Reality & Immersive Visualisation Group.
#-------------------------------------------------------------------------------
# License
#
# This framework is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# In the future, we may decide to add a commercial license
# at our own discretion without further notice.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesse r General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------
set(CMAKE_AUTOMOC ON)
set(QVTK_LIB_API_HEADER_DIR include/qvtk-lib)
file(GLOB QVTK_LIB_SOURCES src/*.cpp)
file(GLOB QVTK_LIB_HEADERS include/qvtk-lib/*.hpp)
file(GLOB QVTK_LIB_API_HEADERS ${QVTK_LIB_API_HEADER_DIR}/*.hpp)
set(QVTK_LIB_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}qvtk-lib/include
${PROJECT_BINARY_DIR}
CACHE PATH "Path to public headers in vtk's source tree."
)
add_library(qvtk-lib
${QVTK_LIB_SOURCES}
${QVTK_LIB_HEADERS}
)
target_include_directories(qvtk-lib
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC ${CMAKE_CURRENT_BINARY_DIR}
)
generate_export_header(qvtk-lib
EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/include/qvtk-lib/export.hpp
)
set_warning_levels_RWTH(qvtk-lib
SUPPRESS_WARNINGS_HEADER ${CMAKE_CURRENT_BINARY_DIR}/include/qvtk-lib/suppress_warnings.hpp
)
#add_test_cpplint(NAME "vtkexperiment--cpplint"
# ${VTKEXPERIMENT_SOURCES}
# ${VTKEXPERIMENT_HEADERS}
#)
include_directories(include)
# --- dependencies ---
# VTK
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
target_include_directories(qvtk-lib PUBLIC ${VTK_INCLUDE_DIR})
target_include_directories(qvtk-lib PUBLIC
${CONAN_INCLUDE_DIRS}
)
target_link_libraries(qvtk-lib
PUBLIC ${CONAN_OR_CMAKE_contra}
PUBLIC ${CONAN_OR_CMAKE_nesci}
PUBLIC ${CONAN_OR_CMAKE_conduit}
PUBLIC ${CONAN_OR_CMAKE_Qt}
PUBLIC ${CONAN_OR_CMAKE_VTK}
debug ${VTK_LIBRARIES}
optimized ${VTK_LIBRARIES}
)
//------------------------------------------------------------------------------
// QVTK-Demo
//
// Copyright (c) 2017-2018 RWTH Aachen University, Germany,
// Virtual Reality & Immersive Visualisation Group.
//------------------------------------------------------------------------------
// License
//
// This framework is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In the future, we may decide to add a commercial license
// at our own discretion without further notice.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
#ifndef QVTK_LIB_INCLUDE_QVTK_LIB_ANIMATE_HPP_
#define QVTK_LIB_INCLUDE_QVTK_LIB_ANIMATE_HPP_
#include "QObject"
#include "QTimer"
#include "include/qvtk-lib/suppress_warnings.hpp"
SUPPRESS_WARNINGS_BEGIN
#include "qvtk-lib/point_data.hpp"
SUPPRESS_WARNINGS_END
namespace vtkexp
{
class Animate : public QObject
{
Q_OBJECT
public:
explicit Animate(PointData *points);
~Animate() {}
void StartTimer();
signals:
void DataChanged();
void DataChanged(int time_step);
void NextStep();
void LastStep();
void SwitchRealtime();
void SwitchPlayPause();
public slots: // NOLINT
void ChangeData(int timestep = -1);
void IncreaseSpeed();
void DecreaseSpeed();
void Iterate();
void RealtimeButton();
void PlayButton();
void SpeedMenu(int index);
private:
PointData *points_;
QTimer *rt_timer_;
QTimer *play_timer_;
int play_speed_ = 1000;
};
} // namespace vtkexp
#endif // QVTK_LIB_INCLUDE_QVTK_LIB_ANIMATE_HPP_
//------------------------------------------------------------------------------
// QVTK-Demo
//
// Copyright (c) 2017-2018 RWTH Aachen University, Germany,
// Virtual Reality & Immersive Visualisation Group.
//------------------------------------------------------------------------------
// License
//
// This framework is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In the future, we may decide to add a commercial license
// at our own discretion without further notice.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
#ifndef QVTK_LIB_INCLUDE_QVTK_LIB_DATA_STREAM_HPP_
#define QVTK_LIB_INCLUDE_QVTK_LIB_DATA_STREAM_HPP_
#include <vector>
#include "conduit/conduit_node.hpp"
//#include "contra/boost-shmem/shared_memory_transport.hpp"
#include "contra/relay.hpp"
#include "contra/zmq/zeromq_transport.hpp"
#include "nesci/consumer/nest_multimeter.hpp"
namespace vtkexp
{
class DataStream
{
public:
DataStream();
~DataStream() {}
std::vector<double> GetMultValuesAt(int time_step);
std::vector<double> GetTimeSteps();
private:
void SetUpStream();
void Update(int time_step);
std::vector<double> mult_values_;
contra::Relay<contra::ZMQTransport> *relay_;
nesci::consumer::NestMultimeter *multimeter_;
conduit::Node node_;
};
} // namespace vtkexp
#endif // QVTK_LIB_INCLUDE_QVTK_LIB_DATA_STREAM_HPP_
//------------------------------------------------------------------------------
// QVTK-Demo
//
// Copyright (c) 2017-2018 RWTH Aachen University, Germany,
// Virtual Reality & Immersive Visualisation Group.
//------------------------------------------------------------------------------
// License
//
// This framework is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In the future, we may decide to add a commercial license
// at our own discretion without further notice.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
#ifndef QVTK_LIB_INCLUDE_QVTK_LIB_INTERACTION_HPP_
#define QVTK_LIB_INCLUDE_QVTK_LIB_INTERACTION_HPP_
#include <string>
#include "include/qvtk-lib/suppress_warnings.hpp"
SUPPRESS_WARNINGS_BEGIN
#include <vtkActor.h>
#include <vtkDataSetMapper.h>
#include <vtkMapper.h>
#include <vtkPointGaussianMapper.h>
#include <vtkPointPicker.h>
#include <vtkUnstructuredGrid.h>
#include "vtkInteractorStyleTrackballCamera.h"
#include "vtkPolyData.h"
SUPPRESS_WARNINGS_END
namespace vtkexp
{
class Interaction : public vtkInteractorStyleTrackballCamera
{
public:
static Interaction *New();
vtkTypeMacro(Interaction, vtkInteractorStyleTrackballCamera)
Interaction();
virtual void OnLeftButtonUp();
void SetUpShaders();
void SetUpActor();
void SetUpMapper();
double GetNeuronValue();
vtkIdType GetNeuronId();
void SetData(vtkSmartPointer<vtkPolyData> data);
void SwitchMapper(int rendertype);
void ExtractSelection();
void HighlightSelection();
void Deselect();
void Pick();
private:
double neuron_value_;
vtkIdType id_;
vtkSmartPointer<vtkUnstructuredGrid> selected_;
vtkSmartPointer<vtkPolyData> data_;
vtkSmartPointer<vtkActor> actor_;
vtkSmartPointer<vtkPointGaussianMapper> mapper_;
vtkSmartPointer<vtkPointPicker> picker_;
std::string point_shader_;
std::string sphere_shader_;
};
} // namespace vtkexp
#endif // QVTK_LIB_INCLUDE_QVTK_LIB_INTERACTION_HPP_
//------------------------------------------------------------------------------
// QVTK-Demo
//
// Copyright (c) 2017-2018 RWTH Aachen University, Germany,
// Virtual Reality & Immersive Visualisation Group.
//------------------------------------------------------------------------------
// License
//
// This framework is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In the future, we may decide to add a commercial license
// at our own discretion without further notice.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
#ifndef QVTK_LIB_INCLUDE_QVTK_LIB_MAIN_WIDGET_HPP_
#define QVTK_LIB_INCLUDE_QVTK_LIB_MAIN_WIDGET_HPP_
#include "qvtk-lib/visualize.hpp"
#include "qvtk-lib/interaction.hpp"
#include "QObject"
#include "include/qvtk-lib/suppress_warnings.hpp"
SUPPRESS_WARNINGS_BEGIN
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include "QVTKOpenGLWidget.h"
#include "vtkGenericOpenGLRenderWindow.h"
#pragma GCC diagnostic pop
SUPPRESS_WARNINGS_END
namespace vtkexp
{
class MainWidget : public QVTKOpenGLWidget
{
Q_OBJECT
public:
explicit MainWidget(PointData *points, QVTKOpenGLWidget *parent = 0);
~MainWidget() {}
void Rerender();
public slots: // NOLINT
void ChangeRendertype(int rendertype);
protected:
void mouseReleaseEvent(QMouseEvent *event) override;
private:
Visualize *vispoints_;
vtkSmartPointer<Interaction> style_;
vtkSmartPointer<vtkGenericOpenGLRenderWindow> renderwindow_;
};
} // namespace vtkexp
#endif // QVTK_LIB_INCLUDE_QVTK_LIB_MAIN_WIDGET_HPP_
//------------------------------------------------------------------------------
// QVTK-Demo
//
// Copyright (c) 2017-2018 RWTH Aachen University, Germany,
// Virtual Reality & Immersive Visualisation Group.
//------------------------------------------------------------------------------
// License
//
// This framework is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In the future, we may decide to add a commercial license
// at our own discretion without further notice.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
#ifndef QVTK_LIB_INCLUDE_QVTK_LIB_MAIN_WINDOW_HPP_
#define QVTK_LIB_INCLUDE_QVTK_LIB_MAIN_WINDOW_HPP_
#include "include/qvtk-lib/suppress_warnings.hpp"
#include "qvtk-lib/animate.hpp"
#include "qvtk-lib/main_widget.hpp"
SUPPRESS_WARNINGS_BEGIN
#include "qvtk-lib/point_data.hpp"
SUPPRESS_WARNINGS_END
#include "QComboBox"
#include "QGridLayout"
#include "QLabel"
#include "QLineEdit"
#include "QMainWindow"
#include "QPushButton"
#include "QSlider"
#include "QTimer"
namespace vtkexp
{
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(PointData *points);
~MainWindow() {}
QLineEdit *slider_line_edit_;
public slots: // NOLINT
void Rerender();
void Realtime();
void PlayPause();
void IncrementSlider();
void UpdateSlider();
void AdjustSlider();
void SliderValue();
void SliderValue(int time_step);
private:
void ConnectSignals();
void InitSlider(QSlider *slider);
void SetUpButtons();
void SetUpContent();
void SetUpLayout();
void SetUpLineEdit();
void SetUpSliders();
void SetUpVisualization();
void StartAnimation();
Animate *animation_;
PointData *points_;
QWidget *dummywidget_;
MainWidget *mainwidget_;
QComboBox *render_type_;
QComboBox *speed_menu_;
QPushButton *rt_button_;
QPushButton *play_button_;
QGridLayout *grid_;
QLabel *time_label_;
QSlider *time_slider_;
bool realtime_{true};
bool play_{true};
};
} // namespace vtkexp
#endif // QVTK_LIB_INCLUDE_QVTK_LIB_MAIN_WINDOW_HPP_
//------------------------------------------------------------------------------
// QVTK-Demo
//
// Copyright (c) 2017-2018 RWTH Aachen University, Germany,
// Virtual Reality & Immersive Visualisation Group.
//------------------------------------------------------------------------------
// License
//
// This framework is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In the future, we may decide to add a commercial license
// at our own discretion without further notice.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
#ifndef QVTK_LIB_INCLUDE_QVTK_LIB_POINT_DATA_HPP_
#define QVTK_LIB_INCLUDE_QVTK_LIB_POINT_DATA_HPP_
#include <vector>
#include "include/qvtk-lib/suppress_warnings.hpp"
SUPPRESS_WARNINGS_BEGIN
#include "qvtk-lib/data_stream.hpp"
#include "vtkDataObject.h"
#include "vtkFloatArray.h"
#include "vtkPolyData.h"
#include "vtkSmartPointer.h"
SUPPRESS_WARNINGS_END
namespace vtkexp
{
class PointData
{
public:
PointData(int num_x, int num_y, int num_z);
~PointData() {}
void Update(int time_step = -1);
vtkSmartPointer<vtkPolyData> GetPolyPoints();
vtkSmartPointer<vtkFloatArray> GetColors() const;
int GetEndTime() const;
int GetStartTime() const;
private:
void AttachColorsToPoints(const std::vector<double> &colors);
static vtkSmartPointer<vtkPoints> CreatePoints(int num_x, int num_y,
int num_z);
void Initialize(int x, int y, int z);
void ColorsModified();
DataStream *stream_;
int num_points_;
vtkSmartPointer<vtkPolyData> points_polydata_;
vtkSmartPointer<vtkFloatArray> pointcolors_;
};
} // namespace vtkexp
#endif // QVTK_LIB_INCLUDE_QVTK_LIB_POINT_DATA_HPP_
//------------------------------------------------------------------------------
// QVTK-Demo
//
// Copyright (c) 2017-2018 RWTH Aachen University, Germany,
// Virtual Reality & Immersive Visualisation Group.
//------------------------------------------------------------------------------
// License
//
// This framework is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In the future, we may decide to add a commercial license
// at our own discretion without further notice.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
#ifndef QVTK_LIB_INCLUDE_QVTK_LIB_VISUALIZE_HPP_
#define QVTK_LIB_INCLUDE_QVTK_LIB_VISUALIZE_HPP_
#include <string>
#include "include/qvtk-lib/suppress_warnings.hpp"
SUPPRESS_WARNINGS_BEGIN
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include "qvtk-lib/interaction.hpp"
#include "qvtk-lib/point_data.hpp"
#include "vtkActor.h"
#include "vtkAxesActor.h"
#include "vtkColorTransferFunction.h"
#include "vtkGenericOpenGLRenderWindow.h"
#include "vtkOrientationMarkerWidget.h"
#include "vtkPointGaussianMapper.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkRenderer.h"
#include "vtkScalarBarActor.h"
#include "vtkScalarBarWidget.h"
#include "vtkSmartPointer.h"
#pragma GCC diagnostic pop
SUPPRESS_WARNINGS_END
namespace vtkexp
{
class Visualize
{
public:
explicit Visualize(PointData *points);
~Visualize() {}
void Initialize(vtkSmartPointer<vtkGenericOpenGLRenderWindow> renderwindow,
vtkSmartPointer<vtkRenderWindowInteractor> interactor);
vtkSmartPointer<vtkRenderer> GetRenderer();
void SwitchMapper(int rendertype);
private:
void SetUpAxes();
void SetUpInteractor();
void SetUpLegend();
void SetUpMapper();
void SetUpRenderer();
void SetUpScene();
void SetUpShaders();
void SetUpTransferFunction();
PointData *points_;
std::string point_shader_;
std::string sphere_shader_;
vtkSmartPointer<vtkActor> actor_;
vtkSmartPointer<vtkRenderer> renderer_;
vtkSmartPointer<vtkRenderWindowInteractor> interactor_;
vtkSmartPointer<vtkGenericOpenGLRenderWindow> renderwindow_;
vtkSmartPointer<vtkPointGaussianMapper> mapper_;
vtkSmartPointer<vtkColorTransferFunction> transfer_function_;
vtkSmartPointer<vtkAxesActor> axes_;
vtkSmartPointer<vtkOrientationMarkerWidget> axes_widget_;
vtkSmartPointer<vtkScalarBarWidget> scalar_bar_widget_;
vtkSmartPointer<vtkScalarBarActor> scalar_bar_;
};
} // namespace vtkexp
#endif // QVTK_LIB_INCLUDE_QVTK_LIB_VISUALIZE_HPP_
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment