Skip to content

Commit eb8b6a7

Browse files
authored
Merge pull request #16 from InsightSoftwareConsortium/wipTest
2 parents ce05a8a + f6b5bc4 commit eb8b6a7

File tree

7 files changed

+3451
-16
lines changed

7 files changed

+3451
-16
lines changed

.github/workflows/build-test-package.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ on: [push,pull_request]
44

55
jobs:
66
cxx-build-workflow:
7-
uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/[email protected].0
7+
uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/[email protected].4
88

99
python-build-workflow:
10-
uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/[email protected].0
10+
uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/[email protected].4
1111
secrets:
1212
pypi_password: ${{ secrets.pypi_password }}

.github/workflows/clang-format-linter.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v1
10+
- uses: actions/checkout@v4
1111

1212
- uses: InsightSoftwareConsortium/ITKClangFormatLinterAction@master
13+
with:
14+
itk-branch: main

itk-module.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ itk_module(Fpfh
1919
TEST_DEPENDS
2020
ITKTestKernel
2121
ITKMetaIO
22+
ITKIOMeshBase
2223
DESCRIPTION
2324
"${DOCUMENTATION}"
2425
EXCLUDE_FROM_DEFAULT

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ build-backend = "scikit_build_core.build"
44

55
[project]
66
name = "itk-fpfh"
7-
version = "0.2.0"
7+
version = "0.2.1"
88
description = "The feature points could be used obtain salient points while performing registration using RANSAC remote module. The class PointFeature is the main driver that takes a PointSet as argument. Please refer to the documentation for a detailed description and sample usage: https://github.com/InsightSoftwareConsortium/ITKFPFH"
99
readme = "README.md"
1010
license = {file = "LICENSE"}
1111
authors = [
1212
{ name = "Pranjal Sahu", email = "[email protected]" },
13+
{ name = "Dženan Zukić", email = "[email protected]" },
1314
]
1415
keywords = [
1516
"itk",
@@ -33,7 +34,7 @@ classifiers = [
3334
"Topic :: Scientific/Engineering :: Medical Science Apps.",
3435
"Topic :: Software Development :: Libraries",
3536
]
36-
requires-python = ">=3.8"
37+
requires-python = ">=3.9"
3738
dependencies = [
3839
"itk == 5.4.*",
3940
]

test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ CreateTestDriver(Fpfh "${Fpfh-Test_LIBRARIES}" "${FpfhTests}")
1010
itk_add_test(NAME itkPointFeatureTest
1111
COMMAND FpfhTestDriver
1212
itkPointFeatureTest
13-
${ITK_TEST_OUTPUT_DIR}/itkPointFeatureTestOutput.mha
13+
DATA{Input/WSB_subsampled.vtk}
1414
)

test/Input/WSB_subsampled.vtk

Lines changed: 3355 additions & 0 deletions
Large diffs are not rendered by default.

test/itkPointFeatureTest.cxx

Lines changed: 86 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,47 @@
1919
#include "itkPointFeature.h"
2020
#include "itkPointSet.h"
2121
#include "itkTestingMacros.h"
22+
#include "itkMesh.h"
23+
#include "itkVector.h"
24+
#include "itkMeshFileReader.h"
25+
26+
27+
namespace
28+
{
29+
constexpr unsigned int Dimension = 3;
30+
using CoordType = double;
31+
using VectorType = itk::Vector<CoordType, Dimension>;
32+
using MeshType = itk::Mesh<CoordType, Dimension, itk::DefaultStaticMeshTraits<VectorType, Dimension>>;
33+
constexpr unsigned numDebugPoints = 10;
34+
35+
MeshType::Pointer
36+
ReadMesh(std::string filename)
37+
{
38+
using ReaderType = itk::MeshFileReader<MeshType>;
39+
ReaderType::Pointer reader = ReaderType::New();
40+
reader->SetFileName(filename);
41+
reader->Update();
42+
MeshType::Pointer output = reader->GetOutput();
43+
output->DisconnectPipeline();
44+
return output;
45+
}
46+
47+
int
48+
BasicTests()
49+
{
50+
using PixelType = float;
51+
using PointSetType = itk::PointSet<PixelType, Dimension>;
52+
53+
using FilterType = itk::PointFeature<PointSetType, PointSetType>;
54+
FilterType::Pointer filter = FilterType::New();
55+
56+
ITK_EXERCISE_BASIC_OBJECT_METHODS(filter, PointFeature, MeshToMeshFilter);
57+
58+
std::cout << "Basic tests finished." << std::endl;
59+
60+
return EXIT_SUCCESS;
61+
}
62+
} // namespace
2263

2364
int
2465
itkPointFeatureTest(int argc, char * argv[])
@@ -27,21 +68,56 @@ itkPointFeatureTest(int argc, char * argv[])
2768
{
2869
std::cerr << "Missing parameters." << std::endl;
2970
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv);
30-
std::cerr << " outputImage";
71+
std::cerr << " inputMesh";
3172
std::cerr << std::endl;
32-
return EXIT_FAILURE;
73+
std::cout << "Running basic tests only." << std::endl;
74+
return BasicTests();
3375
}
34-
const char * outputImageFileName = argv[1];
3576

36-
constexpr unsigned int Dimension = 3;
37-
using PixelType = float;
38-
using PointSetType = itk::PointSet<PixelType, Dimension>;
77+
MeshType::Pointer points = ReadMesh(argv[1]);
78+
MeshType::Pointer normals = ReadMesh(argv[1]);
3979

40-
using FilterType = itk::PointFeature<PointSetType, PointSetType>;
41-
FilterType::Pointer filter = FilterType::New();
80+
MeshType::PointsContainerPointer normal_points = normals->GetPoints();
81+
MeshType::PointsContainerIterator p_it = normal_points->Begin();
4282

43-
ITK_EXERCISE_BASIC_OBJECT_METHODS(filter, PointFeature, MeshToMeshFilter);
83+
MeshType::PointDataContainerPointer normal_normals = normals->GetPointData();
84+
MeshType::PointDataContainerIterator d_it = normal_normals->Begin();
85+
86+
// Print first 10 points and normals for sanity check and debugging
87+
std::cout << "Index * Point * Normal (up to first 10)" << std::endl;
88+
unsigned i = 0;
89+
while (p_it != normal_points->End())
90+
{
91+
if (i < numDebugPoints) // debug
92+
{
93+
std::cout << p_it.Index() << " * ";
94+
std::cout << p_it.Value() << " * ";
95+
std::cout << d_it.Value() << std::endl;
96+
}
97+
98+
for (unsigned d = 0; d < Dimension; ++d)
99+
{
100+
p_it.Value()[d] = d_it.Value()[d];
101+
}
102+
103+
++p_it;
104+
++d_it;
105+
++i;
106+
}
107+
108+
// Code specific for this test
109+
using FilterType = itk::PointFeature<MeshType, MeshType>;
110+
FilterType::Pointer fpfh = FilterType::New();
111+
fpfh->ComputeFPFHFeature(points, normals, 2.4219912533797725, 100);
112+
auto result = fpfh->GetFpfhFeature();
113+
auto resultSTL = result->CastToSTLConstContainer();
114+
for (i = 0; i < numDebugPoints; ++i)
115+
{
116+
std::cout << "FPFH Feature for point " << i << ":";
117+
for (unsigned k = 0; k < 33; ++k)
118+
std::cout << ' ' << resultSTL[i * 33 + k];
119+
std::cout << std::endl;
120+
}
44121

45-
std::cout << "Test finished." << std::endl;
46122
return EXIT_SUCCESS;
47123
}

0 commit comments

Comments
 (0)