[vtkusers] Histogram

ambika 4u.ambika at gmail.com
Tue Feb 28 00:01:51 EST 2012


simple code to create histogram.

           vtkXYPlotActor xyPlotActor = new vtkXYPlotActor();
           vtkXMLImageDataReader reader = vtkXMLImageDataReader.New();
           vtkActor actor = vtkActor.New();
           vtkImageAccumulate histogram;
           vtkImageExtractComponents imageExtractComponents;
           vtkBarChartActor barChartActor = new vtkBarChartActor();
           vtkInteractorStyleImage style = vtkInteractorStyleImage.New();
           int imageScale = 1;
           vtkRenderer renderer =
renderWindowControl2.RenderWindow.GetRenderers().GetFirstRenderer();
           this.RenderWindow = renderWindowControl2.RenderWindow;
           vtkImageWriter writer = vtkPNGWriter.New();

           ////Read in the file 
           reader.SetFileName(fileName);
           reader.Update();


           imageExtractComponents = new vtkImageExtractComponents();
          
imageExtractComponents.SetInputConnection(reader.GetOutputPort());

           histogram = new vtkImageAccumulate();
           histogram.SetInput(imageExtractComponents.GetOutput());
           histogram.SetComponentOrigin(0, 0, 0);
           histogram.SetComponentSpacing(1, 1, 1);
           histogram.IgnoreZeroOn();
           histogram.Update();
           

           xyPlotActor.AddInput(histogram.GetOutput());
           renderer.AddActor(xyPlotActor);

--
View this message in context: http://vtk.1045678.n5.nabble.com/Histogram-tp1244900p5520858.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list