[vtkusers] Opacity problems with vtkOSPRayPass

David E DeMarle dave.demarle at kitware.com
Wed Nov 8 16:42:29 EST 2017


I have a feeling that what is missing is that the vtk2OSPRay interface
doesn't respect the OpacityUnitDistance. Are the images close if you don't
change that?

If not, can you share images and/or data to reproduce with me so I can take
a look?

thanks



David E DeMarle
Kitware, Inc.
Principal Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909

On Mon, Nov 6, 2017 at 9:44 AM, Martina Litterio <mlitterio at pccube.com>
wrote:

> Hi all!
>
> I have a problem using vtkOSPRayPass. I'm reading a DICOM series with
> vtkDICOMImageReader.
>
> My code is :
>
> ..bla bla bla
>
> vtkNew<vtkGPUVolumeRayCastMapper> volumeMapper;
>
>     volumeMapper->SetAutoAdjustSampleDistances(0);
>
>     volumeMapper->SetSampleDistance(0.5);
>
>
>
>     vtkDICOMImageReader* reader = vtkDICOMImageReader::New();
>
>     reader->SetDirectoryName("Path/to/my/DICOM");
>
>     reader->Update();
>
>     volumeMapper->SetInputConnection(reader->GetOutputPort());
>
>
>
>     volumeMapper->AddObserver(vtkCommand::ErrorEvent, errorObserver);
>
>    vtkNew<vtkPiecewiseFunction> pwf;
>
>     pwf->AddPoint(-3024, 0.0);
>
>     pwf->AddPoint(-16, 0.0);
>
>     pwf->AddPoint(641, 0.05);
>
>     pwf->AddPoint(3071, 0.1);
>
>
>
>     ctf->AddRGBPoint( -3024, 0, 0, 0, 0.5, 0.0 );
>
>     ctf->AddRGBPoint( -16, 0.73, 0.25, 0.30, 0.49, .61 );
>
>     ctf->AddRGBPoint( 641, .90, .82, .56, .5, 0.0 );
>
>     ctf->AddRGBPoint( 3071, 1, 1, 1, .5, 0.0 );
>
>
>
>     volumeProperty->SetColor(ctf);
>
>     volumeProperty->SetScalarOpacity(pwf);
>
>     volumeProperty->SetShade(0);
>
>     volumeProperty->SetScalarOpacityUnitDistance(1.732);
>
>
>
>     vtkNew<vtkVolume> volume;
>
>     volume->SetMapper(volumeMapper);
>
>     volume->SetProperty(volumeProperty);
>
>
>
>     // Create the renderwindow, interactor and renderer
>
>     vtkNew<vtkRenderWindow> renderWindow;
>
>     renderWindow->SetMultiSamples(0);
>
>     renderWindow->SetSize(401, 399); // NPOT size
>
>
>
>     vtkNew<vtkRenderer> renderer;
>
>     renderer->SetBackground(0.3, 0.3, 0.4);
>
>     renderWindow->AddRenderer(renderer);
>
>
>
>     renderer->AddVolume(volume);
>
>     renderer->ResetCamera();
>
>     renderWindow->Render();
>
>
>
>     // Attach OSPRay render pass
>
>     vtkNew<vtkOSPRayPass> osprayPass;
>
>     if (useOSP)
>
>     {
>
>         renderer->SetPass(osprayPass);
>
>     }
>
>    vtkNew<vtkRenderWindowInteractor> iren;
>
>     iren->SetRenderWindow(renderWindow);
>
>     vtkNew<vtkInteractorStyleTrackballCamera> style;
>
>     iren->SetInteractorStyle(style);
>
>     iren->Start();
>
> ... bla bla bla
>
>
> Now, the problem is the following. If "useOSP"==FALSE, I have a certain
> opacity (the which one I would like to have in my results); if
> "useOSP"==TRUE, I have a different opacity and I'm not able to manage it as
> I want.
>
> Can you please tell me what's wrong in my code?
>
>
> ​Thanks to everyone!​
>
>
> *Martina Li**tterio*
>
> _______________________________________________
> 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:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20171108/9b0ff4ae/attachment.html>


More information about the vtkusers mailing list