Skip to content

Commit

Permalink
ENH: Added ReadAnImage Python script
Browse files Browse the repository at this point in the history
  • Loading branch information
kian-weimer committed May 28, 2021
1 parent 29859a9 commit b9a69d9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/IO/ImageBase/ReadAnImage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ add_test( NAME ReadAnImageTest
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ReadAnImage
${CMAKE_CURRENT_BINARY_DIR}/Yinyang.png
)

if(ITK_WRAP_PYTHON)
add_test(NAME ReadAnImageTestPython
COMMAND ${PYTHON_EXECUTABLE} Code.py
${CMAKE_CURRENT_BINARY_DIR}/Yinyang.png
)
endif()
10 changes: 10 additions & 0 deletions src/IO/ImageBase/ReadAnImage/Code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python

import sys
import itk

if len(sys.argv) != 2:
print("Usage: " + sys.argv[0] + "<InputFileName>")
sys.exit(1)

image = itk.imread(sys.argv[1])
5 changes: 5 additions & 0 deletions src/IO/ImageBase/ReadAnImage/Documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ C++
.. literalinclude:: Code.cxx
:lines: 18-

Python
...

.. literalinclude:: Code.py
:lines: 21-

Classes demonstrated
--------------------
Expand Down

0 comments on commit b9a69d9

Please sign in to comment.