/**
 * Example on the use of DicomImageIO for reading a single DICOM slice, rescale
 * the intensities and save it in a different file format.
 *
 */

import InsightToolkit.*;

public class DicomSliceRead
{
  public static void main( String argv[] )
  {
    System.out.println("DicomSliceRead Example");

    itkImageFileReaderUS2_Pointer reader = itkImageFileReaderUS2.itkImageFileReaderUS2_New();
    itkImageFileWriterUC2_Pointer writer = itkImageFileWriterUC2.itkImageFileWriterUC2_New();

    itkRescaleIntensityImageFilterUS2UC2_Pointer filter = itkRescaleIntensityImageFilterUS2UC2.itkRescaleIntensityImageFilterUS2UC2_New();

    filter.SetInput( reader.GetOutput() );
    writer.SetInput( filter.GetOutput() );

    itkDicomImageIO_Pointer dicomIO = itkDicomImageIO.itkDicomImageIO_New();
    
    reader.SetImageIO( dicomIO.GetPointer() );
    
    filter.SetOutputMinimum( 0 );
    filter.SetOutputMaximum(255);

    reader.SetFileName( argv[0] );
    writer.SetFileName( argv[1] );

    writer.Update();
  }

}



@@ -877,16 +877,23 @@
 inimum( 
+(short)
 0 );%0A   
@@ -917,16 +917,25 @@
 Maximum(
+ (short) 
 255);%0A%0A 

fix java compile with a cast to short