Skip to content

Commit 41db383

Browse files
author
Ben Wilson
committed
unfinished CLI
1 parent e9602ca commit 41db383

File tree

13 files changed

+481
-106
lines changed

13 files changed

+481
-106
lines changed

AlignMesh/AlignMesh.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ int main (int argc, char * argv[])
5555
meshReader2->SetFileName(inputVolumeTwo.c_str());
5656
// meshReader->Update();
5757
MeshType::Pointer mesh2 = meshReader2->GetOutput();
58-
58+
5959

6060

6161

BordersOut/BordersOut.cxx

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#include "BordersOutCLP.h"
2+
3+
//VTK Includes
4+
#include "vtkXMLPolyDataWriter.h"
5+
#include "vtkXMLPolyDataReader.h"
6+
#include "vtkSmartPointer.h"
7+
#include "vtkPolyData.h"
8+
#include "vtkTriangleFilter.h"
9+
#include "vtkNew.h"
10+
#include "vtkFeatureEdges.h"
11+
#include "vtkCleanPolyData.h"
12+
13+
14+
int main (int argc, char * argv[])
15+
{
16+
PARSE_ARGS;
17+
18+
try{
19+
int NBorders;
20+
int TOTALBorders;
21+
22+
vtkSmartPointer<vtkPolyData> polyData;
23+
24+
// Read the file
25+
vtkNew<vtkXMLPolyDataReader> reader;
26+
reader->SetFileName(inputVolume.c_str());
27+
reader->Update();
28+
polyData = reader->GetOutput();
29+
30+
vtkNew<vtkCleanPolyData> meshinC;
31+
meshinC->SetInputData(polyData);
32+
meshinC->Update();
33+
34+
vtkNew<vtkFeatureEdges> boundaryEdges;
35+
boundaryEdges->SetInputData(meshinC->GetOutput());
36+
boundaryEdges->BoundaryEdgesOn();
37+
//boundaryEdges->FeatureEdgesOff();
38+
boundaryEdges->NonManifoldEdgesOff();
39+
boundaryEdges->ManifoldEdgesOff();
40+
boundaryEdges->Update();
41+
42+
NBorders = (boundaryEdges->GetOutput()->GetNumberOfLines());
43+
TOTALBorders = NBorders;
44+
45+
//std::cout << "Number of Border Edges... " << TOTALBorders << std::endl;
46+
47+
//Write to file
48+
vtkNew<vtkXMLPolyDataWriter> writer;
49+
writer->SetFileName(outputVolume.c_str());
50+
writer->SetInputData(boundaryEdges->GetOutput());
51+
writer->Update();
52+
}
53+
catch (int e)
54+
{
55+
cout << "An exception occurred. Exception Nr. " << e << '\n';
56+
return EXIT_FAILURE;
57+
}
58+
59+
return EXIT_SUCCESS;
60+
61+
}

BordersOut/BordersOut.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<executable>
3+
<category>Surface Models.Advanced</category>
4+
<title>BordersOut</title>
5+
<description><![CDATA[This is a CLI module that can be bundled in an extension]]></description>
6+
<version>0.0.1</version>
7+
<documentation-url>http://www.example.com/Slicer/Modules/BordersOut</documentation-url>
8+
<license>Slicer</license>
9+
<contributor>Ben Wilson (Kitware)</contributor>
10+
<acknowledgements></acknowledgements>
11+
<parameters>
12+
<label>IO</label>
13+
<description><![CDATA[Input/output parameters]]></description>
14+
<geometry>
15+
<name>inputVolume</name>
16+
<label>Input Volume</label>
17+
<channel>input</channel>
18+
<index>0</index>
19+
<description><![CDATA[Input volume]]></description>
20+
</geometry>
21+
<geometry>
22+
<name>outputVolume</name>
23+
<label>Output Volume</label>
24+
<channel>output</channel>
25+
<index>1</index>
26+
<description><![CDATA[Output Volume]]></description>
27+
</geometry>
28+
</parameters>
29+
</executable>

BordersOut/CMakeLists.txt

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
#-----------------------------------------------------------------------------
3+
set(MODULE_NAME BordersOut)
4+
5+
#-----------------------------------------------------------------------------
6+
7+
#
8+
# SlicerExecutionModel
9+
#
10+
find_package(SlicerExecutionModel REQUIRED)
11+
include(${SlicerExecutionModel_USE_FILE})
12+
13+
#
14+
# ITK
15+
#
16+
set(${PROJECT_NAME}_ITK_COMPONENTS
17+
ITKIOImageBase
18+
ITKSmoothing
19+
)
20+
find_package(ITK 5 COMPONENTS ${${PROJECT_NAME}_ITK_COMPONENTS} REQUIRED)
21+
set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1) # See Libs/ITKFactoryRegistration/CMakeLists.txt
22+
include(${ITK_USE_FILE})
23+
24+
#-----------------------------------------------------------------------------
25+
set(MODULE_INCLUDE_DIRECTORIES
26+
)
27+
28+
set(MODULE_SRCS
29+
)
30+
31+
set(MODULE_TARGET_LIBRARIES
32+
${ITK_LIBRARIES}
33+
${VTK_LIBRARIES}
34+
)
35+
36+
#-----------------------------------------------------------------------------
37+
SEMMacroBuildCLI(
38+
NAME ${MODULE_NAME}
39+
TARGET_LIBRARIES ${MODULE_TARGET_LIBRARIES}
40+
INCLUDE_DIRECTORIES ${MODULE_INCLUDE_DIRECTORIES}
41+
ADDITIONAL_SRCS ${MODULE_SRCS}
42+
)
43+
44+
#-----------------------------------------------------------------------------
45+
if(BUILD_TESTING)
46+
add_subdirectory(Testing)
47+
endif()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fc6170ceeff3d8217a9dd6a1add2ec8c
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0749d4d3f07a217030f9ae33d94c4559
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6e5c289c73e14ba7a1b0f8aaf6ed249a
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3ebd710c9cf9d75750f4569b8caf6d07

BordersOut/Testing/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_subdirectory(Cxx)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#if defined(_MSC_VER)
2+
#pragma warning ( disable : 4786 )
3+
#endif
4+
5+
#ifdef __BORLANDC__
6+
#define ITK_LEAN_AND_MEAN
7+
#endif
8+
9+
#include "itkTestMain.h"
10+
11+
// STD includes
12+
#include <iostream>
13+
14+
#ifdef WIN32
15+
# define MODULE_IMPORT __declspec(dllimport)
16+
#else
17+
# define MODULE_IMPORT
18+
#endif
19+
20+
extern "C" MODULE_IMPORT int ModuleEntryPoint(int, char* []);
21+
22+
void RegisterTests()
23+
{
24+
StringToTestFunctionMap["ModuleEntryPoint"] = ModuleEntryPoint;
25+
}

0 commit comments

Comments
 (0)