static void Main(string[] args)
        {
            try {
            if (args.Length < 3) {
              Console.WriteLine("Usage: {0} <input> <variance> <output>", args[0]);
              return;
            }
            // Read input image
            ImageFileReader reader = new ImageFileReader();
            reader.SetFileName(args[0]);
            Image image = reader.Execute();

            // Execute Gaussian smoothing filter
            DiscreteGaussianImageFilter filter = new DiscreteGaussianImageFilter();
            filter.SetVariance(Double.Parse(args[1]));

            MyCommand cmd = new MyCommand(filter);
            filter.AddCommand(EventEnum.sitkProgressEvent, cmd);

            image = filter.Execute(image);

            // Write output image
            ImageFileWriter writer = new ImageFileWriter();
            writer.SetFileName(args[2]);
            writer.Execute(image);

              } catch (Exception ex) {
            Console.WriteLine(ex);
              }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            try {
                if (args.Length < 3)
                {
                    Console.WriteLine("Usage: {0} <input> <variance> <output>", args[0]);
                    return;
                }
                // Read input image
                ImageFileReader reader = new ImageFileReader();
                reader.SetFileName(args[0]);
                Image image = reader.Execute();

                // Execute Gaussian smoothing filter
                DiscreteGaussianImageFilter filter = new DiscreteGaussianImageFilter();
                filter.SetVariance(Double.Parse(args[1]));

                MyCommand cmd = new MyCommand(filter);
                filter.AddCommand(EventEnum.sitkProgressEvent, cmd);

                image = filter.Execute(image);

                // Write output image
                ImageFileWriter writer = new ImageFileWriter();
                writer.SetFileName(args[2]);
                writer.Execute(image);
            } catch (Exception ex) {
                Console.WriteLine(ex);
            }
        }