Commit 17fb7679 authored by Andrew Wilson's avatar Andrew Wilson
Browse files

ENH: Texture projection operation, input geometry filter requirements

parent 73f737be
......@@ -15,13 +15,13 @@ macro(imstk_add_executable target)
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall -Wno-unused-function -fdiagnostics-color=always>
$<$<CXX_COMPILER_ID:MSVC>:
-W4 -MP>)
-W4 -MP -wd4505>)
else()
target_compile_options(${target} PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall -Wno-unused-function>
$<$<CXX_COMPILER_ID:MSVC>:
-W4 -MP>)
-W4 -MP -wd4505>)
endif()
set_target_properties(${target} PROPERTIES
......
......@@ -96,13 +96,13 @@ function(imstk_add_library target)
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall -Wno-unused-function -fdiagnostics-color=always>
$<$<CXX_COMPILER_ID:MSVC>:
-W4 -MP>)
-W4 -MP -wd4505>)
else()
target_compile_options(${target} PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall -Wno-unused-function>
$<$<CXX_COMPILER_ID:MSVC>:
-W4 -MP>)
-W4 -MP -wd4505>)
endif()
#-----------------------------------------------------------------------------
......
......@@ -406,6 +406,7 @@ add_subdirectory(Source/SimulationManager)
add_subdirectory(Source/apiUtilities)
add_subdirectory(Source/Pulse)
add_subdirectory(Source/Filtering)
add_subdirectory(Source/FilteringCore)
#--------------------------------------------------------------------------
# Add Examples subdirectories
......
......@@ -234,4 +234,41 @@ mat4dTRS(const Mat4d& m, Vec3d& t, Mat3d& r, Vec3d& s)
t = m.block<3, 1>(0, 3);
}
///
/// \brief Compute bary centric coordinates (u,v,w) given triangle in 2d space (and point p on triangle)
///
static Vec3d
baryCentric(const Vec2d& p, const Vec2d& a, const Vec2d& b, const Vec2d& c)
{
const Vec2d v0 = b - a;
const Vec2d v1 = c - a;
const Vec2d v2 = p - a;
const double den = v0[0] * v1[1] - v1[0] * v0[1];
const double v = (v2[0] * v1[1] - v1[0] * v2[1]) / den;
const double w = (v0[0] * v2[1] - v2[0] * v0[1]) / den;
const double u = 1.0 - v - w;
return Vec3d(u, v, w);
}
///
/// \brief Compute bary centric coordinates (u,v,w) given triangle in 3d space (and point p on triangle)
///
static Vec3d
baryCentric(const Vec3d& p, const Vec3d& a, const Vec3d& b, const Vec3d& c)
{
const Vec3d v0 = b - a;
const Vec3d v1 = c - a;
const Vec3d v2 = p - a;
const double d00 = v0.dot(v0);
const double d01 = v0.dot(v1);
const double d11 = v1.dot(v1);
const double d20 = v2.dot(v0);
const double d21 = v2.dot(v1);
const double denom = d00 * d11 - d01 * d01;
const double v = (d11 * d20 - d01 * d21) / denom;
const double w = (d00 * d21 - d01 * d20) / denom;
const double u = 1.0 - v - w;
return Vec3d(u, v, w);
}
}
\ No newline at end of file
......@@ -11,6 +11,5 @@ imstk_add_library( Filtering
CPP_FILES
${cppFiles}
DEPENDS
Geometry
DataStructures
${VTK_LIBRARIES})
FilteringCore
${VTK_LIBRARIES})
\ No newline at end of file
......@@ -31,6 +31,8 @@ namespace imstk
{
CleanMesh::CleanMesh()
{
setInputPortReq<SurfaceMesh>(0);
setNumberOfInputPorts(1);
setNumberOfOutputPorts(1);
setOutput(std::make_shared<SurfaceMesh>());
......
......@@ -32,6 +32,8 @@ namespace imstk
{
ExtractEdges::ExtractEdges()
{
setInputPortReq<SurfaceMesh>(0);
setNumberOfInputPorts(1);
setNumberOfOutputPorts(1);
setOutput(std::make_shared<LineMesh>());
......
......@@ -34,6 +34,8 @@ namespace imstk
{
ImageDistanceTransform::ImageDistanceTransform()
{
setInputPortReq<ImageData>(0);
setNumberOfInputPorts(1);
setNumberOfOutputPorts(1);
setOutput(std::make_shared<ImageData>(), 0);
......
......@@ -32,6 +32,8 @@ namespace imstk
{
ImageGradient::ImageGradient()
{
setInputPortReq<ImageData>(0);
setNumberOfInputPorts(1);
setNumberOfOutputPorts(1);
setOutput(std::make_shared<PointSet>());
......
......@@ -33,6 +33,8 @@ namespace imstk
{
ImageResample::ImageResample()
{
setInputPortReq<ImageData>(0);
setNumberOfInputPorts(1);
setNumberOfOutputPorts(1);
setOutput(std::make_shared<ImageData>());
......
......@@ -32,6 +32,8 @@ namespace imstk
{
ImageReslice::ImageReslice()
{
setInputPortReq<ImageData>(0);
setNumberOfInputPorts(1);
setNumberOfOutputPorts(1);
setOutput(std::make_shared<ImageData>());
......
......@@ -30,6 +30,8 @@ namespace imstk
{
ImplicitGeometryToImageData::ImplicitGeometryToImageData()
{
setInputPortReq<ImplicitGeometry>(0);
setNumberOfInputPorts(1);
setNumberOfOutputPorts(1);
setOutput(std::make_shared<ImageData>());
......
......@@ -360,6 +360,8 @@ lerp(double val1, double val2, double isovalue, double spacing)
LocalMarchingCubes::LocalMarchingCubes()
{
setInputPortReq<ImageData>(0);
setNumberOfInputPorts(1);
setNumberOfOutputPorts(0);
}
......
......@@ -31,6 +31,8 @@ namespace imstk
QuadricDecimate::QuadricDecimate() :
m_VolumePreserving(true), m_TargetReduction(0.6)
{
setInputPortReq<SurfaceMesh>(0);
setNumberOfInputPorts(1);
setNumberOfOutputPorts(1);
setOutput(std::make_shared<SurfaceMesh>());
......
......@@ -32,6 +32,9 @@ namespace imstk
{
SelectEnclosedPoints::SelectEnclosedPoints()
{
setInputPortReq<SurfaceMesh>(0);
setInputPortReq<PointSet>(1);
setNumberOfInputPorts(2);
setNumberOfOutputPorts(1);
setOutput(std::make_shared<PointSet>());
......
......@@ -32,6 +32,8 @@ namespace imstk
{
SurfaceMeshCut::SurfaceMeshCut()
{
setInputPortReq<SurfaceMesh>(0);
setNumberOfInputPorts(1);
setNumberOfOutputPorts(1);
setOutput(std::make_shared<SurfaceMesh>());
......
......@@ -201,6 +201,8 @@ computeFullDT(std::shared_ptr<ImageData> imageData, std::shared_ptr<SurfaceMesh>
SurfaceMeshDistanceTransform::SurfaceMeshDistanceTransform()
{
setInputPortReq<SurfaceMesh>(0);
setNumberOfInputPorts(1);
setNumberOfOutputPorts(1);
setOutput(std::make_shared<ImageData>(), 0);
......
......@@ -32,6 +32,8 @@ namespace imstk
{
SurfaceMeshFlyingEdges::SurfaceMeshFlyingEdges()
{
setInputPortReq<ImageData>(0);
setNumberOfInputPorts(1);
setNumberOfOutputPorts(1);
setOutput(std::make_shared<SurfaceMesh>());
......
......@@ -35,6 +35,9 @@ namespace imstk
{
SurfaceMeshImageMask::SurfaceMeshImageMask()
{
setInputPortReq<SurfaceMesh>(0);
setInputPortReq<ImageData>(1);
setNumberOfInputPorts(2);
setNumberOfOutputPorts(1);
setOutput(std::make_shared<ImageData>(), 0);
......
......@@ -30,6 +30,8 @@ namespace imstk
{
SurfaceMeshSmoothen::SurfaceMeshSmoothen()
{
setInputPortReq<SurfaceMesh>(0);
setNumberOfInputPorts(1);
setNumberOfOutputPorts(1);
setOutput(std::make_shared<SurfaceMesh>());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment