Commit fec981bf authored by Ken Martin's avatar Ken Martin
Browse files

Add back in LIC for OpenGL2

Change-Id: Ib635b7c83f7b061dcc47a28463ce4a326e4860c1
parent afde5294
......@@ -174,11 +174,11 @@ void vtkOpenGLStickMapper::ReplaceShaderValues(std::string &VSSource,
"//VTK::Picking::Impl",
"if (mapperIndex == vec3(0.0,0.0,0.0))\n"
" {\n"
" gl_FragColor = vec4(selectionIdFrag.rgb, 1.0);\n"
" gl_FragData[0] = vec4(selectionIdFrag.rgb, 1.0);\n"
" }\n"
" else\n"
" {\n"
" gl_FragColor = vec4(mapperIndex,1.0);\n"
" gl_FragData[0] = vec4(mapperIndex,1.0);\n"
" }"
);
}
......
......@@ -48,7 +48,7 @@ using std::deque;
#define vtkImageDataLIC2DDEBUG 0
#if (vtkImageDataLIC2DDEBUG >= 1)
#include "vtkTextureWriter.h"
#include "vtkTextureIO.h"
#endif
#define PRINTEXTENT(ext) \
......@@ -455,9 +455,9 @@ int vtkImageDataLIC2D::RequestData(
vecPBO->Delete();
#if (vtkImageDataLIC2DDEBUG >= 1)
vtkTextureWriter::WriteTexture(
"idlic2d_vectors.vtk",
vectorTex);
vtkTextureIO::Write(
"idlic2d_vectors.vtk",
vectorTex, NULL, NULL);
#endif
// magnify vectors
......@@ -513,9 +513,9 @@ int vtkImageDataLIC2D::RequestData(
}
#if (vtkImageDataLIC2DDEBUG >= 1)
vtkTextureWriter::WriteTexture(
"idlic2d_magvectors.vtk",
magVectorTex);
vtkTextureIO::Write(
"idlic2d_magvectors.vtk",
magVectorTex, NULL, NULL);
#endif
// send noise data to a texture
......@@ -549,9 +549,9 @@ int vtkImageDataLIC2D::RequestData(
noisePBO->Delete();
#if (vtkImageDataLIC2DDEBUG >= 1)
vtkTextureWriter::WriteTexture(
vtkTextureIO::Write(
"idlic2d_noise.vtk",
noiseTex);
noiseTex, NULL, NULL);
#endif
// step size conversion to normalize image space
......@@ -625,9 +625,9 @@ int vtkImageDataLIC2D::RequestData(
}
#if (vtkImageDataLIC2DDEBUG >= 1)
vtkTextureWriter::WriteTexture(
vtkTextureIO::Write(
"idlic2d_lic.vtk",
licTex);
licTex, NULL, NULL);
#endif
// transfer lic from texture to vtk array
......
set(Module_SRCS
vtkImageDataLIC2D.cxx
vtkLineIntegralConvolution2D.cxx
vtkPixelTransfer.cxx
vtkStructuredGridLIC2D.cxx
vtkSurfaceLICComposite.cxx
vtkSurfaceLICMapper.cxx
vtkCompositeSurfaceLICMapper.cxx
vtkTextureIO.cxx
)
set_source_files_properties(
vtkLineIntegralConvolution2D.cxx
vtkPixelTransfer.cxx
vtkSurfaceLICComposite.cxx
vtkTextureIO.cxx
WRAP_EXCLUDE
)
if (VTK_RENDERINGPARALLELLIC_SURFACELICPAINTER_TIMER)
add_definitions("-DvtkSurfaceLICPainterTIME")
endif()
if (VTK_RENDERINGPARALLELLIC_LINEINTEGRALCONVLOLUTION2D_TIMER)
add_definitions("-DvtkLineIntegralConvolution2DTIME")
endif()
set(shader_files
vtkLineIntegralConvolution2D_VT.glsl
vtkLineIntegralConvolution2D_LIC0.glsl
vtkLineIntegralConvolution2D_LICI.glsl
vtkLineIntegralConvolution2D_LICN.glsl
vtkLineIntegralConvolution2D_EE.glsl
vtkLineIntegralConvolution2D_CE.glsl
vtkLineIntegralConvolution2D_AAH.glsl
vtkLineIntegralConvolution2D_AAV.glsl
vtkStructuredGridLIC2D_fs.glsl
vtkSurfaceLICMapper_SC.glsl
vtkSurfaceLICMapper_CE.glsl
vtkSurfaceLICMapper_DCpy.glsl
)
unset(shader_h_files)
foreach(file ${shader_files})
get_filename_component(file_we ${file} NAME_WE)
set(src ${CMAKE_CURRENT_SOURCE_DIR}/${file})
set(res ${CMAKE_CURRENT_BINARY_DIR}/${file_we}.cxx)
set(resh ${CMAKE_CURRENT_BINARY_DIR}/${file_we}.h)
list(APPEND shader_h_files ${resh})
add_custom_command(
OUTPUT ${res} ${resh}
DEPENDS ${src} vtkEncodeString
COMMAND vtkEncodeString
ARGS ${res} ${src} ${file_we}
--build-header VTKRENDERINGLICOPENGL2_EXPORT vtkRenderingLICOpenGL2Module.h
)
list(APPEND Module_SRCS ${res})
set_source_files_properties(${file_we} WRAP_EXCLUDE)
endforeach()
vtk_module_library(${vtk-module} ${Module_SRCS})
include_directories(${OPENGL_INCLUDE_DIR})
# basic tests on the legacy filters
# excercises line integral convolution 2d
vtk_add_test_cxx(${vtk-module}CxxTests tests
TestImageDataLIC2D.cxx
TestStructuredGridLIC2DXSlice.cxx
TestStructuredGridLIC2DYSlice.cxx
TestStructuredGridLIC2DZSlice.cxx
)
# surface lic painter tests
# get decent coverage by calling
# varying arguments to the following
# test exec. to get unique test names
# avoid vtk_add_test_cxx and add exec
# and it's test cases manually
list(APPEND tests
TestSurfaceLIC
)
vtk_test_cxx_executable(${vtk-module}CxxTests tests
RENDERING_FACTORY
vtkStructuredGridLIC2DTestDriver.cxx
vtkSurfaceLICTestDriver.cxx
)
# surface lic on a curved surface
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-SurfaceLICCurvedDefaults
COMMAND ${vtk-module}CxxTests TestSurfaceLIC
-D ${VTK_TEST_DATA_DIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/TestSurfaceLICCurvedDefaults.png,:}"
--step-size=0.4
--num-steps=40
--camera-config=1
--data=${VTK_TEST_DATA_DIR}/Data/disk_out_ref_surface.vtp
--vectors=V
)
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-SurfaceLICCurvedContrastEnhancedBlended
COMMAND ${vtk-module}CxxTests TestSurfaceLIC
-D ${VTK_TEST_DATA_DIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/TestSurfaceLICCurvedContrastEnhancedBlended.png,:}"
--step-size=0.4
--num-steps=40
--camera-config=1
--data=${VTK_TEST_DATA_DIR}/Data/disk_out_ref_surface.vtp
--vectors=V
--enhance-contrast=1
--lic-intensity=0.8
)
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-SurfaceLICCurvedContrastEnhancedMapped
COMMAND ${vtk-module}CxxTests TestSurfaceLIC
-D ${VTK_TEST_DATA_DIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/TestSurfaceLICCurvedContrastEnhancedMapped.png,:}"
--step-size=0.4
--num-steps=40
--camera-config=1
--data=${VTK_TEST_DATA_DIR}/Data/disk_out_ref_surface.vtp
--vectors=V
--enhance-contrast=4
--color-mode=1
)
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-SurfaceLICCurvedEnhancedVectorNormalizeOff
COMMAND ${vtk-module}CxxTests TestSurfaceLIC
-D ${VTK_TEST_DATA_DIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/TestSurfaceLICCurvedEnhancedVectorNormalizeOff.png,:}"
--data=${VTK_TEST_DATA_DIR}/Data/disk_out_ref_surface.vtp
--camera-config=1
--vectors=V
--normalize-vectors=0
--step-size=0.5
--num-steps=800
--enhance-contrast=1
--color-mode=1
)
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-SurfaceLICCurvedContrastEnhancedBlendedSmallGrain
COMMAND ${vtk-module}CxxTests TestSurfaceLIC
-D ${VTK_TEST_DATA_DIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/TestSurfaceLICCurvedContrastEnhancedBlendedSmallGrain.png,:}"
--camera-config=1
--data=${VTK_TEST_DATA_DIR}/Data/disk_out_ref_surface.vtp
--vectors=V
--step-size=0.4
--num-steps=40
--generate-noise-texture=1
--noise-texture-size=200
--noise-grain-size=1
--number-of-noise-levels=1024
--noise-gen-seed=1
--enhance-contrast=1
--lic-intensity=0.8
)
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-SurfaceLICCurvedContrastEnhancedMappedSmallGrain
COMMAND ${vtk-module}CxxTests TestSurfaceLIC
-D ${VTK_TEST_DATA_DIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/TestSurfaceLICCurvedContrastEnhancedMappedSmallGrain.png,:}"
--camera-config=1
--data=${VTK_TEST_DATA_DIR}/Data/disk_out_ref_surface.vtp
--vectors=V
--step-size=0.4
--num-steps=40
--generate-noise-texture=1
--noise-texture-size=200
--noise-grain-size=1
--number-of-noise-levels=1024
--enhance-contrast=4
--color-mode=1
)
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-SurfaceLICCurvedContrastEnhancedMappedSmallVectorNormalizeOff
COMMAND ${vtk-module}CxxTests TestSurfaceLIC
-D ${VTK_TEST_DATA_DIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/TestSurfaceLICCurvedContrastEnhancedMappedSmallVectorNormalizeOff.png,:}"
--data=${VTK_TEST_DATA_DIR}/Data/disk_out_ref_surface.vtp
--camera-config=1
--vectors=V
--normalize-vectors=0
--step-size=0.5
--num-steps=800
--generate-noise-texture=1
--noise-texture-size=200
--noise-grain-size=1
--number-of-noise-levels=1024
--enhance-contrast=1
--low-lic-contrast-enhancement-factor=0.05
--color-mode=1
)
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-SurfaceLICCurvedDefaultsColor
COMMAND ${vtk-module}CxxTests TestSurfaceLIC
-D ${VTK_TEST_DATA_DIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/TestSurfaceLICCurvedDefaultsColor.png,:}"
--step-size=0.4
--num-steps=40
--camera-config=1
--data=${VTK_TEST_DATA_DIR}/Data/disk_out_ref_surface.vtp
--vectors=V
--color-by-mag=1
)
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-SurfaceLICCurvedContrastEnhancedColorBlendedSmallGrain
COMMAND ${vtk-module}CxxTests TestSurfaceLIC
-D ${VTK_TEST_DATA_DIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/TestSurfaceLICCurvedContrastEnhancedColorBlendedSmallGrain.png,:}"
--camera-config=1
--data=${VTK_TEST_DATA_DIR}/Data/disk_out_ref_surface.vtp
--vectors=V
--step-size=0.4
--num-steps=40
--generate-noise-texture=1
--noise-texture-size=200
--noise-grain-size=1
--number-of-noise-levels=1024
--noise-gen-seed=1
--enhance-contrast=1
--color-by-mag=1
--lic-intensity=0.6
)
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-SurfaceLICCurvedContrastEnhancedColorMappedSmallGrain
COMMAND ${vtk-module}CxxTests TestSurfaceLIC
-D ${VTK_TEST_DATA_DIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/TestSurfaceLICCurvedContrastEnhancedColorMappedSmallGrain.png,:}"
--camera-config=1
--data=${VTK_TEST_DATA_DIR}/Data/disk_out_ref_surface.vtp
--vectors=V
--step-size=0.4
--num-steps=40
--generate-noise-texture=1
--noise-texture-size=200
--noise-grain-size=1
--number-of-noise-levels=1024
--enhance-contrast=4
--color-by-mag=1
--color-mode=1
)
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-SurfaceLICCurvedContrastEnhancedColorBlendedSmallGrainMask
COMMAND ${vtk-module}CxxTests TestSurfaceLIC
-D ${VTK_TEST_DATA_DIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/TestSurfaceLICCurvedContrastEnhancedColorBlendedSmallGrainMask.png,:}"
--camera-config=1
--data=${VTK_TEST_DATA_DIR}/Data/disk_out_ref_surface.vtp
--vectors=V
--step-size=0.4
--num-steps=40
--generate-noise-texture=1
--noise-texture-size=200
--noise-grain-size=1
--number-of-noise-levels=1024
--noise-gen-seed=1
--enhance-contrast=1
--color-by-mag=1
--lic-intensity=0.6
--mask-intensity=0.2
--mask-color 1.0 1.0 1.0
)
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-SurfaceLICCurvedContrastEnhancedColorMappedSmallGrainMask
COMMAND ${vtk-module}CxxTests TestSurfaceLIC
-D ${VTK_TEST_DATA_DIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/TestSurfaceLICCurvedContrastEnhancedColorMappedSmallGrainMask.png,:}"
--camera-config=1
--data=${VTK_TEST_DATA_DIR}/Data/disk_out_ref_surface.vtp
--vectors=V
--step-size=0.4
--num-steps=40
--generate-noise-texture=1
--noise-texture-size=200
--noise-grain-size=1
--number-of-noise-levels=1024
--enhance-contrast=1
--high-lic-contrast-enhancement-factor=0.1
--color-by-mag=1
--color-mode=1
--map-mode-bias=0.05
--mask-intensity=0.2
--mask-color 1.0 1.0 1.0
)
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-SurfaceLICCurvedContrastEnhancedSmallGrainMask
COMMAND ${vtk-module}CxxTests TestSurfaceLIC
-D ${VTK_TEST_DATA_DIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/TestSurfaceLICCurvedContrastEnhancedSmallGrainMask.png,:}"
--camera-config=1
--data=${VTK_TEST_DATA_DIR}/Data/disk_out_ref_surface.vtp
--vectors=V
--normalize-vectors=0
--step-size=0.5
--num-steps=800
--generate-noise-texture=1
--noise-texture-size=200
--noise-grain-size=1
--number-of-noise-levels=1024
--enhance-contrast=1
--low-lic-contrast-enhancement-factor=0.05
--color-mode=1
--map-mode-bias=0.05
--mask-intensity=0.2
)
# surface lic on a slice
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-SurfaceLICPlanarDefaults
COMMAND ${vtk-module}CxxTests TestSurfaceLIC
-D ${VTK_TEST_DATA_DIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/TestSurfaceLICPlanarDefaults.png,:}"
--data=${VTK_TEST_DATA_DIR}/Data/SurfaceVectors.vtk
--camera-config=3
--vectors=V
--step-size=1
--num-steps=40
--lic-intensity=0.8
)
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-SurfaceLICPlanarContrastEnhanced
COMMAND ${vtk-module}CxxTests TestSurfaceLIC
-D ${VTK_TEST_DATA_DIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/TestSurfaceLICPlanarContrastEnhanced.png,:}"
--data=${VTK_TEST_DATA_DIR}/Data/SurfaceVectors.vtk
--camera-config=3
--vectors=V
--step-size=1
--num-steps=40
--enhance-contrast=1
--color-mode=1
)
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-SurfaceLICPlanarVectorNormalizeOff
COMMAND ${vtk-module}CxxTests TestSurfaceLIC
-D ${VTK_TEST_DATA_DIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/TestSurfaceLICPlanarVectorNormalizeOff.png,:}"
--data=${VTK_TEST_DATA_DIR}/Data/SurfaceVectors.vtk
--camera-config=3
--vectors=V
--normalize-vectors=0
--step-size=0.5
--num-steps=2000
--generate-noise-texture=1
--noise-texture-size=128
--noise-grain-size=2
--number-of-noise-levels=256
--noise-gen-seed=12367
--enhance-contrast=1
--color-by-mag=1
--color-mode=1
)
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-SurfaceLICPlanarVectorNormalizeOffMediumGrainUniform
COMMAND ${vtk-module}CxxTests TestSurfaceLIC
-D ${VTK_TEST_DATA_DIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/TestSurfaceLICPlanarVectorNormalizeOffMediumGrainUniform.png,:}"
--data=${VTK_TEST_DATA_DIR}/Data/SurfaceVectors.vtk
--camera-config=3
--vectors=V
--enhanced-lic=0
--step-size=0.25
--num-steps=40
--generate-noise-texture=1
--noise-type=1
--noise-texture-size=128
--noise-grain-size=2
--impulse-noise-prob=0.04
--enhance-contrast=4
--high-color-contrast-enhancement-factor=0.2
--color-by-mag=1
--color-mode=1
)
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-SurfaceLICPlanarVectorNormalizeOffMediumGrainPerlin
COMMAND ${vtk-module}CxxTests TestSurfaceLIC
-D ${VTK_TEST_DATA_DIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/TestSurfaceLICPlanarVectorNormalizeOffMediumGrainPerlin.png,:}"
--data=${VTK_TEST_DATA_DIR}/Data/SurfaceVectors.vtk
--camera-config=3
--vectors=V
--normalize-vectors=0
--step-size=2
--num-steps=400
--generate-noise-texture=1
--noise-type=2
--noise-texture-size=256
--noise-grain-size=8
--max-noise-value=0.8
--enhance-contrast=4
--color-by-mag=1
--color-mode=1
--anti-alias=1
)
ExternalData_add_test(VTKData
NAME ${vtk-module}Cxx-SurfaceLICMultiBlockContrastEnhancedPerlin
COMMAND ${vtk-module}CxxTests TestSurfaceLIC
-D ${VTK_TEST_DATA_DIR}
-T ${VTK_TEST_OUTPUT_DIR}
-V "DATA{${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline/TestSurfaceLICMultiBlockContrastEnhancedPerlin.png,:}"
--data=${VTK_TEST_DATA_DIR}/Data/ex-blow_5.vtm
--camera-config=4
--vectors=DISPLACEMENT_
--step-size=0.1
--num-steps=50
--generate-noise-texture=1
--noise-type=2
--noise-texture-size=128
--noise-grain-size=2
--number-of-noise-levels=1024
--noise-gen-seed=1
--enhance-contrast=4
--color-by-mag=1
--color-mode=1
--map-mode-bias=0.1
--mask-on-surface=1
--mask-intensity=0.41
--mask-color 0 0 0
)
/*=========================================================================
Program: Visualization Toolkit
Module: TestImageDataLIC2D.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "TestImageDataLIC2D.h"
#include "vtkGenericDataObjectReader.h"
#include "vtkImageDataLIC2D.h"
#include "vtkPixelExtent.h"
#include "vtkPixelTransfer.h"
#include "vtkImageData.h"
#include "vtkPointData.h"
#include "vtkUnsignedCharArray.h"
#include "vtkFloatArray.h"
#include "vtkImageIterator.h"
#include "vtkImagePermute.h"
#include "vtkImageShiftScale.h"
#include "vtkPNGReader.h"
#include "vtkPNGWriter.h"
#include "vtkDataSetWriter.h"
#include "vtkProbeFilter.h"
#include "vtkRenderWindow.h"
#include "vtkSmartPointer.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtkStructuredData.h"
#include "vtkTimerLog.h"
#include "vtkUnstructuredGrid.h"
#include "vtkTestUtilities.h"
#include "vtkRegressionTestImage.h"
#include "vtkTesting.h"
#include <vtksys/CommandLineArguments.hxx>
#include "vtkImageMapToColors.h"
#include "vtkLookupTable.h"
#include "vtkTrivialProducer.h"
#include <vtksys/SystemTools.hxx>
#include <sstream>
using std::ostringstream;
//-----------------------------------------------------------------------------
int TestImageDataLIC2D(int argc, char* argv[])
{
char* fname =
vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/SurfaceVectors.vtk");
std::string filename = fname;
filename = "--data=" + filename;
delete [] fname;
fname = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/noise.png");
std::string noise = fname;
noise = "--noise=" + noise;
delete [] fname;
char** new_argv = new char*[argc+10];
for (int cc=0; cc < argc; cc++)
{
new_argv[cc] = vtksys::SystemTools::DuplicateString(argv[cc]);
}
new_argv[argc++] = vtksys::SystemTools::DuplicateString(filename.c_str());
new_argv[argc++] = vtksys::SystemTools::DuplicateString(noise.c_str());
new_argv[argc++] = vtksys::SystemTools::DuplicateString("--mag=5");
new_argv[argc++] = vtksys::SystemTools::DuplicateString("--partitions=5");
int status = ImageDataLIC2D(argc, new_argv);
for (int kk=0; kk < argc; kk++)
{
delete [] new_argv[kk];
}
delete [] new_argv;
return status;
}
// Example demonstrating use of vtkImageDataLIC2D filter.
// Typical usage:
// ./bin/ImageDataLIC2D --data=<vtk file> --output=<png file>
//-----------------------------------------------------------------------------
int ImageDataLIC2D(int argc, char* argv[])
{
std::string filename;
std::string noise_filename;
int resolution = 10;
int magnification = 1;
std::string outputpath;
int num_partitions = 1;
int num_steps = 40;
vtksys::CommandLineArguments arg;
arg.StoreUnusedArguments(1);
arg.Initialize(argc, argv);
typedef vtksys::CommandLineArguments argT;
arg.AddArgument("--data", argT::EQUAL_ARGUMENT, &filename,
"(required) Enter dataset to load (currently only *.vtk files are supported");
arg.AddArgument("--res", argT::EQUAL_ARGUMENT, &resolution,
"(optional: default 10) Number of sample per unit distance");
arg.AddArgument("--mag", argT::EQUAL_ARGUMENT, &magnification,
"(optional: default 1) Magnification");
arg.AddArgument("--output", argT::EQUAL_ARGUMENT, &outputpath,
"(optional) Output png image");