Skip to content

Commit 3be7e4c

Browse files
authored
Merge pull request #297 from kian-weimer/LaplacianRecursiveGaussianImageFilter
ENH: Added LaplacianRecursiveGaussianImageFilter Python script
2 parents 942bd95 + 3898790 commit 3be7e4c

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

src/Filtering/ImageFeature/LaplacianRecursiveGaussianImageFilter/CMakeLists.txt

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,21 @@ install( FILES Code.cxx CMakeLists.txt
1919
)
2020

2121
enable_testing()
22+
23+
set( input_image ${CMAKE_CURRENT_BINARY_DIR}/cthead1.png )
24+
set( output_image Output.mha )
25+
2226
add_test( NAME LaplacianRecursiveGaussianImageFilterTest
2327
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/LaplacianRecursiveGaussianImageFilter
24-
${CMAKE_CURRENT_BINARY_DIR}/cthead1.png
25-
Output.mha
28+
${input_image}
29+
${output_image}
2630
)
31+
32+
if( ITK_WRAP_PYTHON )
33+
string( REPLACE . "Python." output_image "${output_image}" )
34+
add_test( NAME LaplacianRecursiveGaussianImageFilterTestPython
35+
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/Code.py
36+
${input_image}
37+
${output_image}
38+
)
39+
endif()
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env python
2+
3+
# Copyright NumFOCUS
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0.txt
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
import sys
18+
import itk
19+
20+
if len(sys.argv) != 3:
21+
print("Usage: " + sys.argv[0] + " <InputFileName> <OutputFileName>")
22+
sys.exit(1)
23+
24+
image = itk.imread(sys.argv[1], pixel_type=itk.F)
25+
26+
image = itk.laplacian_recursive_gaussian_image_filter(image)
27+
28+
itk.imwrite(image, sys.argv[2])

src/Filtering/ImageFeature/LaplacianRecursiveGaussianImageFilter/Documentation.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ Results
2828
Code
2929
----
3030

31+
Python
32+
......
33+
34+
.. literalinclude:: Code.py
35+
:language: python
36+
:lines: 1, 16-
37+
3138
C++
3239
...
3340

0 commit comments

Comments
 (0)