1515 * limitations under the License.
1616 *
1717 *=========================================================================*/
18- /*
18+
1919#include " itkImage.h"
2020#include " itkImageFileWriter.h"
2121#include " itkSimpleContourExtractorImageFilter.h"
2222#include " itkImageRegionIterator.h"
2323
2424using UnsignedCharImageType = itk::Image<unsigned char , 2 >;
2525
26- static void CreateImage(UnsignedCharImageType::Pointer image);
26+ static void
27+ CreateImage (UnsignedCharImageType::Pointer image);
2728
28- int main()
29+ int
30+ main ()
2931{
3032 auto image = UnsignedCharImageType::New ();
3133 CreateImage (image);
3234
33- using SimpleContourExtractorImageFilterType = itk::SimpleContourExtractorImageFilter <UnsignedCharImageType, UnsignedCharImageType>;
34- SimpleContourExtractorImageFilterType::Pointer contourFilter
35- = SimpleContourExtractorImageFilterType::New();
35+ using SimpleContourExtractorImageFilterType =
36+ itk::SimpleContourExtractorImageFilter<UnsignedCharImageType, UnsignedCharImageType>;
37+ SimpleContourExtractorImageFilterType::Pointer contourFilter = SimpleContourExtractorImageFilterType::New ();
3638 contourFilter->SetInput (image);
3739 contourFilter->Update ();
3840
39- using WriterType = itk::ImageFileWriter< UnsignedCharImageType >;
41+ using WriterType = itk::ImageFileWriter<UnsignedCharImageType>;
4042 auto writer = WriterType::New ();
4143 writer->SetFileName (" output.png" );
4244 writer->SetInput (contourFilter->GetOutput ());
@@ -45,36 +47,37 @@ int main()
4547 return EXIT_SUCCESS;
4648}
4749
48- void CreateImage(UnsignedCharImageType::Pointer image)
50+ void
51+ CreateImage (UnsignedCharImageType::Pointer image)
4952{
5053 // Create an image
5154 itk::Index<2 > start{};
5255
5356 auto size = itk::Size<2 >::Filled (100 );
5457
55- itk::ImageRegion<2> region(start,size);
58+ itk::ImageRegion<2 > region (start, size);
5659
5760 image->SetRegions (region);
5861 image->Allocate ();
5962 image->FillBuffer (0 );
6063
6164 // Create a line pixels
62- for(unsigned int i = 40; i < 60; ++i)
63- {
65+ for (unsigned int i = 40 ; i < 60 ; ++i)
66+ {
6467 auto pixel = itk::Index<2 >::Filled (i);
6568 image->SetPixel (pixel, 255 );
66- }
69+ }
6770
6871 // Create another line of pixels
69- for(unsigned int i = 10; i < 20; ++i)
70- {
72+ for (unsigned int i = 10 ; i < 20 ; ++i)
73+ {
7174 itk::Index<2 > pixel;
7275 pixel[0 ] = 10 ;
7376 pixel[1 ] = i;
7477 image->SetPixel (pixel, 255 );
75- }
78+ }
7679
77- using WriterType = itk::ImageFileWriter< UnsignedCharImageType >;
80+ using WriterType = itk::ImageFileWriter<UnsignedCharImageType>;
7881 auto writer = WriterType::New ();
7982 writer->SetFileName (" input.png" );
8083 writer->SetInput (image);
0 commit comments