File tree Expand file tree Collapse file tree 3 files changed +70
-1
lines changed
src/Filtering/ImageCompare/CombineTwoImagesWithCheckerBoardPattern Expand file tree Collapse file tree 3 files changed +70
-1
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,18 @@ install( FILES Code.cxx CMakeLists.txt
1919)
2020
2121enable_testing ()
22+
23+ set ( output_image Output .png )
24+
2225add_test ( NAME CombineTwoImagesWithCheckerBoardPatternTest
2326 COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} /CombineTwoImagesWithCheckerBoardPattern
24- Output .png
27+ ${output_image}
2528)
29+
30+ if ( ITK_WRAP_PYTHON )
31+ string ( REPLACE . "Python." output_image "${output_image} " )
32+ add_test ( NAME CombineTwoImagesWithCheckerBoardPatternTestPython
33+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR} /Code.py
34+ ${output_image}
35+ )
36+ endif ()
Original file line number Diff line number Diff line change 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 ) != 2 :
21+ print ("Usage: " + sys .argv [0 ] + " <OutputImage>" )
22+ sys .exit (1 )
23+
24+ output_file = sys .argv [1 ]
25+
26+ dimension = 2
27+ pixel_type = itk .UC
28+ image_type = itk .Image [pixel_type , dimension ]
29+
30+ # Create an image
31+ start = itk .Index [dimension ]()
32+ start .Fill (0 )
33+
34+ size = itk .Size [dimension ]()
35+ size .Fill (100 )
36+
37+ region = itk .ImageRegion [dimension ]()
38+ region .SetSize (size )
39+ region .SetIndex (start )
40+
41+ image1 = image_type .New (Regions = region )
42+ image1 .Allocate ()
43+ image1 .FillBuffer (0 )
44+
45+ image2 = image_type .New (Regions = region )
46+ image2 .Allocate ()
47+ image2 .FillBuffer (255 )
48+
49+ output = itk .checker_board_image_filter (image1 , image2 )
50+
51+ itk .imwrite (output , output_file )
Original file line number Diff line number Diff line change @@ -26,6 +26,13 @@ Results
2626Code
2727----
2828
29+ Python
30+ ......
31+
32+ .. literalinclude :: Code.py
33+ :language: python
34+ :lines: 1, 16-
35+
2936C++
3037...
3138
You can’t perform that action at this time.
0 commit comments