Example a_backup/testing/image_processing_2D: Image processing tests.

This example runs each of the filters wrapped from ITK.


The comfile run by this example is as follows:

#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]);
 }

}

Files used by this example are:

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

Download the entire example:

Name                                                  Modified     Size

examples_a_backup_testing_image_processing_2D.tar.gz 12-Aug-2014 53k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmgui-wxSuccessSun Mar 6 00:06:48 20161
cmgui-wx-debugSuccessSun Mar 6 00:10:39 20162
cmgui-wx-debug-memorycheckSuccessSun Mar 6 00:10:12 20161
cmgui-wx-debug-valgrindSuccessSun Mar 6 01:23:30 201682
x86_64-linux
cmgui-wxSuccessThu Jan 7 00:01:31 20161
cmgui-wx-debugSuccessThu Jan 7 00:01:41 20161
cmgui-wx-debug-memorycheckSuccessThu Jan 7 00:01:41 20161
cmgui-wx-debug-valgrindFailureSun Mar 6 00:06:59 201668
last breakSun Mar 6 00:05:00 201668
last successWed Jun 3 00:46:00 201562

Testing status by file:


Html last generated: Sun Mar 6 05:51:02 2016

Input last modified: Fri Apr 20 16:02:13 2012


CMISS Help / Examples / a_backup / testing / image_processing_2D