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,38 +47,39 @@ 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 itk::Size<2 > size;
5457 size.Fill (100 );
5558
56- itk::ImageRegion<2> region(start,size);
59+ itk::ImageRegion<2 > region (start, size);
5760
5861 image->SetRegions (region);
5962 image->Allocate ();
6063 image->FillBuffer (0 );
6164
6265 // Create a line pixels
63- for(unsigned int i = 40; i < 60; ++i)
64- {
66+ for (unsigned int i = 40 ; i < 60 ; ++i)
67+ {
6568 itk::Index<2 > pixel;
6669 pixel.Fill (i);
6770 image->SetPixel (pixel, 255 );
68- }
71+ }
6972
7073 // Create another line of pixels
71- for(unsigned int i = 10; i < 20; ++i)
72- {
74+ for (unsigned int i = 10 ; i < 20 ; ++i)
75+ {
7376 itk::Index<2 > pixel;
7477 pixel[0 ] = 10 ;
7578 pixel[1 ] = i;
7679 image->SetPixel (pixel, 255 );
77- }
80+ }
7881
79- using WriterType = itk::ImageFileWriter< UnsignedCharImageType >;
82+ using WriterType = itk::ImageFileWriter<UnsignedCharImageType>;
8083 auto writer = WriterType::New ();
8184 writer->SetFileName (" input.png" );
8285 writer->SetInput (image);
0 commit comments