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
19
19
)
20
20
21
21
enable_testing ()
22
+
23
+ set ( input_image ${CMAKE_CURRENT_BINARY_DIR} /Gourds.png )
24
+ set ( output_image Output .png )
25
+
22
26
add_test ( NAME RescaleIntensityTest
23
27
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} /RescaleIntensity
24
- ${CMAKE_CURRENT_BINARY_DIR} /Gourds.png
25
- Output .png
28
+ ${input_image}
29
+ ${output_image}
26
30
0
27
31
255
28
32
)
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
32
32
Code
33
33
----
34
34
35
+ Python
36
+ ......
37
+
38
+ .. literalinclude :: Code.py
39
+ :language: python
40
+ :lines: 1, 16-
41
+
35
42
C++
36
43
...
37
44
You can’t perform that action at this time.
0 commit comments