Skip to content

Commit

Permalink
BUG: Fix input for examples that use VTK
Browse files Browse the repository at this point in the history
After fixing the CMakeList.txt scipts for examples that use VTK library
in some form, many of the examples needed there test input and
documentation updated.

This primarily added an input image for an examples test, and updated
it's respective documentation.txt with the input and output.

A few of the examples and/or their respective tests contained errors
that were marked with a TODO, for a future PR. These included:
  1) Baseline comparisons, that cannot work due to the output not ever
     being stored. In a future PR, the examples should be modified to
     save their output, so we can test against it.
       + VTKImageToITKImageBaseline
       + InPlaceFilterOfImageBaseline
       + GeometricPropertiesOfRegionBaseline
  2) The DemonstrateThresholdAlgorithm example has it's
     KittlerIllingworth filter commented out with a TODO. This was the
     only filter to not work, and will be documented in a future issue.
  • Loading branch information
mseng10 committed Feb 23, 2021
1 parent f079817 commit cddc856
Show file tree
Hide file tree
Showing 29 changed files with 104 additions and 49 deletions.
7 changes: 4 additions & 3 deletions src/Bridge/VtkGlue/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ add_example(ConvertRGBvtkImageDataToAnitkImage)
if(ENABLE_QUICKVIEW)

add_example(VTKImageToITKImage)
compare_to_baseline(EXAMPLE_NAME VTKImageToITKImage
BASELINE_PREFIX OutputBaseline
)
#TODO: Save output ITK image and then use it to compare to baseline
#compare_to_baseline(EXAMPLE_NAME VTKImageToITKImage
# BASELINE_PREFIX OutputBaseline
# )

if(ITK_VERSION_MAJOR LESS 5)
add_example(VisualizeEvolvingDense2DLevelSetAsElevationMap)
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/VtkGlue/VTKImageToITKImage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ install(FILES Code.cxx CMakeLists.txt

enable_testing()
add_test(NAME VTKImageToITKImageTest
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/VTKImageToITKImage)
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/VTKImageToITKImage Gourds.png)

19 changes: 11 additions & 8 deletions src/Bridge/VtkGlue/VTKImageToITKImage/Documentation.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
VTK Image To ITK Image
======================
.. warning::
**Fix Problem**
Contains problems not fixed from original wiki.
.. index::
single: VTKImageToImageFilter

Expand All @@ -14,11 +11,17 @@ Convert a VTK image to an ITK image.

Results
-------
.. note::
**Help Wanted**
Implementation of Results for sphinx examples containing this message.
Reconfiguration of CMakeList.txt may be necessary.
`Write An Example <https://itk.org/ITKExamples/Documentation/Contribute/WriteANewExample.html`>
.. figure:: Gourds.png
:scale: 50%
:alt: Input image.

Input Image

.. figure:: VTKImageToITKImageQuickview.png
:scale: 50%
:alt: QuickView output.

Output In QuickView

Code
----
Expand Down
1 change: 1 addition & 0 deletions src/Bridge/VtkGlue/VTKImageToITKImage/Gourds.png.sha512
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
859fd5a9de82ac8bbdf81c1c75548ce340c36c46396c8f63bbe709fe572af54df3bf69e18ece04e84977db3fee7aafc50ea6d51926cec1891661fb45a1762907
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1b114c209ad010f6710b8c63a2a3ef66dc237d5efc7eb12dcb6a2105535f1c9ee568bd0bd646acd8da78c6468c257e857956a6d5518546461a796452e4c6c689
7 changes: 4 additions & 3 deletions src/Core/Common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,10 @@ compare_to_baseline(EXAMPLE_NAME FindMaxAndMinInImage
)

add_example(InPlaceFilterOfImage)
compare_to_baseline(EXAMPLE_NAME InPlaceFilterOfImage
BASELINE_PREFIX OutputBaseline
)
#TODO: Make example save output image, and then compare it to a baseline
#compare_to_baseline(EXAMPLE_NAME InPlaceFilterOfImage
# BASELINE_PREFIX OutputBaseline
# )

add_example(IterateRegionWithNeighborhood)
compare_to_baseline(EXAMPLE_NAME IterateRegionWithNeighborhood
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Common/FindMaxAndMinInImage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ install(FILES Code.cxx CMakeLists.txt

enable_testing()
add_test(NAME FindMaxAndMinInImageTest
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/FindMaxAndMinInImage)
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/FindMaxAndMinInImage Yinyang.png)
2 changes: 1 addition & 1 deletion src/Core/Common/InPlaceFilterOfImage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ install(FILES Code.cxx CMakeLists.txt

enable_testing()
add_test(NAME InPlaceFilterOfImageTest
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/InPlaceFilterOfImage)
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/InPlaceFilterOfImage Gourds.png)
18 changes: 10 additions & 8 deletions src/Core/Common/InPlaceFilterOfImage/Documentation.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
In Place Filter Of Image
========================
.. warning::
**Fix Problem**
Contains problems not fixed from original wiki.
.. index::
single: InPlaceImageFilter

Expand All @@ -14,12 +11,17 @@ In-place filtering of an image.

Results
-------
.. note::
**Help Wanted**
Implementation of Results for sphinx examples containing this message.
Reconfiguration of CMakeList.txt may be necessary.
`Write An Example <https://itk.org/ITKExamples/Documentation/Contribute/WriteANewExample.html`>
.. figure:: Gourds.png
:scale: 50%
:alt: Input image.

Input Image

.. figure:: InPlaceFilterOfImageQuickview.png
:scale: 50%
:alt: QuickView output.

Output In QuickView
Code
----

Expand Down
1 change: 1 addition & 0 deletions src/Core/Common/InPlaceFilterOfImage/Gourds.png.sha512
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
859fd5a9de82ac8bbdf81c1c75548ce340c36c46396c8f63bbe709fe572af54df3bf69e18ece04e84977db3fee7aafc50ea6d51926cec1891661fb45a1762907
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dd5cc19e2761de6851334198b8ec669ce7cf8cf451850b6fb7e0e22a4f6384ed5d86863e113cf41f9dc5e337e1f1e68fe83344459299b39aa51f9946e2467a11
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ install(FILES Code.cxx CMakeLists.txt

enable_testing()
add_test(NAME IterateRegionWithNeighborhoodTest
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/IterateRegionWithNeighborhood)
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/IterateRegionWithNeighborhood Yinyang.png)

Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ install(FILES Code.cxx CMakeLists.txt

enable_testing()
add_test(NAME IterateRegionWithWriteAccessTest
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/IterateRegionWithWriteAccess)
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/IterateRegionWithWriteAccess Yinyang.png)
2 changes: 1 addition & 1 deletion src/Core/Common/MultiThreadOilPainting/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ install(FILES Code.cxx CMakeLists.txt

enable_testing()
add_test(NAME MultiThreadOilPaintingTest
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/MultiThreadOilPainting)
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/MultiThreadOilPainting Yinyang.png 100 20)
14 changes: 11 additions & 3 deletions src/Core/Common/MultiThreadOilPainting/Documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@ Multi-threaded oil painting image filter.

Results
-------
.. warning::
**Fix Errors**
Example contains errors needed to be fixed for proper output.
.. figure:: Yinyang.png
:scale: 50%
:alt: Input image

Input image

.. figure:: MultiThreadOilPaintingQuickview.png
:scale: 70%
:alt: Output In QuickView Window

Output In QuickView Window

Code
----
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fea95a87e8ada864792311324177568624c9a66f639a196e4107f46763dc3a424376542e1f16680783380cf64bf5e73969a2f370de5ea0e0e5981158c3582cc2
1 change: 1 addition & 0 deletions src/Core/Common/MultiThreadOilPainting/Yinyang.png.sha512
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
14b645d89824bf4c084f1e9daa88b4049b5ff984d2ce900e9208b442d71c4181a834699e94bd58b78a2ecb45e56e65b863dbea057b744f7aef5550b7a0bf3c8b
14 changes: 11 additions & 3 deletions src/Core/ImageFunction/ResampleSegmentedImage/Documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@ Resample (stretch or compress) a segmented image.

Results
-------
.. warning::
**Fix Errors**
Example contains errors needed to be fixed for proper output.
.. figure:: Yinyang.png
:scale: 50%
:alt: Input yin-yang image.

Input Image

.. figure:: ResampleSegmentedImageQuickview.png
:scale: 50%
:alt: QuickView output.

Output In QuickView

Code
----
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
859fd5a9de82ac8bbdf81c1c75548ce340c36c46396c8f63bbe709fe572af54df3bf69e18ece04e84977db3fee7aafc50ea6d51926cec1891661fb45a1762907
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cee50b9fd2a76e31b58414b2e49cfe0c8f71154a5f4ea71371da6c99f74ad841252a844d7b6d2f6f0bdae3fee394db4ce83dbc1ec5dc146e1512d5a1d62df31d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
86cbe2a809e90d72fb464868449477fe6d83809ddd0493cfca92033d7d3dd4bc3e0b831b17735926ed990735234a4eb8034aeaca70a3f5ba18fffe8f3c8e7eaa
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3231073d9f5ef7d9410dc6dffea7be667fe1a679b51d4797e731e7dfa61e0ab29e03caaa7e369a705ba379edd59e6872ca739886a942b62b4901790149e78f90
14 changes: 11 additions & 3 deletions src/Filtering/ImageFeature/DerivativeImage/Documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@ Computes the derivative of an image in a particular direction.

Results
-------
.. warning::
**Fix Errors**
Example contains errors needed to be fixed for proper output.
.. figure:: BrainProtonDensitySlice.png
:scale: 50%
:alt: Input image

Input image

.. figure:: DerivativeImageQuickview.png
:scale: 50%
:alt: Output in QuickView

Output in QuickView

Code
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ main(int argc, char * argv[])
using HuangFilterType = itk::HuangThresholdImageFilter<InputImageType, OutputImageType>;
using IntermodesFilterType = itk::IntermodesThresholdImageFilter<InputImageType, OutputImageType>;
using IsoDataFilterType = itk::IsoDataThresholdImageFilter<InputImageType, OutputImageType>;
using KittlerIllingworthFilterType = itk::KittlerIllingworthThresholdImageFilter<InputImageType, OutputImageType>;
// TODO: Fix KittlerIllingworth Filter
// using KittlerIllingworthFilterType = itk::KittlerIllingworthThresholdImageFilter<InputImageType, OutputImageType>;
using LiFilterType = itk::LiThresholdImageFilter<InputImageType, OutputImageType>;
using MaximumEntropyFilterType = itk::MaximumEntropyThresholdImageFilter<InputImageType, OutputImageType>;
using MomentsFilterType = itk::MomentsThresholdImageFilter<InputImageType, OutputImageType>;
Expand All @@ -85,7 +86,7 @@ main(int argc, char * argv[])
filterContainer["Huang"] = HuangFilterType::New();
filterContainer["Intermodes"] = IntermodesFilterType::New();
filterContainer["IsoData"] = IsoDataFilterType::New();
filterContainer["KittlerIllingworth"] = KittlerIllingworthFilterType::New();
// filterContainer["KittlerIllingworth"] = KittlerIllingworthFilterType::New();
filterContainer["Li"] = LiFilterType::New();
filterContainer["MaximumEntropy"] = MaximumEntropyFilterType::New();
filterContainer["Moments"] = MomentsFilterType::New();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3cf82144ab4e60d76694b17bab0b7471fe6669e45c8a31146feb278b7a6b8e4b1e186bfa1df5a64097a894d2d8662a75f0bd2934f6fbe1e5c232c2f3cc62fd55
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,17 @@ Demonstrate available threshold algorithms.

Results
-------
.. warning::
**Fix Errors**
Example contains errors needed to be fixed for proper output.
.. figure:: Yinyang.png
:scale: 50%
:alt: Input yin-yang image.

Input Image

.. figure:: DemonstrateThresholdAlgorithmsQuickview.png
:scale: 50%
:alt: QuickView output.

Output In QuickView

Code
----
Expand Down
11 changes: 4 additions & 7 deletions src/Nonunit/Review/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ compare_to_baseline( EXAMPLE_NAME SegmentBloodVesselsWithMultiScaleHessianBasedM
# BASELINE_PREFIX OutputBaseline
# )

if(ENABLE_QUICKVIEW)

add_example(GeometricPropertiesOfRegion)
compare_to_baseline(EXAMPLE_NAME GeometricPropertiesOfRegion
BASELINE_PREFIX OutputBaseline
)

endif()
#TODO: Save output ITK image and then use it to compare to baseline
#compare_to_baseline(EXAMPLE_NAME GeometricPropertiesOfRegion
# BASELINE_PREFIX OutputBaseline
# )
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ Get geometric properties of labeled regions in an image.

Results
-------
.. figure:: GeometricPropertiesOfRegionQuickview.png
:scale: 50%
:alt: QuickView output.

Output In QuickView

Output::

Image (0x7fd274c5f3c0)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e3d5085d6902961a1e30791a4738669e5fcaaf900efb898315022d978bfe14eb72a8d97823e9f0c094edcd5cc8ccfe16d61c9e2136237961aff362474d89fb3c

0 comments on commit cddc856

Please sign in to comment.