<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-09-12 16:34 GMT+02:00 Elvis Stansvik <span dir="ltr"><<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>></span>:<br><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><div><div><div>I believe I've now found yet another post (this time from 2001!) describing what I see:<br><br>    <a href="https://itk.org/pipermail/vtkusers/2001-June/006846.html" target="_blank">https://itk.org/pipermail/<wbr>vtkusers/2001-June/006846.html</a><br><br></div>In this thread, Lisa points out two things:<br><br>> <br>> Hello Alex,<br>> <br>> One other thing to note is that the transfer functions are not independent <br>> of scale. The scalar opacity function indicates how much opacity is <br>> accumulated per unit length. Scaling your volume by 0.1 means that you need <br>> to adjust this table accordingly.<br>> <br>> Lisa<br>> <br>> At 11:05 AM 6/18/2001, Lisa S. Avila wrote:<br>> >Hello Alex,<br>> ><br>> >I believe the comment stating that the sample distance is in voxel <br>> >coordinates is out-of-date. When Actor and Volume merged (quite a long <br>> >time ago) the Volume obtained a UserMatrix and 3 component scaling, and <br>> >the sampling distance changed to world distance. So, if you scale your <br>> >volume by 0.1 you should do the same to your sampling distance.<br>> ><br>> >One limitation (this is true of Actors and Volumes) is that non-uniform <br>> >scaling is not handled correctly for gradient calculation. For correct <br>> >rendering, change the aspect of the volume in the ImageData rather than <br>> >the Volume.<br>> ><br>> >Lisa<br><br></div>Given the age of that thread, I have to ask: Which of these things are still true? Must I always compensate my opacity transfer function taking the scale into account?<br><br></div><div>Lisa later explains how to do this:<br><br>    <a href="http://www.vtk.org/pipermail/vtkusers/2001-June/006860.html" target="_blank">http://www.vtk.org/pipermail/<wbr>vtkusers/2001-June/006860.html</a><br><br></div><div>Is this what I must do? At the moment, my different volumes share the same transfer function (in fact, the same volume property). But do do this compensation, I'd have to give them each their own opacity transfer function.<br></div></div></div></blockquote><div><br></div><div>I gave the above a quick try with my volume, changing my transfer function from<br><br>    opacity->AddPoint(0.000, 0.00);<br>    opacity->AddPoint(0.500, 0.00);<br>    opacity->AddPoint(2.000, 0.70);<br>    opacity->AddPoint(3.500, 1.00);<br>    opacity->AddPoint(20.000, 1.00);<br><br></div><div>to<br><br>    opacity->AddPoint(0.000, 1.0 - std::pow(1.0 - 0.0, 1 / 0.0006));<br>    opacity->AddPoint(0.500, 1.0 - std::pow(1.0 - 0.0, 1 / 0.0006));<br>    opacity->AddPoint(2.000, 1.0 - std::pow(1.0 - 0.70, 1 / 0.0006));<br>    opacity->AddPoint(3.500, 1.0 - std::pow(1.0 - 1.0, 1 / 0.0006));<br>    opacity->AddPoint(20.000, 1.0 - std::pow(1.0 - 1.0, 1 / 0.0006));<br><br></div><div>and got the attached result, so not quite there yet :( Scaling the opacity transfer functions like this seems to not be enough to get the same rendering as if I had hardcoded the spacings of the volume to 1 (instead of 0.0006).<br><br></div><div>Anyone know what else I have to do?<br><br></div><div>Elvis<br></div><div><br><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><div><br></div><div>But, do you think this is all that I have to do to get the rendering I want no matter the scale of the input data?<br></div><div><br></div>Thanks for any advice,<br></div>Elvis<div><div class="gmail-h5"><br><div><div><div><div><div><div class="gmail_extra"><br><div class="gmail_quote">2016-09-12 16:06 GMT+02:00 Elvis Stansvik <span dir="ltr"><<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>></span><wbr>:<br><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 class="gmail_extra"><div class="gmail_quote"><span>2016-09-12 15:30 GMT+02:00 Sankhesh Jhaveri <span dir="ltr"><<a href="mailto:sankhesh.jhaveri@kitware.com" target="_blank">sankhesh.jhaveri@kitware.com</a>></span><wbr>:<br><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 style="font-family:verdana,sans-serif;font-size:small;color:rgb(11,83,148)">Hi Elvis,</div><div style="font-family:verdana,sans-serif;font-size:small;color:rgb(11,83,148)"><br></div><div style="font-family:verdana,sans-serif;font-size:small;color:rgb(11,83,148)">There are flags on the volume mapper that allow setting the distance between samples along the ray. By default, the sample distance is computed as 1/2 the average spacing throughout the volume. If you have AutoAdjustSampleDistances enabled, the mapper computes the sample distance each frame based on the time taken to render the last frame. For consistent quality, you should disable AutoAdjustSampleDistances and set the sample distance explicitly. That way, you can leave the volume spacing in the units you desire.</div></div></blockquote><div><br></div></span><div>Hi Sankhesh,<br><br></div><div>Hm, I don't see why it shouldn't be able to automatically compute an appropriate sample distance even with small volume spacings?<br><br></div><div>E.g. right now, I'm testing with a volume that has 0.0006 spacing in all three dimensions and I leave the spacing as-is. The rendering looks like the attached result-0-0006.png.<br><br></div><div>If I just hardcode the spacing to 0.1 (much closer to 1) instead, the result is as shown in the attached result-0-1.png.<br><br></div><div>In both cases the same color/opacity transfer function is used, the difference is just the data spacing (and as a result, how much space the volume occupies in VTK the world).<br><br></div><div>Shouldn't the automatic adjustment of sample distances work in this case? I think want that feature turned on, because I want the quality to degrade when moving/rotating the camera, as it improves interactivity.<br><br></div><div>For testing, I tried disabling the AutoAdjustSampleDistances<span> </span>and hardcoding the sample distance to 0.0003 (half my data spacing) with:<br><br>            volumeMapper->SetAutoAdjustSam<wbr>pleDistances(0);<br>            volumeMapper->SetSampleDistanc<wbr>e(0.0003);<br><br></div><div>But the result was the same as in with the option turned on (as in the first screenshot).<br><br></div><div>Any other ideas?<br><br></div><div>Thanks a lot for your help.<span><font color="#888888"><br><br></font></span></div><span><font color="#888888"><div>Elvis<br></div></font></span><div><div><div><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 class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><br></div><span style="color:rgb(11,83,148)"><span style="font-family:verdana,sans-serif"><b><font size="2">Sankhesh Jhaveri</font></b><br><i>Sr. Research & Development Engineer</i> | </span></span><span style="font-family:verdana,sans-serif;color:rgb(11,83,148)"><a href="http://www.kitware.com" target="_blank">Kitware</a> | </span><span style="font-family:verdana,sans-serif;color:rgb(11,83,148)"><a href="tel:%28518%29%20881-4417" value="+15188814417" target="_blank">(518) 881-4417</a></span><div><br><b></b><br> </div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote"><div><div>On Mon, Sep 12, 2016 at 8:56 AM, Elvis Stansvik <span dir="ltr"><<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>2016-09-12 14:01 GMT+02:00 Elvis Stansvik <span dir="ltr"><<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>></span><wbr>:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div dir="ltr"><div><div><div>Hi all,<br><br></div>I've just noticed the there's a large difference in rendering quality if I decrease the spacing of my data (using vtkGPUVolumeRayCastMapper).<br><br></div>I found this very old post from 2007 about the same problem:<br><br>    <a href="http://public.kitware.com/pipermail/vtkusers/2007-March/040559.html" target="_blank">http://public.kitware.com/pipe<wbr>rmail/vtkusers/2007-March/0405<wbr>59.html</a><br><br></div><div>I was originally using a data spacing of 0.12, which is the voxel size in centimeters for the particular volume I'm working with (stored in our data files), but after I tried to divide it by 100.0 during loading, rendering quality dropped considerably. The reason I wanted to do this is because it's more convenient if VTK world coordinates are in meters in this particular application, not centimeters.<br><br><div>Anyone know why volume rendering quality seems dependant on the data spacing?<br></div></div></div></blockquote><div><br></div></span><div>I now found another more recent post from 2014 which describes in more detail what I seem to experience as well (seemingly also with no answer):<br><br>    <a href="http://public.kitware.com/pipermail/vtkusers/2014-March/083311.html" target="_blank">http://public.kitware.com/pipe<wbr>rmail/vtkusers/2014-March/0833<wbr>11.html</a><br><br></div><div>I get the expected rendering when the spacing is ~1.<br><br></div><div>Must I make sure that my volumes have a spacing ~1? I'm willing to abandon the idea of having VTK world coordinates == meters and introduce another scale, but it's a bit cumbersome as I'm working with multiple volumes which I add to the renderer at once, and not all of them will have the same spacing. This means I must first analyse the volumes I'm going to load a priori, and calculate a factor common to them all that will bring all of their spacings as close to 1 as possible :(<br><br></div><div>Would be great if someone in the know could chime in. Is there some workaround? Can I instruct the mapper to "expect" the small spacings I want to work with?<span><font color="#888888"><br><br></font></span></div><span><font color="#888888"><div>Elvis<br></div></font></span><span><div><br></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div dir="ltr"><div><div><br></div>Thanks for any clarifications!<span><font color="#888888"><br><br></font></span></div><span><font color="#888888"><div>Elvis<br></div></font></span></div>
</blockquote></span></div><br></div></div>
<br></div></div>______________________________<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/opensou<wbr>rce/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_FA<wbr>Q</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/mail<wbr>man/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div></div>
</blockquote></div></div></div><br></div></div>
</blockquote></div><br></div></div></div></div></div></div></div></div></div>
</blockquote></div><br></div></div>