import vtk.vtkNativeLibrary;
import vtk.vtkRenderWindow;
import vtk.vtkRenderWindowInteractor;
import vtk.vtkRenderer;
import vtk.vtkImageSinusoidSource;
import vtk.vtkImageNormalize;
import vtk.vtkImageCast;
import vtk.vtkImageActor;

public class ImageNormalize 
{
  // -----------------------------------------------------------------
  // Load VTK library and print which library was not properly loaded
  static 
  {
    if (!vtkNativeLibrary.LoadAllNativeLibraries()) 
    {
      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) 
      {
        if (!lib.IsLoaded()) 
        {
          System.out.println(lib.GetLibraryName() + " not loaded");
        }
      }
    }
    vtkNativeLibrary.DisableOutputWindow(null);
  }
  // -----------------------------------------------------------------

  public static void main(String args[]) 
  {
    //  Create an image
    vtkImageSinusoidSource source = new vtkImageSinusoidSource();
    source.Update();

    vtkImageNormalize normalizeFilter = new vtkImageNormalize();

    normalizeFilter.SetInputConnection(source.GetOutputPort());
    normalizeFilter.Update();
    
    vtkImageCast inputCastFilter = new vtkImageCast();
    inputCastFilter.SetInputConnection(source.GetOutputPort());
    inputCastFilter.SetOutputScalarTypeToUnsignedChar();
    inputCastFilter.Update();

    vtkImageCast normalizeCastFilter = new vtkImageCast();
    normalizeCastFilter.SetInputConnection(normalizeFilter.GetOutputPort());
    normalizeCastFilter.SetOutputScalarTypeToUnsignedChar();
    normalizeCastFilter.Update();
    
    //  Create actors
    vtkImageActor inputActor = new vtkImageActor();
    inputActor.GetMapper().SetInputConnection(inputCastFilter.GetOutputPort());

    vtkImageActor normalizedActor = new vtkImageActor();
    normalizedActor.GetMapper().SetInputConnection(normalizeCastFilter.GetOutputPort());
    
    //  Create the render window and interactor.
    vtkRenderWindow renWin = new vtkRenderWindow();
    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();
    iren.SetRenderWindow(renWin);
    
    //  Define viewport ranges
    // (xmin, ymin, xmax, ymax)
    double leftViewport[] = new double[] {0.0, 0.0, 0.5, 1.0};
    double rightViewport[] = new double[] {0.5, 0.0, 1.0, 1.0};
    
    //  Setup both renderers
    vtkRenderer leftRenderer = new vtkRenderer();
    renWin.AddRenderer(leftRenderer);
    leftRenderer.SetViewport(leftViewport);
    leftRenderer.SetBackground(.6, .5, .4);

    vtkRenderer rightRenderer = new vtkRenderer();
    renWin.AddRenderer(rightRenderer);
    rightRenderer.SetViewport(rightViewport);
    rightRenderer.SetBackground(.4, .5, .6);
    
    leftRenderer.AddActor(inputActor);
    rightRenderer.AddActor(normalizedActor);

    leftRenderer.ResetCamera();
    rightRenderer.ResetCamera();
    
    renWin.SetSize(600,300);
    renWin.Render();
   
    iren.Initialize();
    iren.Start();
  }
}

@@ -147,16 +147,43 @@
 Source;%0A
+import vtk.vtkNamedColors;%0A
 import v
@@ -204,16 +204,16 @@
 malize;%0A
-
 import v
@@ -256,16 +256,17 @@
 Actor;%0A%0A
+%0A
 public c
@@ -870,24 +870,296 @@
 rgs%5B%5D) %0A  %7B%0A
+  %0A    vtkNamedColors colors = new vtkNamedColors();%0A    %0A    double left_bkg%5B%5D = new double%5B%5D%7B0.6, 0.5, 0.4, 1.0%7D;%0A    double right_bkg%5B%5D = new double%5B%5D%7B0.4, 0.5, 0.6, 1.0%7D;%0A    %0A    colors.SetColor(%22bkgColor%22, left_bkg);%0A    colors.SetColor(%22boxColor%22, right_bkg);%0A    %0A
     //  Crea
@@ -2221,16 +2221,21 @@
 ractor.%0A
+    %0A
     vtkR
@@ -2578,24 +2578,29 @@
  1.0%7D;%0A    %0A
+    %0A
     //  Setu
@@ -2783,18 +2783,16 @@
 und(
-.6, .5, .4
+left_bkg
 );%0A%0A
@@ -2963,18 +2963,17 @@
 und(
-.4, .5, .6
+right_bkg
 );%0A 

Update ImageNormalize.java