<div dir="ltr">Aron,<div>Thanks! I have been through these examples.</div><div>I'll be happy if you can suggest my question to someone who has an experience in volume rendering.</div><div><br></div><div>Thanks,</div><div>Shadab <br></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Dec 12, 2018 at 5:51 PM Aron Helser <<a href="mailto:aron.helser@kitware.com">aron.helser@kitware.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">I have no experience with volume rendering in vtk, so my best suggestion is to look at some of the examples:<div><a href="https://lorensen.github.io/VTKExamples/site/Cxx/#volume-rendering" target="_blank">https://lorensen.github.io/VTKExamples/site/Cxx/#volume-rendering</a><br></div><div>and see how the parameters are set there, compared to your code.</div><div>You might have success modifying one of the examples to use your data.</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Dec 12, 2018 at 4:15 PM shadab anwar <<a href="mailto:sk.shadabanwar@gmail.com" target="_blank">sk.shadabanwar@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Aron,<div>Thanks for your reply.</div><div>I am not using any specific example.</div><div><br></div><div>I am trying to render voxels using imagedata, I have used the above code for doing so.</div><div>The problem I am facing is that whenever I rotate the image after rendering I don't get proper shading and uniform coloring. Instead, I am getting above rendering results, where you can see the few voxels are shaded as black!</div><div>I am not able to understand where I am going wrong. I tried changing few shading and lighting parameters but no success.</div><div><br></div><div>I am a newbie, apology If my problem is too basic!</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Dec 12, 2018 at 4:06 PM Aron Helser <<a href="mailto:aron.helser@kitware.com" target="_blank">aron.helser@kitware.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Can you be more specific? How do the images differ from what you expect? Is there are particular VTK example you are following that you are trying to change?<div><a href="https://lorensen.github.io/VTKExamples/site/Cxx/" target="_blank">https://lorensen.github.io/VTKExamples/site/Cxx/</a><br></div><div><br></div><div>Aron</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Dec 12, 2018 at 1:40 PM shadab anwar <<a href="mailto:sk.shadabanwar@gmail.com" target="_blank">sk.shadabanwar@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Guys,<div>Waiting for reply!</div><div><br></div><div>Please help!</div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Dec 5, 2018 at 2:08 PM shadab anwar <<a href="mailto:sk.shadabanwar@gmail.com" target="_blank">sk.shadabanwar@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hey amigos,<div><br></div><div>VTK noob here!</div><div><br></div><div>I facing a few problems while rendering vtkimagedata. The code snippet as follows,  </div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">X</span><span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(0,0,128)">4</span>,<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">Y</span>=<span style="color:rgb(0,0,128)">4</span>,<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">Z</span>=<span style="color:rgb(0,0,128)">4</span>;</pre> <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">       </span><span style="color:rgb(9,46,100)">imageData</span>-><span style="font-style:italic;color:rgb(0,103,124)">SetDimensions</span>(<span style="color:rgb(9,46,100)">X</span>,<span style="color:rgb(9,46,100)">Y</span>,<span style="color:rgb(9,46,100)">Z</span>);</pre><pre style="margin-top:0px;margin-bottom:0px">       imageData<span style="font-family:Arial,Helvetica,sans-serif">-></span><span style="font-family:Arial,Helvetica,sans-serif;font-style:italic;color:rgb(0,103,124)">SetSpacing</span><span style="font-family:Arial,Helvetica,sans-serif">(</span><span style="font-family:Arial,Helvetica,sans-serif;color:rgb(0,0,128)">1</span><span style="font-family:Arial,Helvetica,sans-serif">,</span><span style="font-family:Arial,Helvetica,sans-serif;color:rgb(0,0,128)">1</span><span style="font-family:Arial,Helvetica,sans-serif">,</span><span style="font-family:Arial,Helvetica,sans-serif;color:rgb(0,0,128)">1</span><span style="font-family:Arial,Helvetica,sans-serif">);</span></pre> <pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">       </span><span style="color:rgb(9,46,100)">imageData</span>-><span style="font-style:italic;color:rgb(0,103,124)">AllocateScalars</span>(<span style="color:rgb(0,0,128)">VTK_INT</span>,<span style="color:rgb(0,0,128)">1</span>);</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">for</span><span style="color:rgb(192,192,192)"> </span>(<span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">k</span><span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span>;<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">k</span><span style="color:rgb(192,192,192)"> </span><<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">Z</span><span style="color:rgb(192,192,192)"> </span>;<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">k</span>++)</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">       </span>{</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">           </span><span style="color:rgb(128,128,0)">for</span><span style="color:rgb(192,192,192)"> </span>(<span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">j</span><span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span>;<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">j</span><span style="color:rgb(192,192,192)"> </span><<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">Y</span><span style="color:rgb(192,192,192)"> </span>;<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">j</span>++)</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">           </span>{</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">               </span><span style="color:rgb(128,128,0)">for</span><span style="color:rgb(192,192,192)"> </span>(<span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">i</span><span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span>;<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">i</span><span style="color:rgb(192,192,192)"> </span><<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">X</span><span style="color:rgb(192,192,192)"> </span>;<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">i</span>++)</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">               </span>{</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">                   </span><span style="color:rgb(128,128,0)">int</span>*<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">voxel</span><span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">static_cast</span><<span style="color:rgb(128,128,0)">int</span>*>(<span style="color:rgb(9,46,100)">imageData</span>-><span style="font-style:italic;color:rgb(0,103,124)">GetScalarPointer</span>(<span style="color:rgb(9,46,100)">i</span>,<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">j</span>,<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">k</span>));</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">                      </span><span style="color:rgb(9,46,100)">voxel</span>[<span style="color:rgb(0,0,128)">0</span>]<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">10</span>;</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">               </span>}</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">           </span>}</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">       </span>}</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">for</span><span style="color:rgb(192,192,192)"> </span>(<span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">i</span>=<span style="color:rgb(0,0,128)">2</span>;<span style="color:rgb(9,46,100)">i</span>!=-<span style="color:rgb(0,0,128)">1</span>;<span style="color:rgb(9,46,100)">i</span>--)</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">       </span>{</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">       </span><span style="color:rgb(128,128,0)">int</span>*<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">voxel</span><span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">static_cast</span><<span style="color:rgb(128,128,0)">int</span>*>(<span style="color:rgb(9,46,100)">imageData</span>-><span style="font-style:italic;color:rgb(0,103,124)">GetScalarPointer</span>(<span style="color:rgb(0,0,128)">2</span>,<span style="color:rgb(9,46,100)">i</span>,<span style="color:rgb(9,46,100)">i</span>));</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(9,46,100)">voxel</span>[<span style="color:rgb(0,0,128)">0</span>]=<span style="color:rgb(0,0,128)">0</span>;</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>}</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(9,46,100)">mapper</span>-><span style="color:rgb(0,103,124)">SetBlendModeToComposite</span>();</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">     </span><span style="color:rgb(9,46,100)">mapper</span>-><span style="color:rgb(0,103,124)">SetRequestedRenderModeToRayCast</span>();</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">      </span><span style="color:rgb(9,46,100)">mapper</span>-><span style="font-style:italic;color:rgb(0,103,124)">SetInputData</span>(<span style="color:rgb(9,46,100)">imageData</span>);</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">     </span><span style="color:rgb(9,46,100)">compositeOpacity</span>-><span style="color:rgb(0,103,124)">AddPoint</span>(<span style="color:rgb(0,0,128)">10</span>,<span style="color:rgb(0,0,128)">1</span>);</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">      </span><span style="color:rgb(9,46,100)">color</span>-><span style="color:rgb(0,103,124)">AddRGBPoint</span>(<span style="color:rgb(0,0,128)">10</span>,<span style="color:rgb(0,0,128)">1</span>,<span style="color:rgb(0,0,128)">0</span>,<span style="color:rgb(0,0,128)">0</span>);</pre><pre style="margin-top:0px;margin-bottom:0px"><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">     </span><span style="color:rgb(9,46,100)">compositeOpacity</span>-><span style="color:rgb(0,103,124)">AddPoint</span>(<span style="color:rgb(0,0,128)">0</span>,<span style="color:rgb(0,0,128)">0</span>);</pre><pre style="margin-top:0px;margin-bottom:0px">       <span style="font-family:Arial,Helvetica,sans-serif;white-space:normal;color:rgb(9,46,100)">color</span><span style="font-family:Arial,Helvetica,sans-serif;white-space:normal">-></span><span style="font-family:Arial,Helvetica,sans-serif;white-space:normal;color:rgb(0,103,124)">AddRGBPoint</span><span style="font-family:Arial,Helvetica,sans-serif;white-space:normal">(</span><span style="font-family:Arial,Helvetica,sans-serif;white-space:normal;color:rgb(0,0,128)">0</span><span style="font-family:Arial,Helvetica,sans-serif;white-space:normal">,</span><span style="font-family:Arial,Helvetica,sans-serif;white-space:normal;color:rgb(0,0,128)">0</span><span style="font-family:Arial,Helvetica,sans-serif;white-space:normal">,</span><span style="font-family:Arial,Helvetica,sans-serif;white-space:normal;color:rgb(0,0,128)">0</span><span style="font-family:Arial,Helvetica,sans-serif;white-space:normal">,</span><span style="font-family:Arial,Helvetica,sans-serif;white-space:normal;color:rgb(192,192,192)"> </span><span style="font-family:Arial,Helvetica,sans-serif;white-space:normal;color:rgb(0,0,128)">0</span><span style="font-family:Arial,Helvetica,sans-serif;white-space:normal">);</span></pre><pre style="margin-top:0px;margin-bottom:0px"><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">       </span><span style="color:rgb(9,46,100)">volumeProperty</span>-><span style="color:rgb(0,103,124)">SetAmbient</span>(<span style="color:rgb(0,0,128)">0.3</span>);</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(9,46,100)">volumeProperty</span>-><span style="color:rgb(0,103,124)">SetDiffuse</span>(<span style="color:rgb(0,0,128)">0.4</span>);</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(9,46,100)">volumeProperty</span>-><span style="color:rgb(0,103,124)">SetSpecular</span>(<span style="color:rgb(0,0,128)">0.8</span>);</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">       </span><span style="color:rgb(9,46,100)">volumeProperty</span>-><span style="font-style:italic;color:rgb(0,103,124)">SetInterpolationType</span>(<span style="color:rgb(0,0,128)">0</span>);</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(9,46,100)">volumeProperty</span>-><span style="color:rgb(0,103,124)">ShadeOn</span>();</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(9,46,100)">volumeProperty</span>-><span style="color:rgb(0,103,124)">SetColor</span>(<span style="color:rgb(9,46,100)">color</span>);</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">         </span><span style="color:rgb(9,46,100)">volumeProperty</span>-><span style="color:rgb(0,103,124)">SetScalarOpacity</span>(<span style="color:rgb(9,46,100)">compositeOpacity</span>);</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(9,46,100)">          renderer</span>-><span style="font-style:italic;color:rgb(0,103,124)">SetBackground</span>(<span style="color:rgb(0,0,128)">0.5</span>,<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0.5</span>,<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0.5</span>); </pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(9,46,100)">        volume</span>-><span style="color:rgb(0,103,124)">SetMapper</span>(<span style="color:rgb(9,46,100)">mapper</span>);</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(9,46,100)">volume</span>-><span style="color:rgb(0,103,124)">SetProperty</span>(<span style="color:rgb(9,46,100)">volumeProperty</span>);</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(9,46,100)">renderer</span>-><span style="color:rgb(0,103,124)">AddViewProp</span>(<span style="color:rgb(9,46,100)">volume</span>);</pre>
<pre style="margin-top:0px;margin-bottom:0px">I am getting the below results,</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><div><img alt="image for forum.jpg" width="477" height="351" style="margin-right: 0px;">  <img alt="image for forum2.jpg" width="474" height="349" style="font-family: Arial, Helvetica, sans-serif; white-space: normal; margin-right: 0px;"><br></div><div><div><img alt="image for forum3.jpg" width="473" height="348" style="margin-right: 0px;"><br></div></div><div><br></div><div><br></div></pre>It can be seen that everytime I rotate my image I don't get a proper shading and color for the object. I have tried changing the lightining properties and shading properties but no sucess.</pre><pre style="margin-top:0px;margin-bottom:0px">I would be really thankful if anyone could help me.</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">Just for your information I am mechanical engineering with a bit of programming knowledge, so if my question is irrattional please forgive me.</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">Best,</pre><pre style="margin-top:0px;margin-bottom:0px">Shadab</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><pre style="margin-top:0px;margin-bottom:0px"><br></pre></pre></pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre></pre></pre></pre></div></div>
</blockquote></div>
_______________________________________________<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>
</blockquote></div>
</blockquote></div>
</blockquote></div>