<div dir="ltr"><div>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?</div><div><br></div><div>If not, can you share images and/or data to reproduce with me so I can take a look?</div><div><br></div><div>thanks</div><div><br></div><div><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>David E DeMarle<br>Kitware, Inc.<br>Principal Engineer<br>21 Corporate Drive<br>Clifton Park, NY 12065-8662<br>Phone: 518-881-4909</div></div></div></div></div></div>
<br><div class="gmail_quote">On Mon, Nov 6, 2017 at 9:44 AM, Martina Litterio <span dir="ltr"><<a href="mailto:mlitterio@pccube.com" target="_blank">mlitterio@pccube.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"><div class="gmail_default">
<p class="m_-8778077750530646446gmail-p1" style="font-family:"trebuchet ms",sans-serif">Hi all!</p><p class="m_-8778077750530646446gmail-p1"><span style="font-family:"trebuchet ms",sans-serif">I have a problem using vtkOSPRayPass. I'm reading a DICOM series with vtkDICOMImageReader.</span></p><p class="m_-8778077750530646446gmail-p1" style="font-family:"trebuchet ms",sans-serif">My code is :</p><p class="m_-8778077750530646446gmail-p1" style="font-family:"trebuchet ms",sans-serif">..bla bla bla</p><p class="m_-8778077750530646446gmail-p1">vtkNew<span class="m_-8778077750530646446gmail-s1"><</span>vtkGPUVolumeRayCastMapp<wbr>er<span class="m_-8778077750530646446gmail-s1">> volumeMapper;</span></p><p class="m_-8778077750530646446gmail-p2"><span class="m_-8778077750530646446gmail-s1"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>volumeMapper-></span>SetAutoAdjustSam<wbr>pleDistances<span class="m_-8778077750530646446gmail-s1">(</span><span class="m_-8778077750530646446gmail-s2">0</span><span class="m_-8778077750530646446gmail-s1">);</span></p><p class="m_-8778077750530646446gmail-p3"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>volumeMapper-><span class="m_-8778077750530646446gmail-s3">SetSampleDistanc<wbr>e</span>(<span class="m_-8778077750530646446gmail-s2">0.5</span>);</p><p class="m_-8778077750530646446gmail-p4"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span></p><p class="m_-8778077750530646446gmail-p1"><span class="m_-8778077750530646446gmail-s1"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span></span>vtkDICOMImageReader<span class="m_-8778077750530646446gmail-s1">* reader = </span>vtkDICOMImageReader<span class="m_-8778077750530646446gmail-s1">::</span><span class="m_-8778077750530646446gmail-s3">New</span><span class="m_-8778077750530646446gmail-s1">();</span></p><p class="m_-8778077750530646446gmail-p5"><span class="m_-8778077750530646446gmail-s1"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>reader-></span><span class="m_-8778077750530646446gmail-s3">SetDirectoryName</span><span class="m_-8778077750530646446gmail-s1">(</span>"<wbr>Path/to/my/DICOM"<span class="m_-8778077750530646446gmail-s1">);</span></p><p class="m_-8778077750530646446gmail-p3"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>reader-><span class="m_-8778077750530646446gmail-s3">Update</span>();</p><p class="m_-8778077750530646446gmail-p2"><span class="m_-8778077750530646446gmail-s1"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>volumeMapper-></span>SetInputConnecti<wbr>on<span class="m_-8778077750530646446gmail-s1">(reader-></span>GetOutputPort<span class="m_-8778077750530646446gmail-s1">());</span></p><p class="m_-8778077750530646446gmail-p4"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span></p><p class="m_-8778077750530646446gmail-p1" style="font-family:"trebuchet ms",sans-serif">
</p><p class="m_-8778077750530646446gmail-p3"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>volumeMapper-><span class="m_-8778077750530646446gmail-s3">AddObserver</span>(<span class="m_-8778077750530646446gmail-s4">vtkC<wbr>ommand</span>::<span class="m_-8778077750530646446gmail-s3">ErrorEvent</span>, errorObserver);</p><p class="m_-8778077750530646446gmail-p1" style="font-family:"trebuchet ms",sans-serif"> vtkNew<span class="m_-8778077750530646446gmail-s1"><</span>vtkPiecewiseFunction<span class="m_-8778077750530646446gmail-s1">> pwf;</span> </p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>pwf-><span class="m_-8778077750530646446gmail-s2">AddPoint</span>(-<span class="m_-8778077750530646446gmail-s3">3024</span>, <span class="m_-8778077750530646446gmail-s3">0.0</span>);</p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>pwf-><span class="m_-8778077750530646446gmail-s2">AddPoint</span>(-<span class="m_-8778077750530646446gmail-s3">16</span>, <span class="m_-8778077750530646446gmail-s3">0.0</span>);</p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>pwf-><span class="m_-8778077750530646446gmail-s2">AddPoint</span>(<span class="m_-8778077750530646446gmail-s3">641</span>, <span class="m_-8778077750530646446gmail-s3">0.05</span>);</p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>pwf-><span class="m_-8778077750530646446gmail-s2">AddPoint</span>(<span class="m_-8778077750530646446gmail-s3">3071</span>, <span class="m_-8778077750530646446gmail-s3">0.1</span>);</p>
<p class="m_-8778077750530646446gmail-p3" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span></p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>ctf-><span class="m_-8778077750530646446gmail-s2">AddRGBPoint</span>( -<span class="m_-8778077750530646446gmail-s3">3024</span>, <span class="m_-8778077750530646446gmail-s3">0</span>, <span class="m_-8778077750530646446gmail-s3">0</span>, <span class="m_-8778077750530646446gmail-s3">0</span>, <span class="m_-8778077750530646446gmail-s3">0.5</span>, <span class="m_-8778077750530646446gmail-s3">0.0</span> );</p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>ctf-><span class="m_-8778077750530646446gmail-s2">AddRGBPoint</span>( -<span class="m_-8778077750530646446gmail-s3">16</span>, <span class="m_-8778077750530646446gmail-s3">0.73</span>, <span class="m_-8778077750530646446gmail-s3">0.25</span>, <span class="m_-8778077750530646446gmail-s3">0.30</span>, <span class="m_-8778077750530646446gmail-s3">0.49</span>, <span class="m_-8778077750530646446gmail-s3">.61</span> );</p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>ctf-><span class="m_-8778077750530646446gmail-s2">AddRGBPoint</span>( <span class="m_-8778077750530646446gmail-s3">641</span>, <span class="m_-8778077750530646446gmail-s3">.90</span>, <span class="m_-8778077750530646446gmail-s3">.82</span>, <span class="m_-8778077750530646446gmail-s3">.56</span>, <span class="m_-8778077750530646446gmail-s3">.5</span>, <span class="m_-8778077750530646446gmail-s3">0.0</span> );</p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>ctf-><span class="m_-8778077750530646446gmail-s2">AddRGBPoint</span>( <span class="m_-8778077750530646446gmail-s3">3071</span>, <span class="m_-8778077750530646446gmail-s3">1</span>, <span class="m_-8778077750530646446gmail-s3">1</span>, <span class="m_-8778077750530646446gmail-s3">1</span>, <span class="m_-8778077750530646446gmail-s3">.5</span>, <span class="m_-8778077750530646446gmail-s3">0.0</span> );</p>
<p class="m_-8778077750530646446gmail-p3" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span></p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>volumeProperty-><span class="m_-8778077750530646446gmail-s2">SetColor</span>(ctf);</p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>volumeProperty-><span class="m_-8778077750530646446gmail-s2">SetScalarOpaci<wbr>ty</span>(pwf);</p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>volumeProperty-><span class="m_-8778077750530646446gmail-s2">SetShade</span>(<span class="m_-8778077750530646446gmail-s3">0</span>);</p>
<p class="m_-8778077750530646446gmail-p6" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-s1"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>volumeProperty-></span>SetScalarOpaci<wbr>tyUnitDistance<span class="m_-8778077750530646446gmail-s1">(</span><span class="m_-8778077750530646446gmail-s3">1.732</span><span class="m_-8778077750530646446gmail-s1">);</span></p>
<p class="m_-8778077750530646446gmail-p3" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span></p>
<p class="m_-8778077750530646446gmail-p1" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-s1"> </span>vtkNew<span class="m_-8778077750530646446gmail-s1"><</span>vtkVolume<span class="m_-8778077750530646446gmail-s1">> volume;</span></p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>volume-><span class="m_-8778077750530646446gmail-s2">SetMapper</span>(<wbr>volumeMapper);</p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>volume-><span class="m_-8778077750530646446gmail-s2">SetProperty</span>(<wbr>volumeProperty);</p>
<p class="m_-8778077750530646446gmail-p3" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span></p>
<p class="m_-8778077750530646446gmail-p2" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-s1"> </span>// Create the renderwindow, interactor and renderer</p>
<p class="m_-8778077750530646446gmail-p1" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-s1"> </span>vtkNew<span class="m_-8778077750530646446gmail-s1"><</span>vtkRenderWindow<span class="m_-8778077750530646446gmail-s1">> renderWindow;</span></p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>renderWindow-><span class="m_-8778077750530646446gmail-s2">SetMultiSamples</span>(<span class="m_-8778077750530646446gmail-s3"><wbr>0</span>);</p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>renderWindow-><span class="m_-8778077750530646446gmail-s2">SetSize</span>(<span class="m_-8778077750530646446gmail-s3">401</span>, <span class="m_-8778077750530646446gmail-s3">399</span>); <span class="m_-8778077750530646446gmail-s4">// NPOT size</span></p>
<p class="m_-8778077750530646446gmail-p3" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span></p>
<p class="m_-8778077750530646446gmail-p1" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-s1"> </span>vtkNew<span class="m_-8778077750530646446gmail-s1"><</span>vtkRenderer<span class="m_-8778077750530646446gmail-s1">> renderer;</span></p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>renderer-><span class="m_-8778077750530646446gmail-s2">SetBackground</span>(<span class="m_-8778077750530646446gmail-s3">0.3</span>, <span class="m_-8778077750530646446gmail-s3">0.3</span>, <span class="m_-8778077750530646446gmail-s3">0.4</span>);</p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>renderWindow-><span class="m_-8778077750530646446gmail-s2">AddRenderer</span>(<wbr>renderer);</p>
<p class="m_-8778077750530646446gmail-p3" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span></p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>renderer-><span class="m_-8778077750530646446gmail-s2">AddVolume</span>(volume);</p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>renderer-><span class="m_-8778077750530646446gmail-s2">ResetCamera</span>();</p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>renderWindow-><span class="m_-8778077750530646446gmail-s2">Render</span>();</p>
<p class="m_-8778077750530646446gmail-p3" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span></p>
<p class="m_-8778077750530646446gmail-p2" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-s1"> </span>// Attach OSPRay render pass</p>
<p class="m_-8778077750530646446gmail-p1" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-s1"> </span>vtkNew<span class="m_-8778077750530646446gmail-s1"><</span>vtkOSPRayPass<span class="m_-8778077750530646446gmail-s1">> osprayPass;</span></p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span><span class="m_-8778077750530646446gmail-s5">if</span> (useOSP)</p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>{</p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>renderer-><span class="m_-8778077750530646446gmail-s2">SetPass</span>(osprayPass);</p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>}</p><p class="m_-8778077750530646446gmail-p1" style="font-family:"trebuchet ms",sans-serif"> vtkNew<span class="m_-8778077750530646446gmail-s1"><</span>vtkRenderWindowInterac<wbr>tor<span class="m_-8778077750530646446gmail-s1">> iren;</span></p><p class="m_-8778077750530646446gmail-p2" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>iren-><span class="m_-8778077750530646446gmail-s2">SetRenderWindow</span>(<wbr>renderWindow);</p><p class="m_-8778077750530646446gmail-p1" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-s1"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span></span>vtkNew<span class="m_-8778077750530646446gmail-s1"><</span>vtkInteractorStyleTrack<wbr>ballCamera<span class="m_-8778077750530646446gmail-s1">> style;</span></p><p class="m_-8778077750530646446gmail-p3" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-s1"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>iren-></span>SetInteractorStyle<span class="m_-8778077750530646446gmail-s1">(<wbr>style);</span></p><p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif">
</p><p class="m_-8778077750530646446gmail-p2" style="font-family:"trebuchet ms",sans-serif"><span class="m_-8778077750530646446gmail-Apple-converted-space"> </span>iren-><span class="m_-8778077750530646446gmail-s2">Start</span>();</p><p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif">... bla bla bla</p><p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><br></p><p class="m_-8778077750530646446gmail-p4"><font face="trebuchet ms, sans-serif">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. </font></p><p class="m_-8778077750530646446gmail-p4"><font face="trebuchet ms, sans-serif">Can you please tell me what's wrong in my code?</font></p>
<p class="m_-8778077750530646446gmail-p4" style="font-family:"trebuchet ms",sans-serif"><br></p></div><div><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif">Thanks to everyone!</div><span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888"><br clear="all"><div><div class="m_-8778077750530646446gmail-m_-6751513172387578973gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><i style="font-size:12.8px;color:rgb(11,83,148)">Martina Li</i><i style="font-size:12.8px;color:rgb(11,83,148)">tterio</i><br></div></div></div></div></div></div></div>
</font></span></div>
<br>______________________________<wbr>_________________<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/<wbr>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_<wbr>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=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>