import org.itk.simple.*;
class HelloWorld {
public static void main(String argv[]) {
long[] isize = {128, 128};
VectorUInt32 imageSize = new VectorUInt32( isize );
Image image = new Image( imageSize, pixelType );
double[] fsize = {64., 64.};
VectorDouble faceSize = new VectorDouble( fsize );
double[] fcenter = {64., 64.};
VectorDouble faceCenter = new VectorDouble( fcenter );
Image face = SimpleITK.gaussianSource( pixelType, imageSize, faceSize, faceCenter );
double[] esize = {5., 5.};
VectorDouble eyeSize = new VectorDouble( esize );
double[] e1center = {48., 48.};
VectorDouble eye1Center = new VectorDouble( e1center );
double[] e2center = {80., 48.};
VectorDouble eye2Center = new VectorDouble( e2center );
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., (short) 255 );
double[] mradius = {30., 20.};
VectorDouble mouthRadius = new VectorDouble( mradius );
double[] mcenter = {64., 76.};
VectorDouble mouthCenter = new VectorDouble( mcenter );
Image mouth = SimpleITK.gaussianSource( pixelType, imageSize, mouthRadius, mouthCenter );
mouth = SimpleITK.binaryThreshold( mouth, 200, 255, (short) 255 );
mouth = SimpleITK.subtract( 255, mouth );
long[] msize = {64, 18};
VectorUInt32 mouthSize = new VectorUInt32( msize );
int[] mloc = {32, 76};
VectorInt32 mouthLoc = new VectorInt32( mloc );
face = SimpleITK.paste( face, mouth, mouthSize, mouthLoc, mouthLoc );
image = SimpleITK.add( image, face );
if(System.getenv("SITK_NOSHOW") == null) {
SimpleITK.show( image, "Hello World: Java", true );
}
}
}