[vtkusers] volume mapper error

Abhishek abhishekworld at gmail.com
Thu Nov 15 01:52:44 EST 2018


I am still getting the same error message. can you tell me which version of
VTK are you using?

On Thu, Nov 15, 2018 at 4:34 PM Franks <masterwangzx at gmail.com> wrote:

> I run the following program with my data and get no error. When I uncomment
> out the code, I get the error as I said before.
>
>
> #include <vtkStructuredPointsReader.h>
> #include <vtkSmartVolumeMapper.h>
> #include <vtkSmartPointer.h>
> #include <vtkFloatArray.h>
> #include <vtkStructuredPoints.h>
> #include <vtkDataSet.h>
> #include <vtkPointData.h>
> #include <vtkPiecewiseFunction.h>
> #include <vtkColorTransferFunction.h>
> #include <vtkInteractorStyleTrackballCamera.h>
> #include <vtkVolume.h>
> #include <vtkVolumeProperty.h>
> #include <vtkRenderer.h>
> #include <vtkRenderWindow.h>
> #include <vtkRenderWindowInteractor.h>
>
>
> int main(int argc, char **argv) {
>     auto reader = vtkSmartPointer<vtkStructuredPointsReader>::New();
>     reader->SetFileName("mummy.vtk");
>     reader->Update();
>
> //    auto tuples = vtkSmartPointer<vtkFloatArray>::New();
> //    tuples->DeepCopy(reader->GetOutput()->GetPointData()->GetScalars());
> //    tuples->SetNumberOfComponents(2);
> //    for (int i = 0; i < tuples->GetNumberOfTuples(); ++i) {
> //        tuples->SetTuple2(i,80,80);
> //    }
> //
> //    reader->GetOutput()->GetPointData()->RemoveArray(0);
> //    reader->GetOutput()->GetPointData()->SetScalars(tuples);
>
>     auto volumeMapper = vtkSmartPointer<vtkSmartVolumeMapper>::New();
>     volumeMapper->SetInputConnection(reader->GetOutputPort());
>
>     auto volumeProperty = vtkSmartPointer<vtkVolumeProperty>::New();
>
>     auto compositeOpacity = vtkSmartPointer<vtkPiecewiseFunction>::New();
>     compositeOpacity->AddPoint(40, 0.00);
>     compositeOpacity->AddPoint(60, 0.40);
>     volumeProperty->SetScalarOpacity(compositeOpacity);
>
>     auto color = vtkSmartPointer<vtkColorTransferFunction>::New();
>     color->AddRGBPoint(0.000, 0.00, 0.00, 0.00);
>     color->AddRGBPoint(64.00, 1.00, 0.52, 0.30);
>     volumeProperty->SetColor(color);
>
>     auto volume = vtkSmartPointer<vtkVolume>::New();
>     volume->SetMapper(volumeMapper);
>     volume->SetProperty(volumeProperty);
>
>     auto ren = vtkSmartPointer<vtkRenderer>::New();
>     ren->AddViewProp(volume);
>     ren->SetBackground(1, 1, 1);
>
>     auto renWin = vtkSmartPointer<vtkRenderWindow>::New();
>     renWin->AddRenderer(ren);
>
>     auto style = vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();
>     auto iren = vtkSmartPointer<vtkRenderWindowInteractor>::New();
>     iren->SetRenderWindow(renWin);
>     iren->SetInteractorStyle(style);
>
>     iren->Initialize();
>     iren->Start();
>
>     return 0;
> }
>
>
>
>
> --
> Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/vtkusers
>


-- 
Abhishek
http://zeroth.me
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20181115/4603fec9/attachment.html>


More information about the vtkusers mailing list