-
-
Notifications
You must be signed in to change notification settings - Fork 667
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: Add a 3D regression test for FillholeImageFilter
- Loading branch information
Showing
7 changed files
with
161 additions
and
13 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
Modules/Filtering/LabelMap/test/Baseline/fillhole_test_3D_0.nrrd.cid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bafkreiedqykigqcan7723ddeqti6k7ax64nm6vhb6y274kbkkoqvwk7tsu |
1 change: 1 addition & 0 deletions
1
Modules/Filtering/LabelMap/test/Baseline/fillhole_test_3D_1.nrrd.cid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bafkreibhouw5b6l7p5pjfhvqpjkykha4gjftpllyzzqkh6ocq6s37udw64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Modules/Filtering/LabelMap/test/Input/fillhole_test_3D.nrrd.cid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bafkreieiivjbu4msrzxudc4radedqkrt6k6d2uiptvnd4q72jxhnwonrdu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
Modules/Filtering/LabelMap/wrapping/test/BinaryFillholeImageFilterTest.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# ========================================================================== | ||
# | ||
# Copyright NumFOCUS | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0.txt | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# ==========================================================================*/ | ||
|
||
import itk | ||
from sys import argv, stderr, exit | ||
|
||
itk.auto_progress(2) | ||
|
||
if len(argv) < 5: | ||
print( | ||
( | ||
"Missing Parameters \n Usage: BinaryFillholeImageFilterTest.py inputImageFile " | ||
"outputImageFile fullyConnected foregroundValue" | ||
), | ||
file=stderr, | ||
) | ||
exit(1) | ||
|
||
|
||
mask = itk.imread(argv[1]) | ||
fully_connected = (int(argv[3]) > 0) | ||
foreground_value = int(argv[4]) | ||
|
||
mask_filled = itk.binary_fillhole_image_filter( | ||
mask, fully_connected=fully_connected, foreground_value=foreground_value) | ||
itk.imwrite(mask_filled, argv[2]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
set(test_input_dir ${itk-module_SOURCE_DIR}/test/Input) | ||
set(test_baseline_dir ${itk-module_SOURCE_DIR}/test/Baseline) | ||
|
||
# let's make sure 3D uchar images are wrapped | ||
list( | ||
FIND | ||
ITK_WRAP_IMAGE_DIMS | ||
3 | ||
wrap_3_index) | ||
if(ITK_WRAP_PYTHON | ||
AND ITK_WRAP_unsigned_char | ||
AND wrap_3_index GREATER -1) | ||
|
||
itk_python_add_test( | ||
NAME | ||
BinaryFillholeImageFilterTestPython2D | ||
TEST_DRIVER_ARGS | ||
--compare | ||
DATA{${test_baseline_dir}/itkBinaryFillholeImageFilterTest1.png} | ||
${ITK_TEST_OUTPUT_DIR}/itkBinaryFillholeImageFilterTest2D.png | ||
COMMAND | ||
${CMAKE_CURRENT_SOURCE_DIR}/BinaryFillholeImageFilterTest.py | ||
DATA{${ITK_DATA_ROOT}/Input/Spots.png} | ||
${ITK_TEST_OUTPUT_DIR}/itkBinaryFillholeImageFilterTest2D.png | ||
1 | ||
255) | ||
|
||
itk_python_add_test( | ||
NAME | ||
BinaryFillholeImageFilterTestPython0 | ||
TEST_DRIVER_ARGS | ||
--compare | ||
DATA{${test_baseline_dir}/fillhole_test_3D_0.nrrd} | ||
${ITK_TEST_OUTPUT_DIR}/itkBinaryFillholeImageFilterTest3D_0.nrrd | ||
COMMAND | ||
${CMAKE_CURRENT_SOURCE_DIR}/BinaryFillholeImageFilterTest.py | ||
DATA{${test_input_dir}/fillhole_test_3D.nrrd} | ||
${ITK_TEST_OUTPUT_DIR}/itkBinaryFillholeImageFilterTest3D_0.nrrd | ||
0 | ||
1) | ||
|
||
itk_python_add_test( | ||
NAME | ||
BinaryFillholeImageFilterTestPython1 | ||
TEST_DRIVER_ARGS | ||
--compare | ||
DATA{${test_baseline_dir}/fillhole_test_3D_1.nrrd} | ||
${ITK_TEST_OUTPUT_DIR}/itkBinaryFillholeImageFilterTest3D_1.nrrd | ||
COMMAND | ||
${CMAKE_CURRENT_SOURCE_DIR}/BinaryFillholeImageFilterTest.py | ||
DATA{${test_input_dir}/fillhole_test_3D.nrrd} | ||
${ITK_TEST_OUTPUT_DIR}/itkBinaryFillholeImageFilterTest3D_1.nrrd | ||
1 | ||
1) | ||
|
||
endif() |