using System;
namespace itk.simple.examples {
class HelloWorld {
static void Main(string[] args) {
try {
VectorUInt32 imageSize = new VectorUInt32( new uint[] { 128, 128 } );
Image image = new Image( imageSize, pixelType );
VectorDouble faceSize = new VectorDouble( new double[] { 64, 64 } );
VectorDouble faceCenter = new VectorDouble( new double[] { 64, 64 } );
Image face = SimpleITK.GaussianSource( pixelType, imageSize, faceSize, faceCenter );
VectorDouble eyeSize = new VectorDouble( new double[] { 5, 5 } );
VectorDouble eye1Center = new VectorDouble( new double[] { 48, 48 } );
VectorDouble eye2Center = new VectorDouble( new double[] { 80, 48 } );
Image eye1 = SimpleITK.GaussianSource( pixelType, imageSize, eyeSize, eye1Center, 150 );
Image eye2 = SimpleITK.GaussianSource( pixelType, imageSize, eyeSize, eye2Center, 150 );
face = SimpleITK.Subtract( face, eye1 );
face = SimpleITK.Subtract( face, eye2 );
face = SimpleITK.BinaryThreshold( face, 200, 255, 255 );
VectorDouble mouthRadii = new VectorDouble( new double[] { 30, 20 } );
VectorDouble mouthCenter = new VectorDouble( new double[] { 64, 76 } );
Image mouth = SimpleITK.GaussianSource( pixelType, imageSize, mouthRadii, mouthCenter );
mouth = SimpleITK.BinaryThreshold( mouth, 200, 255, 255 );
mouth = SimpleITK.Subtract( 255, mouth );
VectorUInt32 mouthSize = new VectorUInt32( new uint[] { 64, 18 } );
VectorInt32 mouthLoc = new VectorInt32( new int[] { 32, 76 } );
face = SimpleITK.Paste( face, mouth, mouthSize, mouthLoc, mouthLoc );
image = SimpleITK.Add( image, face );
SimpleITK.Show( image, "Hello World: CSharp", true );
} catch (Exception ex) {
Console.WriteLine(ex);
}
}
}
}