Skip to content

Commit ccea6aa

Browse files
author
Ben Wilson
committed
Call CLI
1 parent ac49d8b commit ccea6aa

24 files changed

+167
-200
lines changed

CMakeLists.txt

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@ cmake_minimum_required(VERSION 3.13.4)
22

33
project(SurfaceToolbox)
44

5-
#-----------------------------------------------------------------------------
6-
# Extension meta-information
7-
set(EXTENSION_HOMEPAGE "http://slicer.org/slicerWiki/index.php/Documentation/Nightly/Extensions/SurfaceToolboxImprovements")
8-
set(EXTENSION_CATEGORY "SurfaceToolbox")
9-
set(EXTENSION_CONTRIBUTORS "Ben Wilson (Kitware)")
10-
set(EXTENSION_DESCRIPTION "These are the current SurfaceToolbox features as CLIs
11-
")
12-
set(EXTENSION_ICONURL "http://www.example.com/Slicer/Extensions/SurfaceToolboxImprovements.png")
13-
set(EXTENSION_SCREENSHOTURLS "http://www.example.com/Slicer/Extensions/SurfaceToolboxImprovements/Screenshots/1.png")
14-
set(EXTENSION_DEPENDS "NA") # Specified as a space separated string, a list or 'NA' if any
155

166
#-----------------------------------------------------------------------------
177
# Extension dependencies
@@ -20,14 +10,14 @@ include(${Slicer_USE_FILE})
2010

2111
#-----------------------------------------------------------------------------
2212
# Extension modules
23-
add_subdirectory(SurfaceToolbox)
2413
add_subdirectory(Decimation)
25-
add_subdirectory(Smoothing)
26-
add_subdirectory(Normals)
27-
add_subdirectory(Mirror)
2814
add_subdirectory(Cleaner)
29-
add_subdirectory(FillHoles)
3015
add_subdirectory(Connectivity)
16+
add_subdirectory(FillHoles)
17+
add_subdirectory(Mirror)
18+
add_subdirectory(Normals)
19+
add_subdirectory(Smoothing)
20+
add_subdirectory(SurfaceToolbox)
3121
## NEXT_MODULE
3222

3323
#-----------------------------------------------------------------------------

Cleaner/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,20 @@ set(${PROJECT_NAME}_ITK_COMPONENTS
1717
ITKIOImageBase
1818
ITKSmoothing
1919
)
20-
find_package(ITK 4.6 COMPONENTS ${${PROJECT_NAME}_ITK_COMPONENTS} REQUIRED)
20+
find_package(ITK 5 COMPONENTS ${${PROJECT_NAME}_ITK_COMPONENTS} REQUIRED)
2121
set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1) # See Libs/ITKFactoryRegistration/CMakeLists.txt
2222
include(${ITK_USE_FILE})
2323

2424
#-----------------------------------------------------------------------------
2525
set(MODULE_INCLUDE_DIRECTORIES
26-
${vtkITK_INCLUDE_DIRS}
27-
${MRMLCore_INCLUDE_DIRS}
2826
)
2927

3028
set(MODULE_SRCS
3129
)
3230

3331
set(MODULE_TARGET_LIBRARIES
3432
${ITK_LIBRARIES}
35-
vtkITK MRMLCore ${VTK_LIBRARIES}
33+
${VTK_LIBRARIES}
3634
)
3735

3836
#-----------------------------------------------------------------------------

Cleaner/Cleaner.cxx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
#include "CleanerCLP.h"
2+
3+
//VTK includes
24
#include "vtkXMLPolyDataWriter.h"
35
#include "vtkXMLPolyDataReader.h"
46
#include "vtkSmartPointer.h"
57
#include "vtkCleanPolyData.h"
8+
#include "vtkNew.h"
69

710

8-
namespace{
9-
10-
}
11-
1211
int main (int argc, char * argv[])
1312
{
1413
PARSE_ARGS;
@@ -18,20 +17,18 @@ int main (int argc, char * argv[])
1817
vtkSmartPointer<vtkPolyData> polyData;
1918

2019
// Read the file
21-
vtkSmartPointer<vtkXMLPolyDataReader> reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();
20+
vtkNew<vtkXMLPolyDataReader> reader;
2221
reader->SetFileName(inputVolume.c_str());
2322
reader->Update();
2423
polyData = reader->GetOutput();
2524

26-
vtkSmartPointer<vtkCleanPolyData> cleaner =
27-
vtkSmartPointer<vtkCleanPolyData>::New();
25+
vtkNew<vtkCleanPolyData> cleaner;
2826

2927
cleaner->SetInputData(polyData);
3028
cleaner->Update();
3129

3230

33-
vtkSmartPointer<vtkXMLPolyDataWriter> writer =
34-
vtkSmartPointer<vtkXMLPolyDataWriter>::New();
31+
vtkNew<vtkXMLPolyDataWriter> writer;
3532
writer->SetFileName(outputVolume.c_str());
3633
writer->SetInputData(cleaner->GetOutput());
3734
writer->Update();

Cleaner/Cleaner.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<executable>
3-
<category>Examples</category>
3+
<category>Surface Models.Advanced</category>
44
<title>Cleaner</title>
55
<description><![CDATA[This is a CLI module that can be bundled in an extension]]></description>
66
<version>0.0.1</version>
7-
<documentation-url>http://www.example.com/Slicer/Modules/Cleaner</documentation-url>
7+
<documentation-url>http://www.example.com/Slicer/Modules/Decimation</documentation-url>
88
<license>Slicer</license>
9-
<contributor>FirstName LastName (Institution), FirstName LastName (Institution)</contributor>
10-
<acknowledgements>This work was partially funded by NIH grant NXNNXXNNNNNN-NNXN</acknowledgements>
9+
<contributor>Ben Wilson (Kitware)</contributor>
10+
<acknowledgements></acknowledgements>
1111
<parameters>
1212
<label>IO</label>
1313
<description><![CDATA[Input/output parameters]]></description>

Connectivity/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,20 @@ set(${PROJECT_NAME}_ITK_COMPONENTS
1717
ITKIOImageBase
1818
ITKSmoothing
1919
)
20-
find_package(ITK 4.6 COMPONENTS ${${PROJECT_NAME}_ITK_COMPONENTS} REQUIRED)
20+
find_package(ITK 5 COMPONENTS ${${PROJECT_NAME}_ITK_COMPONENTS} REQUIRED)
2121
set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1) # See Libs/ITKFactoryRegistration/CMakeLists.txt
2222
include(${ITK_USE_FILE})
2323

2424
#-----------------------------------------------------------------------------
2525
set(MODULE_INCLUDE_DIRECTORIES
26-
${vtkITK_INCLUDE_DIRS}
27-
${MRMLCore_INCLUDE_DIRS}
2826
)
2927

3028
set(MODULE_SRCS
3129
)
3230

3331
set(MODULE_TARGET_LIBRARIES
3432
${ITK_LIBRARIES}
35-
vtkITK MRMLCore ${VTK_LIBRARIES}
33+
${VTK_LIBRARIES}
3634
)
3735

3836
#-----------------------------------------------------------------------------

Connectivity/Connectivity.cxx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#include "ConnectivityCLP.h"
2+
3+
//VTK Includes
24
#include "vtkXMLPolyDataWriter.h"
35
#include "vtkXMLPolyDataReader.h"
46
#include "vtkSmartPointer.h"
57
#include "vtkPolyDataConnectivityFilter.h"
8+
#include "vtkNew.h"
69

7-
namespace{
8-
9-
}
1010

1111
int main (int argc, char * argv[])
1212
{
@@ -17,20 +17,18 @@ int main (int argc, char * argv[])
1717
vtkSmartPointer<vtkPolyData> polyData;
1818

1919
// Read the file
20-
vtkSmartPointer<vtkXMLPolyDataReader> reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();
20+
vtkNew<vtkXMLPolyDataReader> reader;
2121
reader->SetFileName(inputVolume.c_str());
2222
reader->Update();
2323
polyData = reader->GetOutput();
2424

25-
vtkSmartPointer<vtkPolyDataConnectivityFilter> connect =
26-
vtkSmartPointer<vtkPolyDataConnectivityFilter>::New();
25+
vtkNew<vtkPolyDataConnectivityFilter> connect;
2726

2827
connect->SetInputData(polyData);
2928
connect->SetExtractionModeToLargestRegion();
3029
connect->Update();
3130

32-
vtkSmartPointer<vtkXMLPolyDataWriter> writer =
33-
vtkSmartPointer<vtkXMLPolyDataWriter>::New();
31+
vtkNew<vtkXMLPolyDataWriter> writer;
3432
writer->SetFileName(outputVolume.c_str());
3533
writer->SetInputData(connect->GetOutput());
3634
writer->Update();

Connectivity/Connectivity.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<executable>
3-
<category>Examples</category>
3+
<category>Surface Models.Advanced</category>
44
<title>Connectivity</title>
55
<description><![CDATA[This is a CLI module that can be bundled in an extension]]></description>
66
<version>0.0.1</version>
7-
<documentation-url>http://www.example.com/Slicer/Modules/Connectivity</documentation-url>
7+
<documentation-url>http://www.example.com/Slicer/Modules/Decimation</documentation-url>
88
<license>Slicer</license>
9-
<contributor>FirstName LastName (Institution), FirstName LastName (Institution)</contributor>
10-
<acknowledgements>This work was partially funded by NIH grant NXNNXXNNNNNN-NNXN</acknowledgements>
9+
<contributor>Ben Wilson (Kitware)</contributor>
10+
<acknowledgements></acknowledgements>
1111
<parameters>
1212
<label>IO</label>
1313
<description><![CDATA[Input/output parameters]]></description>

Decimation/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,20 @@ set(${PROJECT_NAME}_ITK_COMPONENTS
1717
ITKIOImageBase
1818
ITKSmoothing
1919
)
20-
find_package(ITK 4.6 COMPONENTS ${${PROJECT_NAME}_ITK_COMPONENTS} REQUIRED)
20+
find_package(ITK 5 COMPONENTS ${${PROJECT_NAME}_ITK_COMPONENTS} REQUIRED)
2121
set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1) # See Libs/ITKFactoryRegistration/CMakeLists.txt
2222
include(${ITK_USE_FILE})
2323

2424
#-----------------------------------------------------------------------------
2525
set(MODULE_INCLUDE_DIRECTORIES
26-
${vtkITK_INCLUDE_DIRS}
27-
${MRMLCore_INCLUDE_DIRS}
2826
)
2927

3028
set(MODULE_SRCS
3129
)
3230

3331
set(MODULE_TARGET_LIBRARIES
3432
${ITK_LIBRARIES}
35-
vtkITK MRMLCore ${VTK_LIBRARIES}
33+
${VTK_LIBRARIES}
3634
)
3735

3836
#-----------------------------------------------------------------------------

Decimation/Decimation.cxx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#include "DecimationCLP.h"
22

3+
// VTK Includes
34
#include "vtkDecimatePro.h"
45
#include "vtkXMLPolyDataWriter.h"
56
#include "vtkXMLPolyDataReader.h"
67
#include "vtkSmartPointer.h"
78
#include "vtkPolyData.h"
89
#include "vtkTriangleFilter.h"
10+
#include "vtkNew.h"
911

10-
namespace{
11-
12-
}
1312

1413

1514
int main (int argc, char * argv[])
@@ -23,28 +22,27 @@ int main (int argc, char * argv[])
2322

2423

2524
// Read the file
26-
vtkSmartPointer<vtkXMLPolyDataReader> reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();
25+
vtkNew<vtkXMLPolyDataReader> reader;
2726
reader->SetFileName(inputVolume.c_str());
2827
reader->Update();
2928
polyData = reader->GetOutput();
3029

31-
vtkSmartPointer<vtkTriangleFilter> triangles = vtkSmartPointer<vtkTriangleFilter>::New();
30+
vtkNew<vtkTriangleFilter> triangles;
3231
triangles->SetInputData(polyData);
3332
triangles->Update();
3433
// create poly data with triangle filter
3534
inputPolyData = triangles->GetOutput();
3635

37-
vtkSmartPointer<vtkDecimatePro> decimate =
38-
vtkSmartPointer<vtkDecimatePro>::New();
36+
vtkNew<vtkDecimatePro> decimate;
3937

4038
decimate->SetInputData(inputPolyData);
4139
decimate->SetTargetReduction(Decimate);
40+
decimate->SetBoundaryVertexDeletion(Boundary);
4241
decimate->PreserveTopologyOn();
4342
decimate->Update();
4443

4544
//Write to file
46-
vtkSmartPointer<vtkXMLPolyDataWriter> writer =
47-
vtkSmartPointer<vtkXMLPolyDataWriter>::New();
45+
vtkNew<vtkXMLPolyDataWriter> writer;
4846
writer->SetFileName(outputVolume.c_str());
4947
writer->SetInputData(decimate->GetOutput());
5048
writer->Update();

Decimation/Decimation.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<executable>
3-
<category>Examples</category>
3+
<category>Surface Models.Advanced</category>
44
<title>Decimation</title>
55
<description><![CDATA[This is a CLI module that can be bundled in an extension]]></description>
66
<version>0.0.1</version>
@@ -37,5 +37,13 @@
3737
<maximum>1.0</maximum>
3838
</constraints>
3939
</double>
40+
<boolean>
41+
<name>Boundary</name>
42+
<label>Boundary Deletion</label>
43+
<channel>Boundary</channel>
44+
<longflag>--boundary</longflag>
45+
<description><![CDATA[Boundary Deletion on or off]]></description>
46+
<default>true</default>
47+
</boolean>
4048
</parameters>
4149
</executable>

0 commit comments

Comments
 (0)