Skip to content
Snippets Groups Projects
Commit 136ca128 authored by vr-group's avatar vr-group
Browse files

Merge branch 'develop'

parents e0885803 81aed01c
No related branches found
No related tags found
No related merge requests found
...@@ -122,6 +122,8 @@ std::int32_t main(std::int32_t argc, char** argv) ...@@ -122,6 +122,8 @@ std::int32_t main(std::int32_t argc, char** argv)
std::cout << "Loading next slice: " << slice << ".\n"; std::cout << "Loading next slice: " << slice << ".\n";
geometry_reader->SetFileName (settings.data_file_paths[slice].geometry.c_str()); geometry_reader->SetFileName (settings.data_file_paths[slice].geometry.c_str());
geometry_mapper->SetInputConnection (geometry_reader->GetOutputPort()); geometry_mapper->SetInputConnection (geometry_reader->GetOutputPort());
geometry_mapper->SetScalarVisibility (false);
actor ->GetProperty ()->SetColor(1.0f, 1.0f, 0.0f);
actor ->SetMapper (geometry_mapper); actor ->SetMapper (geometry_mapper);
actor_property ->SetInterpolation (VTK_PBR); actor_property ->SetInterpolation (VTK_PBR);
renderer ->AddActor (actor); renderer ->AddActor (actor);
......
[ [
{ {
"ColorSpace" : "Diverging", "ColorSpace" : "Diverging",
"Name" : "OxyNew3", "Name" : "Oxy88",
"Points" : "Points" :
[ [
0.0, 0.0,
...@@ -40,12 +40,12 @@ ...@@ -40,12 +40,12 @@
0.0, 0.0,
0.60714274644851685, 0.60714274644851685,
0.0, 0.0,
0.90000000000000002, 0.97937858104705811,
0.52500003576278687, 0.5,
0.5, 0.5,
0.0, 0.0,
0.90000000000000002, 0.98022603988647461,
0.98750001192092896, 1.0,
0.5, 0.5,
0.0, 0.0,
1.0, 1.0,
...@@ -59,26 +59,18 @@ ...@@ -59,26 +59,18 @@
1.0, 1.0,
1.0, 1.0,
1.0, 1.0,
0.0094339624047279358, 0.01,
1.0, 0.98039215686274506,
0.96470588235294119,
0.9137254901960784,
0.014999999999999999,
0.52549019607843139,
0.054901960784313725,
0.23921568627450981,
1.0, 1.0,
1.0,
0.0094339624047279358,
0.50980392156862742,
0.058823529411764705,
0.0078431372549019607,
0.90000000000000002,
0.49019607843137253, 0.49019607843137253,
0.0, 0.0,
0.0, 0.23529411764705882
0.92000000000000004,
1.0,
1.0,
0.0,
1.0,
1.0,
1.0,
0.0
] ]
} }
] ]
......
[
{
"ColorSpace" : "Diverging",
"Name" : "Oxy77",
"Points" :
[
0.0,
0.0,
0.5,
0.0,
0.0014124293811619282,
0.0,
0.5,
0.0,
0.008192090317606926,
0.012500000186264515,
0.5,
0.0,
0.016384180635213852,
0.037500001490116119,
0.5,
0.0,
0.023163842037320137,
0.10000000149011612,
0.5,
0.0,
0.028248587623238564,
0.22500000894069672,
0.5,
0.0,
0.030225988477468491,
0.40000000596046448,
0.5,
0.0,
0.073728814721107483,
0.5,
0.5,
0.0,
0.074576273560523987,
0.0,
0.60714274644851685,
0.0,
0.97937858104705811,
0.5,
0.5,
0.0,
0.98022603988647461,
1.0,
0.5,
0.0,
1.0,
1.0,
0.5,
0.0
],
"RGBPoints" :
[
0.0,
1.0,
1.0,
1.0,
0.01,
0.98039215686274506,
0.96470588235294119,
0.9137254901960784,
0.02,
0.52549019607843139,
0.054901960784313725,
0.23921568627450981,
1.0,
0.49019607843137253,
0.0,
0.23529411764705882
]
}
]
[
{
"ColorSpace" : "Diverging",
"Name" : "OxyNew6",
"Points" :
[
0.0,
0.0,
0.5,
0.0,
0.0014124293811619245,
0.0,
0.5,
0.0,
0.008192090317606926,
0.012500000186264515,
0.5,
0.0,
0.016384180635213852,
0.037500001490116119,
0.5,
0.0,
0.023163842037320137,
0.10000000149011612,
0.5,
0.0,
0.028248587623238564,
0.22500000894069672,
0.5,
0.0,
0.030225988477468491,
0.40000000596046448,
0.5,
0.0,
0.073728814721107483,
0.5,
0.5,
0.0,
0.074576273560523987,
0.0,
0.60714274644851685,
0.0,
0.97937858104705811,
0.5,
0.5,
0.0,
0.98022603988647461,
1.0,
0.5,
0.0,
1.0,
1.0,
0.5,
0.0
],
"RGBPoints" :
[
0.0,
1.0,
1.0,
1.0,
0.02,
0.98039215686274506,
0.96470588235294119,
0.9137254901960784,
0.050000000000000003,
0.52549019607843139,
0.054901960784313725,
0.23921568627450981,
1.0,
0.49019607843137253,
0.0,
0.23529411764705882
]
}
]
[
{
"ColorSpace" : "Diverging",
"Name" : "OxyNew3",
"Points" :
[
0.0,
0.0,
0.5,
0.0,
0.0014124293811619282,
0.0,
0.5,
0.0,
0.008192090317606926,
0.012500000186264515,
0.5,
0.0,
0.016384180635213852,
0.037500001490116119,
0.5,
0.0,
0.023163842037320137,
0.10000000149011612,
0.5,
0.0,
0.028248587623238564,
0.22500000894069672,
0.5,
0.0,
0.030225988477468491,
0.40000000596046448,
0.5,
0.0,
0.073728814721107483,
0.5,
0.5,
0.0,
0.074576273560523987,
0.0,
0.60714274644851685,
0.0,
0.90000000000000002,
0.52500003576278687,
0.5,
0.0,
0.90000000000000002,
0.98750001192092896,
0.5,
0.0,
1.0,
1.0,
0.5,
0.0
],
"RGBPoints" :
[
0.0,
1.0,
1.0,
1.0,
0.0094339624047279358,
1.0,
1.0,
1.0,
0.0094339624047279358,
0.50980392156862742,
0.058823529411764705,
0.0078431372549019607,
0.90000000000000002,
0.49019607843137253,
0.0,
0.0,
0.92000000000000004,
1.0,
1.0,
0.0,
1.0,
1.0,
1.0,
0.0
]
}
]
[
{
"ColorSpace" : "Diverging",
"Name" : "OxyNew4",
"Points" :
[
0.0,
0.0,
0.5,
0.0,
0.0014124293811619535,
0.0,
0.5,
0.0,
0.008192090317606926,
0.012500000186264515,
0.5,
0.0,
0.016384180635213852,
0.037500001490116119,
0.5,
0.0,
0.023163842037320137,
0.10000000149011612,
0.5,
0.0,
0.028248587623238564,
0.22500000894069672,
0.5,
0.0,
0.030225988477468491,
0.40000000596046448,
0.5,
0.0,
0.073728814721107483,
0.5,
0.5,
0.0,
0.074576273560523987,
0.0,
0.51019096374511719,
0.0,
0.94654083251953125,
0.52500003576278687,
0.5,
0.0,
0.94654083251953125,
1.0,
0.5,
0.0,
1.0,
1.0,
0.5,
0.0
],
"RGBPoints" :
[
0.0,
1.0,
1.0,
1.0,
0.012578615918755531,
1.0,
1.0,
1.0,
0.012578615918755531,
0.50588235294117645,
0.043137254901960784,
0.23921568627450981,
1.0,
0.47058823529411764,
0.0,
0.23529411764705882
]
}
]
*build/*
\ No newline at end of file
################################################## Project ##################################################
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project (vtu_to_vti_converter VERSION 1.0 LANGUAGES C CXX)
list (APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
set (CMAKE_CXX_STANDARD 17)
include (set_max_warning_level)
set_max_warning_level ()
################################################## Sources ##################################################
file(GLOB_RECURSE PROJECT_HEADERS include/*.h include/*.hpp)
file(GLOB_RECURSE PROJECT_SOURCES source/*.c source/*.cpp)
file(GLOB_RECURSE PROJECT_CMAKE_UTILS cmake/*.cmake)
file(GLOB_RECURSE PROJECT_MISC *.md *.txt)
set (PROJECT_FILES
${PROJECT_HEADERS}
${PROJECT_SOURCES}
${PROJECT_CMAKE_UTILS}
${PROJECT_MISC})
include (assign_source_group)
assign_source_group(${PROJECT_FILES})
################################################## Dependencies ##################################################
include(import_library)
find_package(VTK REQUIRED NO_MODULE)
include (${VTK_USE_FILE})
list (APPEND PROJECT_LIBRARIES ${VTK_LIBRARIES})
################################################## Targets ##################################################
add_executable(${PROJECT_NAME} ${PROJECT_FILES})
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<INSTALL_INTERFACE:include> PRIVATE source)
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_INCLUDE_DIRS})
target_link_libraries (${PROJECT_NAME} PUBLIC ${PROJECT_LIBRARIES})
target_compile_definitions(${PROJECT_NAME} PUBLIC ${PROJECT_COMPILE_DEFINITIONS})
set_target_properties (${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
vtk_module_autoinit (TARGETS ${PROJECT_NAME} MODULES ${VTK_LIBRARIES})
if(NOT BUILD_SHARED_LIBS)
string (TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER)
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS -D${PROJECT_NAME_UPPER}_STATIC)
endif()
################################################## Installation ##################################################
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-config
RUNTIME DESTINATION bin)
install(DIRECTORY include/ DESTINATION include)
install(EXPORT ${PROJECT_NAME}-config DESTINATION cmake)
export (TARGETS ${PROJECT_NAME} FILE ${PROJECT_NAME}-config.cmake)
# Assigns the given files to source groups identical to their location.
function(assign_source_group)
foreach(_SOURCE IN ITEMS ${ARGN})
if (IS_ABSOLUTE "${_SOURCE}")
file(RELATIVE_PATH _SOURCE_REL "${CMAKE_CURRENT_SOURCE_DIR}" "${_SOURCE}")
else()
set(_SOURCE_REL "${_SOURCE}")
endif()
get_filename_component(_SOURCE_PATH "${_SOURCE_REL}" PATH)
if(WIN32)
string(REPLACE "/" "\\" _SOURCE_PATH_MSVC "${_SOURCE_PATH}")
source_group("${_SOURCE_PATH_MSVC}" FILES "${_SOURCE}")
else()
source_group("${_SOURCE_PATH}" FILES "${_SOURCE}")
endif()
endforeach()
endfunction(assign_source_group)
# Imports a library which is not built with cmake.
# The include directories are appended to the PROJECT_INCLUDE_DIRS variable.
# The libraries are appended to the PROJECT_LIBRARIES variable.
# Usage:
# Header Only:
# import_library(INCLUDE_DIRS)
# Identical Debug and Release:
# import_library(INCLUDE_DIRS LIBRARIES)
# Separate Debug and Release:
# import_library(INCLUDE_DIRS DEBUG_LIBRARIES RELEASE_LIBRARIES)
function(import_library INCLUDE_DIRS)
set (PROJECT_INCLUDE_DIRS ${PROJECT_INCLUDE_DIRS} ${${INCLUDE_DIRS}} PARENT_SCOPE)
set (_EXTRA_ARGS ${ARGN})
list(LENGTH _EXTRA_ARGS _EXTRA_ARGS_LENGTH)
if (_EXTRA_ARGS_LENGTH EQUAL 1)
list(GET _EXTRA_ARGS 0 _LIBRARIES)
set (PROJECT_LIBRARIES ${PROJECT_LIBRARIES} ${${_LIBRARIES}} PARENT_SCOPE)
elseif(_EXTRA_ARGS_LENGTH EQUAL 2)
list(GET _EXTRA_ARGS 0 _DEBUG_LIBRARIES )
list(GET _EXTRA_ARGS 1 _RELEASE_LIBRARIES)
set (PROJECT_LIBRARIES ${PROJECT_LIBRARIES} debug ${${_DEBUG_LIBRARIES}} optimized ${${_RELEASE_LIBRARIES}} PARENT_SCOPE)
endif ()
endfunction(import_library)
function(set_max_warning_level)
if(MSVC)
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif()
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic")
endif()
endfunction()
\ No newline at end of file
#include <cstdint>
#include <string>
#include <vtkDataObject.h>
#include <vtkResampleToImage.h>
#include <vtkSmartPointer.h>
#include <vtkXMLImageDataWriter.h>
#include <vtkXMLUnstructuredGridReader.h>
// Usage: ./vtu_to_vti_converter [VTU_FILEPATH] [X_RESOLUTION] [Y_RESOLUTION] [Z_RESOLUTION].
std::int32_t main(std::int32_t argc, char** argv)
{
auto filepath = std::string(argv[1]);
auto reader = vtkSmartPointer<vtkXMLUnstructuredGridReader>::New();
auto converter = vtkSmartPointer<vtkResampleToImage> ::New();
auto writer = vtkSmartPointer<vtkXMLImageDataWriter> ::New();
reader ->SetFileName (filepath.c_str());
reader ->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, "Q");
converter->SetInputConnection (reader->GetOutputPort());
converter->SetUseInputBounds (true);
converter->SetSamplingDimensions (std::stoi(argv[2]), std::stoi(argv[3]), std::stoi(argv[4]));
writer ->SetInputConnection (converter->GetOutputPort());
writer ->SetFileName ((filepath.substr(0, filepath.size() - 3) + std::string("vti")).c_str());
writer ->Update ();
return 0;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment