-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ben Wilson
committed
Aug 19, 2019
1 parent
e9602ca
commit 41db383
Showing
13 changed files
with
481 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#include "BordersOutCLP.h" | ||
|
||
//VTK Includes | ||
#include "vtkXMLPolyDataWriter.h" | ||
#include "vtkXMLPolyDataReader.h" | ||
#include "vtkSmartPointer.h" | ||
#include "vtkPolyData.h" | ||
#include "vtkTriangleFilter.h" | ||
#include "vtkNew.h" | ||
#include "vtkFeatureEdges.h" | ||
#include "vtkCleanPolyData.h" | ||
|
||
|
||
int main (int argc, char * argv[]) | ||
{ | ||
PARSE_ARGS; | ||
|
||
try{ | ||
int NBorders; | ||
int TOTALBorders; | ||
|
||
vtkSmartPointer<vtkPolyData> polyData; | ||
|
||
// Read the file | ||
vtkNew<vtkXMLPolyDataReader> reader; | ||
reader->SetFileName(inputVolume.c_str()); | ||
reader->Update(); | ||
polyData = reader->GetOutput(); | ||
|
||
vtkNew<vtkCleanPolyData> meshinC; | ||
meshinC->SetInputData(polyData); | ||
meshinC->Update(); | ||
|
||
vtkNew<vtkFeatureEdges> boundaryEdges; | ||
boundaryEdges->SetInputData(meshinC->GetOutput()); | ||
boundaryEdges->BoundaryEdgesOn(); | ||
//boundaryEdges->FeatureEdgesOff(); | ||
boundaryEdges->NonManifoldEdgesOff(); | ||
boundaryEdges->ManifoldEdgesOff(); | ||
boundaryEdges->Update(); | ||
|
||
NBorders = (boundaryEdges->GetOutput()->GetNumberOfLines()); | ||
TOTALBorders = NBorders; | ||
|
||
//std::cout << "Number of Border Edges... " << TOTALBorders << std::endl; | ||
|
||
//Write to file | ||
vtkNew<vtkXMLPolyDataWriter> writer; | ||
writer->SetFileName(outputVolume.c_str()); | ||
writer->SetInputData(boundaryEdges->GetOutput()); | ||
writer->Update(); | ||
} | ||
catch (int e) | ||
{ | ||
cout << "An exception occurred. Exception Nr. " << e << '\n'; | ||
return EXIT_FAILURE; | ||
} | ||
|
||
return EXIT_SUCCESS; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<executable> | ||
<category>Surface Models.Advanced</category> | ||
<title>BordersOut</title> | ||
<description><![CDATA[This is a CLI module that can be bundled in an extension]]></description> | ||
<version>0.0.1</version> | ||
<documentation-url>http://www.example.com/Slicer/Modules/BordersOut</documentation-url> | ||
<license>Slicer</license> | ||
<contributor>Ben Wilson (Kitware)</contributor> | ||
<acknowledgements></acknowledgements> | ||
<parameters> | ||
<label>IO</label> | ||
<description><![CDATA[Input/output parameters]]></description> | ||
<geometry> | ||
<name>inputVolume</name> | ||
<label>Input Volume</label> | ||
<channel>input</channel> | ||
<index>0</index> | ||
<description><![CDATA[Input volume]]></description> | ||
</geometry> | ||
<geometry> | ||
<name>outputVolume</name> | ||
<label>Output Volume</label> | ||
<channel>output</channel> | ||
<index>1</index> | ||
<description><![CDATA[Output Volume]]></description> | ||
</geometry> | ||
</parameters> | ||
</executable> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
#----------------------------------------------------------------------------- | ||
set(MODULE_NAME BordersOut) | ||
|
||
#----------------------------------------------------------------------------- | ||
|
||
# | ||
# SlicerExecutionModel | ||
# | ||
find_package(SlicerExecutionModel REQUIRED) | ||
include(${SlicerExecutionModel_USE_FILE}) | ||
|
||
# | ||
# ITK | ||
# | ||
set(${PROJECT_NAME}_ITK_COMPONENTS | ||
ITKIOImageBase | ||
ITKSmoothing | ||
) | ||
find_package(ITK 5 COMPONENTS ${${PROJECT_NAME}_ITK_COMPONENTS} REQUIRED) | ||
set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1) # See Libs/ITKFactoryRegistration/CMakeLists.txt | ||
include(${ITK_USE_FILE}) | ||
|
||
#----------------------------------------------------------------------------- | ||
set(MODULE_INCLUDE_DIRECTORIES | ||
) | ||
|
||
set(MODULE_SRCS | ||
) | ||
|
||
set(MODULE_TARGET_LIBRARIES | ||
${ITK_LIBRARIES} | ||
${VTK_LIBRARIES} | ||
) | ||
|
||
#----------------------------------------------------------------------------- | ||
SEMMacroBuildCLI( | ||
NAME ${MODULE_NAME} | ||
TARGET_LIBRARIES ${MODULE_TARGET_LIBRARIES} | ||
INCLUDE_DIRECTORIES ${MODULE_INCLUDE_DIRECTORIES} | ||
ADDITIONAL_SRCS ${MODULE_SRCS} | ||
) | ||
|
||
#----------------------------------------------------------------------------- | ||
if(BUILD_TESTING) | ||
add_subdirectory(Testing) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fc6170ceeff3d8217a9dd6a1add2ec8c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0749d4d3f07a217030f9ae33d94c4559 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
6e5c289c73e14ba7a1b0f8aaf6ed249a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3ebd710c9cf9d75750f4569b8caf6d07 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_subdirectory(Cxx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#if defined(_MSC_VER) | ||
#pragma warning ( disable : 4786 ) | ||
#endif | ||
|
||
#ifdef __BORLANDC__ | ||
#define ITK_LEAN_AND_MEAN | ||
#endif | ||
|
||
#include "itkTestMain.h" | ||
|
||
// STD includes | ||
#include <iostream> | ||
|
||
#ifdef WIN32 | ||
# define MODULE_IMPORT __declspec(dllimport) | ||
#else | ||
# define MODULE_IMPORT | ||
#endif | ||
|
||
extern "C" MODULE_IMPORT int ModuleEntryPoint(int, char* []); | ||
|
||
void RegisterTests() | ||
{ | ||
StringToTestFunctionMap["ModuleEntryPoint"] = ModuleEntryPoint; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
#----------------------------------------------------------------------------- | ||
set(BASELINE ${CMAKE_CURRENT_SOURCE_DIR}/../../Data/Baseline) | ||
set(INPUT ${CMAKE_CURRENT_SOURCE_DIR}/../../Data/Input) | ||
set(TEMP "${CMAKE_BINARY_DIR}/Testing/Temporary") | ||
|
||
set(CLP ${MODULE_NAME}) | ||
|
||
#----------------------------------------------------------------------------- | ||
add_executable(${CLP}Test ${CLP}Test.cxx) | ||
target_link_libraries(${CLP}Test ${CLP}Lib ${SlicerExecutionModel_EXTRA_EXECUTABLE_TARGET_LIBRARIES}) | ||
set_target_properties(${CLP}Test PROPERTIES LABELS ${CLP}) | ||
|
||
#----------------------------------------------------------------------------- | ||
set(testname ${CLP}Test) | ||
ExternalData_add_test(${CLP}Data NAME ${testname} COMMAND ${SEM_LAUNCH_COMMAND} $<TARGET_FILE:${CLP}Test> | ||
--compare DATA{${BASELINE}/${CLP}Test.nhdr,${CLP}Test.raw} | ||
${TEMP}/${CLP}Test.nhdr | ||
ModuleEntryPoint | ||
--sigma 2.5 DATA{${INPUT}/CTHeadAxial.nhdr,CTHeadAxial.raw.gz} ${TEMP}/${CLP}Test.nhdr | ||
) | ||
set_property(TEST ${testname} PROPERTY LABELS ${CLP}) | ||
|
||
#----------------------------------------------------------------------------- | ||
ExternalData_add_target(${CLP}Data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.