File tree Expand file tree Collapse file tree 3 files changed +49
-2
lines changed
src/Filtering/ImageIntensity/RescaleIntensity Expand file tree Collapse file tree 3 files changed +49
-2
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,25 @@ install( FILES Code.cxx CMakeLists.txt
1919)
2020
2121enable_testing ()
22+
23+ set ( input_image ${CMAKE_CURRENT_BINARY_DIR} /Gourds.png )
24+ set ( output_image Output.png )
25+
2226add_test ( NAME RescaleIntensityTest
2327 COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} /RescaleIntensity
24- ${CMAKE_CURRENT_BINARY_DIR} /Gourds.png
25- Output .png
28+ ${input_image}
29+ ${output_image}
2630 0
2731 255
2832)
33+
34+ if ( ITK_WRAP_PYTHON )
35+ string ( REPLACE . "Python." output_image "${output_image} " )
36+ add_test ( NAME RescaleIntensityTestPython
37+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR} /Code.py
38+ ${input_image}
39+ ${output_image}
40+ 0
41+ 255
42+ )
43+ endif ()
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+
3+ import sys
4+ import itk
5+
6+ if len (sys .argv ) != 5 :
7+ print (
8+ "Usage: "
9+ + sys .argv [0 ]
10+ + " <InputFileName> <OutputFileName> <OutputMin> <OutputMax>"
11+ )
12+ sys .exit (1 )
13+
14+ input_image = sys .argv [1 ]
15+ output_image = sys .argv [1 ]
16+ output_minimum = int (sys .argv [3 ])
17+ output_maximum = int (sys .argv [4 ])
18+
19+ image = itk .imread (sys .argv [1 ])
20+
21+ image = itk .rescale_intensity_image_filter (
22+ image , output_minimum = output_minimum , output_maximum = output_maximum
23+ )
24+
25+ itk .imwrite (image , sys .argv [2 ])
Original file line number Diff line number Diff line change @@ -32,6 +32,13 @@ Results
3232Code
3333----
3434
35+ Python
36+ ......
37+
38+ .. literalinclude :: Code.py
39+ :language: python
40+ :lines: 1, 16-
41+
3542C++
3643...
3744
You can’t perform that action at this time.
0 commit comments