Ejemplo n.º 1
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestImageStreamer(String [] argv)
    {
        //Prefix Content is: ""

        reader = new vtkImageReader();
        reader.ReleaseDataFlagOff();
        reader.SetDataByteOrderToLittleEndian();
        reader.SetDataExtent((int)0, (int)63, (int)0, (int)63, (int)1, (int)93);
        reader.SetFilePrefix((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/headsq/quarter");
        reader.SetDataMask((int)0x7fff);
        rangeStart = 0.0;
        rangeEnd   = 0.2;
        LUT        = new vtkLookupTable();
        LUT.SetTableRange((double)0, (double)1800);
        LUT.SetSaturationRange((double)1, (double)1);
        LUT.SetHueRange((double)rangeStart, (double)rangeEnd);
        LUT.SetValueRange((double)1, (double)1);
        LUT.SetAlphaRange((double)1, (double)1);
        LUT.Build();
        // added these unused default arguments so that the prototype[]
        // matches as required in python.[]
        //method moved
        mapToRGBA = new vtkImageMapToColors();
        mapToRGBA.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
        mapToRGBA.SetOutputFormatToRGBA();
        mapToRGBA.SetLookupTable((vtkScalarsToColors)LUT);

        mapToRGBA.EndEvt += new Kitware.VTK.vtkObject.vtkObjectEventHandler(changeLUT_Command.Execute);

        streamer = new vtkMemoryLimitImageDataStreamer();
        streamer.SetInputConnection((vtkAlgorithmOutput)mapToRGBA.GetOutputPort());
        streamer.SetMemoryLimit((uint)100);
        streamer.UpdateWholeExtent();
        // set the window/level to 255.0/127.5 to view full range[]
        viewer = new vtkImageViewer();
        viewer.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
        viewer.SetColorWindow((double)255.0);
        viewer.SetColorLevel((double)127.5);
        viewer.SetZSlice((int)50);
        viewer.Render();

//deleteAllVTKObjects();
    }
Ejemplo n.º 2
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestImageStreamer(String [] argv)
    {
        //Prefix Content is: ""

          reader = new vtkImageReader();
          reader.ReleaseDataFlagOff();
          reader.SetDataByteOrderToLittleEndian();
          reader.SetDataExtent((int)0,(int)63,(int)0,(int)63,(int)1,(int)93);
          reader.SetFilePrefix((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/headsq/quarter");
          reader.SetDataMask((int)0x7fff);
          rangeStart = 0.0;
          rangeEnd = 0.2;
          LUT = new vtkLookupTable();
          LUT.SetTableRange((double)0,(double)1800);
          LUT.SetSaturationRange((double)1,(double)1);
          LUT.SetHueRange((double)rangeStart,(double)rangeEnd);
          LUT.SetValueRange((double)1,(double)1);
          LUT.SetAlphaRange((double)1,(double)1);
          LUT.Build();
          // added these unused default arguments so that the prototype[]
          // matches as required in python.[]
          //method moved
          mapToRGBA = new vtkImageMapToColors();
          mapToRGBA.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          mapToRGBA.SetOutputFormatToRGBA();
          mapToRGBA.SetLookupTable((vtkScalarsToColors)LUT);

          mapToRGBA.EndEvt += new Kitware.VTK.vtkObject.vtkObjectEventHandler(changeLUT_Command.Execute);

          streamer = new vtkMemoryLimitImageDataStreamer();
          streamer.SetInputConnection((vtkAlgorithmOutput)mapToRGBA.GetOutputPort());
          streamer.SetMemoryLimit((uint)100);
          streamer.UpdateWholeExtent();
          // set the window/level to 255.0/127.5 to view full range[]
          viewer = new vtkImageViewer();
          viewer.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
          viewer.SetColorWindow((double)255.0);
          viewer.SetColorLevel((double)127.5);
          viewer.SetZSlice((int)50);
          viewer.Render();

        //deleteAllVTKObjects();
    }