This example runs each of the filters wrapped from ITK.
#Example a/testing/image_processing_2D.com: Testing all the cmiss operations with computed fields.
{
my $filename;
my %filter_tests;
# Each key will generate a new test with the filename and parameters given.
# The keys are listed alphabetically, add new filters to be tested in the
# correct place so that missing filters can be easily identified.
# binary dilate image filter
$filter_tests{'binary_dilate_1.png'} = ['binary_dilate', 'dilate_value 1 radius 1'];
$filter_tests{'binary_dilate_3.png'} = ['binary_dilate', 'dilate_value 1 radius 3'];
# binary erode image filter
$filter_tests{'binary_erode_1.png'} = ['binary_erode', 'erode_value 1 radius 1'];
$filter_tests{'binary_erode_3.png'} = ['binary_erode', 'erode_value 1 radius 3'];
# binary threshold image filter
$filter_tests{'threshold_0.5.png'} = ['binary_threshold_filter', 'lower_threshold 0.5'];
$filter_tests{'threshold_0.4_0.6.png'} = ['binary_threshold_filter', 'lower_threshold 0.4 upper_threshold 0.6'];
# canny edge image filter
$filter_tests{'canny_edge.png'} = ['canny_edge_detection_filter', ''];
# connected threshold image filter
$filter_tests{'connected_threshold.png'} = ['connected_threshold', 'lower_threshold 0.5 upper_threshold 1 num_seed_points 1 dimension 2 seed_points 0.5 0.2'];
# curvature anisotropic diffusion image filter
$filter_tests{'curvature_anisotropic_diffusion.png'} = ['curvature_anisotropic_diffusion', ''];
# derivative image filter
$filter_tests{'derivative_x.png'} = ['derivative', 'xi_index 1'];
$filter_tests{'derivative_y.png'} = ['derivative', 'xi_index 2'];
# discrete gaussian image filter
$filter_tests{'discrete_gaussian.png'} = ['discrete_gaussian', 'variance 3 max_kernel_width 6'];
# fast marching image filter
$filter_tests{'fast_marching.png'} = ['fast_marching', 'num_seed_points 1 dimension 2 seed_points 0.5 0.2 '];
# gradient magnitude recursive gaussian image filter
$filter_tests{'gradient_magnitude_recursive_gaussian.png'} = ['gradient_magnitude_recursive_gaussian', ''];
# histogram image filter
$filter_tests{'histogram64.png'} = ['histogram', 'number_of_bins 64'];
$filter_tests{'histogram8.png'} = ['histogram', 'number_of_bins 8'];
$filter_tests{'histogram8minmax.png'} = ['histogram', 'number_of_bins 8 histogram_minimum -0.25 histogram_maximum 1.5'];
# image resample
$filter_tests{'resample.png'} = ['image_resample', 'sizes 64 64'];
# mean image filter
$filter_tests{'mean_1.png'} = ['mean_filter', 'radius_sizes 1 1'];
$filter_tests{'mean_3.png'} = ['mean_filter', 'radius_sizes 3 3'];
# rescale intensity image filter
$filter_tests{'rescale_intensity.png'} = ['rescale_intensity', 'output_min 0.5 output_max 0.7'];
# sigmoid image filter
$filter_tests{'sigmoid_0_1_0.1_0.7.png'} = ['sigmoid_filter', 'minimum 0.0 maximum 1.0 alpha 0.1 beta 0.7'];
# threshold filter
$filter_tests{'threshold_below_0.3.png'} = ['threshold_filter', 'below below_value 0.3 outside_value 0.0'];
$filter_tests{'threshold_above_0.6.png'} = ['threshold_filter', 'above above_value 0.6 outside_value 0.0'];
$filter_tests{'threshold_outside_0.3_0.6.png'} = ['threshold_filter', 'outside below_value 0.3 above_value 0.6 outside_value 0.0'];
sub test_filter
{
my $filename = shift;
my $filter_name = shift;
my $parameters = shift;
print "$filter_name => $filename \'$parameters\'\n";
cmiss::cmiss("gfx define field intermediate_image $filter_name field input_image $parameters");
gfx modify texture output_image nearest width 1 height 1 evaluate_image field intermediate_image spectrum gray_spectrum texture_coord xi element_group square;
gfx write texture output_image file $filename;
}
# Read in a mesh which is currently required for cmiss.
gfx read nodes $example/square.exnode
gfx read elements $example/square.exelem
gfx create texture original image $example/cmiss_2D_test.png nearest width 1 height 1;
gfx define field input_image sample_texture coordinate xi field original;
#Just set up a dummy image of the correct size
gfx create texture output_image image $example/cmiss_2D_test.png specify_format i nearest width 1 height 1;
gfx create spectrum gray_spectrum clear overwrite_colour
gfx modify spectrum gray_spectrum linear range 0 1 extend_above extend_below monochrome colour_range 0 1 ambient diffuse component 1
for $filename (sort keys %filter_tests)
{
test_filter($filename, ${$filter_tests{$filename}}[0], ${$filter_tests{$filename}}[1]);
}
}
Name Modified Size
image_processing_2D.com 20-Apr-2012 4.4k COPYRIGHT 19-Apr-2012 504 binary_dilate_1.png 20-Apr-2012 1.4k binary_dilate_3.png 20-Apr-2012 1.3k binary_erode_1.png 20-Apr-2012 1.8k binary_erode_3.png 20-Apr-2012 1.8k canny_edge.png 20-Apr-2012 1.5k cmiss_2D_test.png 20-Apr-2012 1.7k connected_threshold.png 20-Apr-2012 356 curvature_anisotropic_diffusion.png 20-Apr-2012 3.8k derivative_x.png 20-Apr-2012 2.2k derivative_y.png 20-Apr-2012 1.7k discrete_gaussian.png 20-Apr-2012 5.1k fast_marching.png 20-Apr-2012 1.0k gradient_magnitude_recursive_gaussian.png 20-Apr-2012 3.9k mean_1.png 20-Apr-2012 3.3k mean_3.png 20-Apr-2012 4.0k resample.png 20-Apr-2012 732 rescale_intensity.png 20-Apr-2012 1.9k sigmoid_0_1_0.1_0.7.png 20-Apr-2012 2.3k square.exelem 20-Apr-2012 1.5k square.exnode 20-Apr-2012 400 threshold_0.4_0.6.png 20-Apr-2012 446 threshold_0.5.png 20-Apr-2012 401 threshold_above_0.6.png 20-Apr-2012 1.1k threshold_below_0.3.png 20-Apr-2012 1.7k threshold_outside_0.3_0.6.png 20-Apr-2012 816 tmp.com 20-Apr-2012 1.1k
Name Modified Size
examples_a_testing_image_processing_2D.tar.gz 20-Apr-2012 47k
| Status | Tested | Real time (s) | |
| i686-linux | |||
| cmgui-wx | Success | Wed May 16 00:18:53 2012 | 5 |
| cmgui-wx-debug | Success | Wed May 16 00:20:23 2012 | 6 |
| cmgui-wx-debug-memorycheck | Success | Wed May 16 00:22:09 2012 | 8 |
| cmgui-wx-debug-valgrind | Success | Wed May 16 02:36:23 2012 | 449 |
| x86_64-linux | |||
| cmgui-wx | Success | Wed May 16 00:07:32 2012 | 1 |
| cmgui-wx-debug | Success | Wed May 16 00:07:53 2012 | 2 |
| cmgui-wx-debug-memorycheck | Success | Wed May 16 00:08:19 2012 | 1 |
| cmgui-wx-debug-valgrind | Success | Wed May 16 00:44:13 2012 | 130 |
| i686-linux | |||
| Success | cmgui-wx: | diff test: no differences with generic answer. | |
| Success | cmgui-wx-debug: | diff test: no differences with generic answer. | |
| Success | cmgui-wx-debug-memorycheck: | diff test: no differences with generic answer. | |
| Success | cmgui-wx-debug-valgrind: | diff test: no differences with generic answer. | |
| x86_64-linux | |||
| Success | cmgui-wx: | diff test: no differences with generic answer. | |
| Success | cmgui-wx-debug: | diff test: no differences with generic answer. | |
| Success | cmgui-wx-debug-memorycheck: | diff test: no differences with generic answer. | |
| Success | cmgui-wx-debug-valgrind: | diff test: no differences with generic answer. |
Html last generated: Wed May 16 05:58:21 2012
Input last modified: Fri Apr 20 16:02:13 2012