using System;
using System.Globalization;
namespace itk.simple.examples
{
public class Program
{
static void Main(string[] args)
{
if (args.Length < 6)
{
Console.WriteLine("Missing Parameters ");
Console.WriteLine("Usage: " + System.AppDomain.CurrentDomain.FriendlyName +
" inputImage outputImage" +
" lowerThreshold upperThreshold seedX seedY [seed2X seed2Y ... ]");
return;
}
string inputFilename = args[0];
string outputFilename = args[1];
double lowerThreshold = double.Parse(args[2], CultureInfo.InvariantCulture);
double upperThreshold = double.Parse(args[3], CultureInfo.InvariantCulture);
SitkImage inputImage = SimpleITK.ReadImage(inputFilename,
PixelIDValueEnum.sitkFloat32);
blurFilter.SetTimeStep(0.125);
inputImage = blurFilter.Execute(inputImage);
segmentationFilter.
SetLower(lowerThreshold);
segmentationFilter.SetUpper(upperThreshold);
segmentationFilter.SetReplaceValue(255);
for (uint i = 4; i + 1 < args.Length; i += 2)
{
VectorUInt32 seed = new VectorUInt32(new uint[] { Convert.ToUInt32(args[i]), Convert.ToUInt32(args[i + 1]), 0 });
segmentationFilter.AddSeed(seed);
Console.WriteLine("Adding a seed at: ");
for (int j = 0; j + 1 < seed.Count; j++)
{
Console.WriteLine(seed[j] + " ");
}
}
SitkImage outImage = segmentationFilter.Execute(inputImage);
SimpleITK.WriteImage(outImage, outputFilename);
return;
}
}
}