11/* =========================================================================
22 *
3- * Copyright Insight Software Consortium
3+ * Copyright NumFOCUS
44 *
55 * Licensed under the Apache License, Version 2.0 (the "License");
66 * you may not use this file except in compliance with the License.
1515 * limitations under the License.
1616 *
1717 *=========================================================================*/
18+
1819#include " itkImage.h"
1920#include " itkImageFileReader.h"
2021#include " itkImageFileWriter.h"
2122#include " itkAdditiveGaussianNoiseImageFilter.h"
2223
2324int main ( int argc, char * argv[] )
2425{
25- // Check for proper arguments, if not, explain usage.
26+ // Check for proper arguments; if not, explain usage.
2627 if ( argc != 5 )
2728 {
2829 std::cerr << " Usage: " << std::endl;
@@ -31,19 +32,21 @@ int main( int argc, char* argv[] )
3132 std::cerr << std::endl;
3233 return EXIT_FAILURE;
3334 }
34- // Initialize and assign user provided variables
35- const std::string * inputImage = argv[1 ];
36- const std::string * outputImage = argv[2 ];
37- // get floating point numbers for the Mean and Standard Deviation to perform the algorithm
35+
36+ // Initialize and assign user provided variables
37+ const char * inputImage = argv[1 ];
38+ const char * outputImage = argv[2 ];
39+
40+ // Get floating point numbers for the mean and std dev to perform the algorithm
3841 const double mean = std::stod (argv[3 ]);
3942 const double deviation = std::stod (argv[4 ]);
4043
4144 constexpr unsigned int Dimension = 2 ;
42- // Use unsigned char so file will save to .png
45+ // Use unsigned char to save to PNG format
4346 using PixelType = unsigned char ;
4447 using ImageType = itk::Image< PixelType, Dimension >;
4548
46- // read the old file to be converted
49+ // Read the file to be converted
4750 using ReaderType = itk::ImageFileReader< ImageType >;
4851 ReaderType::Pointer reader = ReaderType::New ();
4952 reader->SetFileName ( inputImage );
@@ -54,7 +57,7 @@ int main( int argc, char* argv[] )
5457 using FilterType = itk::AdditiveGaussianNoiseImageFilter< ImageType, ImageType >;
5558 FilterType::Pointer filter = FilterType::New ();
5659 filter->SetInput ( reader->GetOutput () );
57- filter->SetMean ( mean ); // set the mean
60+ filter->SetMean ( mean ); // Set the mean
5861 filter->SetStandardDeviation ( deviation ); // Set the standard deviation
5962
6063 // Set the writer to save file
@@ -63,7 +66,7 @@ int main( int argc, char* argv[] )
6366 writer->SetFileName ( outputImage );
6467 writer->SetInput ( filter->GetOutput () );
6568
66- // Write the output image
69+ // Write the output image
6770 try
6871 {
6972 writer->Update ();
0 commit comments