<div dir="ltr">Please keep the vtk users list in the replies...<div><br></div><div style>Is there an array called Distances in your polydata?</div><div style><br></div><div style>Try printing the polydata:</div><div style>
polydata->Print(std::cout);</div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 18, 2013 at 4:01 PM, rahul indoria <span dir="ltr"><<a href="mailto:rahulindoria5@gmail.com" target="_blank">rahulindoria5@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><b>Hi,</b><div><b> I am trying to modify my example something like that in main function to access the point data. can you check it???? </b></div>
<div><br></div><div><br></div><div><br></div><div><div> // Verify arguments</div>
<div> if (argc < 4)</div><div> {</div><div> std::cout << "Usage: " << argv[0]</div><div> << " InputVolume PolyDataInput"</div><div> << " Resolution"</div>
<div> << std::endl;</div><div> return EXIT_FAILURE;</div><div> }</div><div><br></div><div> // Parse arguments</div><div> std::string volumeFileName = argv[1];</div><div> std::string polyDataFileName = argv[2];</div>
<div> std::stringstream ssResolution;</div><div> ssResolution << argv[3];</div><div> unsigned int resolution;</div><div> ssResolution >> resolution;</div><div><br></div><div> // Output arguments</div><div>
std::cout << "InputVolume: " << volumeFileName << std::endl</div><div> << "PolyDataInput: " << polyDataFileName << std::endl</div><div> << "Resolution: " << resolution << std::endl;</div>
<div><br></div><div> // Read the volume data</div><div> vtkSmartPointer< vtkImageReader2Factory > imageFactory =</div><div> vtkSmartPointer< vtkImageReader2Factory >::New();</div><div> vtkImageReader2 *imageReader =</div>
<div> imageFactory->CreateImageReader2(volumeFileName.c_str());</div><div> imageReader->SetFileName(volumeFileName.c_str());</div><div> imageReader->Update();</div><div><br></div><div> // Read the Polyline</div>
<div> vtkSmartPointer<vtkPolyDataReader> polyLineReader =</div><div> vtkSmartPointer<vtkPolyDataReader>::New();</div><div> polyLineReader->SetFileName(polyDataFileName.c_str());</div><div> polyLineReader->Update();</div>
<div><br></div><div> vtkSmartPointer<vtkSplineFilter> spline =</div><div> vtkSmartPointer<vtkSplineFilter>::New();</div><div> spline->SetInputConnection(polyLineReader->GetOutputPort());</div><div>
spline->SetSubdivideToSpecified();</div>
<div> spline->SetNumberOfSubdivisions(resolution);</div><div><br></div><div> // Sweep the line to form a surface</div><div> double direction[3];</div><div> direction[0] = 0.0;</div><div> direction[1] = 0.0;</div>
<div>
direction[2] = 1.0;</div><div> double distance = 164;</div><div> spline->Update();</div><div> vtkSmartPointer<vtkPolyData> surface =</div><div> SweepLine(spline->GetOutput(),</div><div> direction,</div>
<div> distance,</div><div> atoi(argv[3]));</div><div><br></div><div> // Probe the volume with the extruded surface</div><div> vtkSmartPointer<vtkProbeFilter> sampleVolume =</div><div> vtkSmartPointer<vtkProbeFilter>::New();</div>
<div> sampleVolume->SetInputConnection(1, imageReader->GetOutputPort());</div><div>#if VTK_MAJOR_VERSION <= 5</div><div> sampleVolume->SetInput(0, surface);</div><div> #else</div><div> sampleVolume->SetInputData(0, surface);</div>
<div>#endif</div><div> // Compute a simple window/level based on scalar range</div><div> vtkSmartPointer<vtkWindowLevelLookupTable> wlLut =</div><div> vtkSmartPointer<vtkWindowLevelLookupTable>::New();</div>
<div> double range = imageReader->GetOutput()->GetScalarRange()[1] -</div><div> imageReader->GetOutput()->GetScalarRange()[0];</div><div> double level = (imageReader->GetOutput()->GetScalarRange()[1] +</div>
<div> imageReader->GetOutput()->GetScalarRange()[0]) / 2.0;</div><div> wlLut->SetWindow(range);</div><div> wlLut->SetLevel(level);</div><div> sampleVolume->Update();</div><div><br></div>
<div><br></div><div> // Extract the polydata</div><div> vtkSmartPointer<vtkPolyData> polydata = </div><div><span style="white-space:pre-wrap">        </span>vtkSmartPointer<vtkPolyData> :: New();</div><div> polydata = vtkPolyData::SafeDownCast(sampleVolume->GetOutput());</div>
<div><br></div><div> // Get the number of points in the polydata</div><div> vtkIdType idNumPointsInFile = polydata->GetNumberOfPoints();</div><div><br></div><div> vtkSmartPointer<vtkDoubleArray> array = vtkSmartPointer<vtkDoubleArray> :: New();</div>
<div> array = vtkDoubleArray::SafeDownCast(polydata->GetPointData()->GetArray("Distances"));</div><div><span style="white-space:pre-wrap">        </span></div><div> if(array)</div><div> {</div><div> for(int i = 0; i < idNumPointsInFile; i++) </div>
<div> {</div><div> std::cout << "Got array." << std::endl;</div><div> double dist;</div><div> dist = array->GetValue(i);</div><div> /*</div><div> //if the array held arrays instead of scalars, you would use this:<span style="white-space:pre-wrap">                </span> </div>
<div> double location[3];</div><div> array->GetTupleValue(i, location);</div><div> std::cout << "Location: " << Location[0] << "," << Location[1] << "," << Location[2] << std::endl;</div>
<div> */</div><div> std::cout << "Distance: " << dist << std::endl;</div><div> }</div><div> }//end if(array)</div><div> else</div><div> {</div><div> std::cout << "no array." << std::endl;</div>
<div> }</div><div><br></div><div> system("PAUSE");</div><div><br></div><div> return EXIT_SUCCESS;</div></div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">
On Thu, Jul 18, 2013 at 9:53 PM, rahul indoria <span dir="ltr"><<a href="mailto:rahulindoria5@gmail.com" target="_blank">rahulindoria5@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I am trying to get the point data of each point of this example <a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/CurvedReformation" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/CurvedReformation</a> <div>
<br></div><div>so that`s why i am trying to use the point data access example (<a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/GetMiscPointData" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/GetMiscPointData</a>)</div>
<div>
<div><br></div><div><br></div><div><br></div><div>Looking forward your reply soon.</div><div><br></div></div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 18, 2013 at 9:48 PM, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The file seems fine. The example read it, but it does not contain any point data. This example is meant to show you how to access poiont data if it exists.<div>
<br></div><div>What is your goal?</div><div>
<br></div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 18, 2013 at 3:45 PM, rahul indoria <span dir="ltr"><<a href="mailto:rahulindoria5@gmail.com" target="_blank">rahulindoria5@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Bill,<div> I am also using .vtp file. i am attaching a file with this mail, if this is wrong, could you please suggest me some other file, as i am new on vtk, so i am not very much familiar with it. </div>
<div>
<div><br></div><div>Looking forward your reply soon.</div></div></div><div class="gmail_extra"><div><div><br><br><div class="gmail_quote">On Thu, Jul 18, 2013 at 9:40 PM, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">It requires an input xml polydata file, a .vtp file.<div><br></div><div>The file should contain point data.</div>
<div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>
On Thu, Jul 18, 2013 at 3:25 PM, rahul indoria <span dir="ltr"><<a href="mailto:rahulindoria5@gmail.com" target="_blank">rahulindoria5@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div>
<div dir="ltr">Hi,<div> could you please check this example, what should be the arguments for this examples. </div><div><br></div><div><a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/GetMiscPointData" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/GetMiscPointData</a><br>
</div><div><br></div><div>Can you tell me the arguments of this example.</div><div><br></div><div><br></div><div>Looking forward your reply soon.</div><span><font color="#888888"><div><br></div><div>Rahul </div>
</font></span></div>
<br></div></div>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span><font color="#888888">-- <br><div dir="ltr"><span style="color:rgb(0,0,255)"><b>Best Regards<br>Rahul Indoria<br>Mobile No: <a href="tel:%2B49-157-35652212" value="+4915735652212" target="_blank">+49-157-35652212</a></b></span><br>
</div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><span style="color:rgb(0,0,255)"><b>Best Regards<br>Rahul Indoria<br>Mobile No: <a href="tel:%2B49-157-35652212" value="+4915735652212" target="_blank">+49-157-35652212</a></b></span><br>
</div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><span style="color:rgb(0,0,255)"><b>Best Regards<br>Rahul Indoria<br>Mobile No: <a href="tel:%2B49-157-35652212" value="+4915735652212" target="_blank">+49-157-35652212</a></b></span><br>
</div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>