vtk image procesing

25
VTK Sonu mangal Prepared by, C4console.com

Upload: sonu-mangal

Post on 14-Apr-2017

137 views

Category:

Education


0 download

TRANSCRIPT

Page 1: Vtk Image procesing

VTKSonu mangal

Prepared by,

C4console.com

Page 2: Vtk Image procesing

VTK• VTK stands for Visualization tool kit•Act or process of interpreting in visual terms or of putting into visual form.• in other words, transformation of data or information into picture.•Example : Weather forecasting maps

C4console.com

Page 3: Vtk Image procesing

VTK Process

C4console.com

Page 4: Vtk Image procesing

How to create VTK file?various ways to create VTK file like C++, Java, Python and so on. Import header file or standard library file and simple use them.

C4console.com

Page 5: Vtk Image procesing

Create cone file using VTK Step 1: Header filefirst include the required header files for the vtk classes we are using like for cone,#include "vtkConeSource.h"#include "vtkPolyDataMapper.h“#include "vtkActor.h"#include "vtkRenderer.h"#include "vtkRenderWindow.h“

C4console.com

Page 6: Vtk Image procesing

Create cone file using VTK Step 2: SourceIn our case, source is a cone.Next we create an instance of vtkConeSource and set some of its properties.Is a source process object means with no input.Part of visualization pipeline.Only produces data of output type is vtkpolydata. Which other filter may process.

C4console.com

Page 7: Vtk Image procesing

Create cone file using VTK > Source

Step 2: Source// create instance of conevtkConeSource *cone = vtkConeSource::New();

// set properties cone->SetHeight( 3.0 ); cone->SetRadius( 1.0 ); cone->SetResolution( 10 );

C4console.com

Page 8: Vtk Image procesing

Create cone file using VTK Step : filterProcess with both input and output.Filter will be process object with at least one input and one output (intermediate data store will not be represented)

C4console.com

Page 9: Vtk Image procesing

Create cone file using VTK Step : intermediate filter

Output of source should be behave as input for mapper by using these filter.

Source

mapper

Intermediate filter

(Vtk shrink polydata filter)

C4console.com

Page 10: Vtk Image procesing

Create cone file using VTK Step 3: mapperNow we create an instance of mapper to map the polygonal data into graphics primitives. declared in vtkploydatamapper.h header file. also known as sink.Process that consume data with no output.Because these process map data to a final image or output.

C4console.com

Page 11: Vtk Image procesing

Create cone file using VTK>mapper

Step 3: mapper// create instance of mappervtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();

// output of source into mapper coneMapper->SetInputConnection( cone->GetOutputPort() );

C4console.com

Page 12: Vtk Image procesing

PipelineConsist of object to represent,•Data object•Process Object•Arrow connection object

C4console.com

Page 13: Vtk Image procesing

Pipeline topologyElement of pipeline: Source, filter and mapper to create visualization pipeline or network

C4console.com

Page 14: Vtk Image procesing

Pipeline issueMostly 2 important issue that arises when we use pipeline1. Type2. Multiplicity

Type :means the form or type of data that process

object take as input or generate output.For ex: Sphere, cone

C4console.com

Page 15: Vtk Image procesing

Pipeline issueMultiplicityIs used to read a data file and manipulate

them and to also show them.For ex: stream file

C4console.com

Page 16: Vtk Image procesing

Create cone file using VTKStep 4: actorPreviously, we create source and set properties and then map them now, we represent the cone.Actor rendering of the mapper's graphics primitives. An actor also refers to properties via a vtkProperty instance, and includes an internal transformation matrix.We set this actor's mapper to be coneMapper which we created previous.

C4console.com

Page 17: Vtk Image procesing

Create cone file using VTK>actorStep 4: actor// set mapper graphics into actor for representvtkActor *coneActor = vtkActor::New(); coneActor->SetMapper( coneMapper );

C4console.com

Page 18: Vtk Image procesing

Create cone file using VTKStep 5: renderingRender is the process to convert data as input and converted into graphics or pictorial representation.A renderer is like a viewport.It is part or all of a window on the screen and it is responsible for drawing the actors it has. also set the background color here.

C4console.com

Page 19: Vtk Image procesing

Create cone file using VTK>render

Step 5: rendering

// create render objectvtkRenderer *ren1= vtkRenderer::New();// add render with actor ren1->AddActor( coneActor );// set background ren1->SetBackground( 0.1, 0.2, 0.4 );

C4console.com

Page 20: Vtk Image procesing

Create cone file using VTKStep 6: rendering window Now, finally show output in screen

by using renderwindow.h header file .

we put our renderer into the render window using AddRenderer.

C4console.com

Page 21: Vtk Image procesing

Create cone file using VTK>render window

Step 6: rendering window

// create renderwindow objectvtkRenderWindow *renWin = vtkRenderWindow::New(); // add renderwindow with render renWin->AddRenderer( ren1 );

C4console.com

Page 22: Vtk Image procesing

Create cone file usingStep 7: deleteNow we free OS memory or to release resource by using delete() function. cone->Delete(); coneMapper->Delete(); coneActor->Delete(); ren1->Delete(); renWin->Delete();

C4console.com

Page 23: Vtk Image procesing

ResultWhen we configure and generate .cxx file then we get following result like,

C4console.com

Page 24: Vtk Image procesing

Thank you

C4console.com

Page 25: Vtk Image procesing

For more details: www.c4console.com

C4console.com