<div dir="ltr">I am still getting the same error message. can you tell me which version of VTK are you using?</div><br><div class="gmail_quote"><div dir="ltr">On Thu, Nov 15, 2018 at 4:34 PM Franks <<a href="mailto:masterwangzx@gmail.com">masterwangzx@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I run the following program with my data and get no error. When I uncomment<br>
out the code, I get the error as I said before. <br>
<br>
<br>
#include <vtkStructuredPointsReader.h><br>
#include <vtkSmartVolumeMapper.h><br>
#include <vtkSmartPointer.h><br>
#include <vtkFloatArray.h><br>
#include <vtkStructuredPoints.h><br>
#include <vtkDataSet.h><br>
#include <vtkPointData.h><br>
#include <vtkPiecewiseFunction.h><br>
#include <vtkColorTransferFunction.h><br>
#include <vtkInteractorStyleTrackballCamera.h><br>
#include <vtkVolume.h><br>
#include <vtkVolumeProperty.h><br>
#include <vtkRenderer.h><br>
#include <vtkRenderWindow.h><br>
#include <vtkRenderWindowInteractor.h><br>
<br>
<br>
int main(int argc, char **argv) {<br>
auto reader = vtkSmartPointer<vtkStructuredPointsReader>::New();<br>
reader->SetFileName("mummy.vtk");<br>
reader->Update();<br>
<br>
// auto tuples = vtkSmartPointer<vtkFloatArray>::New();<br>
// tuples->DeepCopy(reader->GetOutput()->GetPointData()->GetScalars());<br>
// tuples->SetNumberOfComponents(2);<br>
// for (int i = 0; i < tuples->GetNumberOfTuples(); ++i) {<br>
// tuples->SetTuple2(i,80,80);<br>
// }<br>
//<br>
// reader->GetOutput()->GetPointData()->RemoveArray(0);<br>
// reader->GetOutput()->GetPointData()->SetScalars(tuples);<br>
<br>
auto volumeMapper = vtkSmartPointer<vtkSmartVolumeMapper>::New();<br>
volumeMapper->SetInputConnection(reader->GetOutputPort());<br>
<br>
auto volumeProperty = vtkSmartPointer<vtkVolumeProperty>::New();<br>
<br>
auto compositeOpacity = vtkSmartPointer<vtkPiecewiseFunction>::New();<br>
compositeOpacity->AddPoint(40, 0.00);<br>
compositeOpacity->AddPoint(60, 0.40);<br>
volumeProperty->SetScalarOpacity(compositeOpacity);<br>
<br>
auto color = vtkSmartPointer<vtkColorTransferFunction>::New();<br>
color->AddRGBPoint(0.000, 0.00, 0.00, 0.00);<br>
color->AddRGBPoint(64.00, 1.00, 0.52, 0.30);<br>
volumeProperty->SetColor(color);<br>
<br>
auto volume = vtkSmartPointer<vtkVolume>::New();<br>
volume->SetMapper(volumeMapper);<br>
volume->SetProperty(volumeProperty);<br>
<br>
auto ren = vtkSmartPointer<vtkRenderer>::New();<br>
ren->AddViewProp(volume);<br>
ren->SetBackground(1, 1, 1);<br>
<br>
auto renWin = vtkSmartPointer<vtkRenderWindow>::New();<br>
renWin->AddRenderer(ren);<br>
<br>
auto style = vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();<br>
auto iren = vtkSmartPointer<vtkRenderWindowInteractor>::New();<br>
iren->SetRenderWindow(renWin);<br>
iren->SetInteractorStyle(style);<br>
<br>
iren->Initialize();<br>
iren->Start();<br>
<br>
return 0;<br>
}<br>
<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html</a><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Abhishek<br><a href="http://zeroth.me" target="_blank">http://zeroth.me</a><br><br></div></div></div>