<div dir="ltr"><br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Binnur Yetim</b> <span dir="ltr"><<a href="mailto:binnuryetim@gmail.com">binnuryetim@gmail.com</a>></span><br>
Date: 2014-05-30 8:57 GMT+03:00<br>Subject: Vtk 3-d virtulization project<br>To: <a href="mailto:vtk-developers@vtk.org">vtk-developers@vtk.org</a><br><br><br><div dir="ltr">Hi<div> I work on a project .I want to virtulization data what I have in the .vtk extension file .My file in the is attached.I want to read and virtulization  this data with vtk in the c++ but I don't do .Can you help me please.My code is</div>

<div><br></div><div><br></div><div><div>// Program: Visualization Toolkit</div><div>// First include the required header files for the VTK classes we are using.</div><div>#include "vtkPolyDataMapper.h"</div><div>

#include "vtkPolyDataReader.h"</div><div>#include "vtkRenderWindow.h"</div><div>#include "vtkRenderWindowInteractor.h"</div><div>#include "vtkCamera.h"</div><div>#include "vtkProperty.h"</div>

<div>#include "vtkCleanPolyData.h"</div><div>#include "vtkActor.h"</div><div>#include "vtkRenderer.h"</div><div>#include "vtkInteractorStyleTrackballCamera.h"</div><div>#include "vtkAutoInit.h"</div>

<div>#include "vtkQuadricDecimation.h"</div><div>#include "vtkContourFilter.h"</div><div>#include <vtkVersion.h></div><div>#include "vtkStructuredGrid.h"</div><div>#include "vtkSmartPointer.h"</div>

<div>#include "vtkPolyData.h"</div><div>#include <string></div><div>#include "vtkRenderWindowInteractor.h"</div><div>#include <vtkPoints.h></div><div>#include <vtkTransform.h></div><div>

#include <vtkVertexGlyphFilter.h></div><div>#include <vtkPoints.h></div><div>#include <vtkCellArray.h></div><div>#include <vtkIterativeClosestPointTransform.h></div><div>#include <vtkTransformPolyDataFilter.h></div>

<div>#include <vtkLandmarkTransform.h></div><div>#include <vtkMath.h></div><div>#include <vtkMatrix4x4.h></div><div>#include <vtkXMLPolyDataWriter.h></div><div>#include <vtkRenderWindow.h></div>

<div>#include <vtkRenderWindowInteractor.h></div><div>#include <vtkXMLPolyDataReader.h></div><div>#include <vtkProperty.h></div><div>#include "vtkGenericDataObjectReader.h"</div><div>VTK_MODULE_INIT(vtkRenderingOpenGL);</div>

<div>VTK_MODULE_INIT(vtkInteractionStyle);</div><div>int main()</div><div>{</div><div>//vtk dosyasını okutan kod</div><div><br></div><div><span style="white-space:pre-wrap"> </span>/*vtkDataReader *reader=vtkPolyDataReader::New();</div>

<div><span style="white-space:pre-wrap">  </span>reader->SetFileName("C:/Users/Binnur Yetim/Desktop/bitirme tezi/poster/sample1.vtk");</div><div><span style="white-space:pre-wrap">       </span>reader->Update();*/</div>

<div><br></div><div>  // simply set filename here (oh static joy)</div><div>  std::string inputFilename = "C:/Users/Binnur Yetim/Desktop/bitirme tezi/poster/bitirme.vtk";</div><div><br></div><div>  // Get all data from the file</div>

<div>  vtkSmartPointer<vtkGenericDataObjectReader> reader = </div><div>      vtkSmartPointer<vtkGenericDataObjectReader>::New();</div><div>  reader->SetFileName(inputFilename.c_str());</div><div>  reader->Update();</div>

<div><br></div><div>  // All of the standard data types can be checked and obtained like this:</div><div>  if(reader->IsFilePolyData())</div><div>    {</div><div>    std::cout << "output is a polydata" << std::endl;</div>

<div>    vtkPolyData* output = reader->GetPolyDataOutput();</div><div>    std::cout << "output has " << output->GetNumberOfPoints() << " points." << std::endl;</div><div>
    }</div>
<div><br></div><div><br></div><div><span style="white-space:pre-wrap">        </span></div><div>vtkContourFilter *cont = vtkContourFilter::New();</div><div>cont->SetInputConnection(reader->GetOutputPort());</div><div>cont->SetNumberOfContours(1);</div>

<div>cont->SetValue(0, 200);</div><div><br></div><div>// between the source and the mapper.) </div><div>vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();</div><div>coneMapper->SetInputConnection( cont->GetOutputPort() );</div>

<div>//</div><div>// Create an actor </div><div>//</div><div>vtkActor *coneActor = vtkActor::New();</div><div>coneActor->SetMapper( coneMapper );</div><div>coneActor->GetProperty()->SetColor(0,0.5,0.5);</div><div>

<br></div><div>// Create the Renderer </div><div>//</div><div>vtkRenderer *ren1= vtkRenderer::New();</div><div>ren1->AddActor( coneActor );</div><div>ren1->SetBackground( 0, 1, 1 );</div><div>//</div><div>// Finally we create the render window which will show up on the screen.</div>

<div><br></div><div>vtkRenderWindow *renWin = vtkRenderWindow::New();</div><div>renWin->AddRenderer( ren1 );</div><div>renWin->SetSize( 500, 500);</div><div>//</div><div>// The vtkRenderWindowInteractor class watches for events (e.g., keypress,</div>

<div>// mouse) in the vtkRenderWindow. </div><div>vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();</div><div>iren->SetRenderWindow(renWin);</div><div>//</div><div>// By default the vtkRenderWindowInteractor instantiates an instance</div>

<div>// of vtkInteractorStyle. </div><div>vtkInteractorStyleTrackballCamera *style =</div><div>vtkInteractorStyleTrackballCamera::New();</div><div>iren->SetInteractorStyle(style);</div><div>//</div><div>// Unlike the previous scripts where we performed some operations and then</div>

<div>// exited, here we leave an event loop running. </div><div>//</div><div>iren->Initialize();</div><div>iren->Start();</div><div><br></div><div>// Free up any objects we created. All instances in VTK are deleted by</div>

<div>// using the Delete() method.</div><div>//</div><div>reader->Delete();</div><div>coneMapper->Delete();</div><div>coneActor->Delete();</div><div>ren1->Delete();</div><div>renWin->Delete();</div><div>iren->Delete();</div>

<div>style->Delete();</div><div>return 0;</div><div>}</div></div><div><br></div></div>
</div><br></div>