[vtkusers] vtkVolumeProperty IndependentComponents On and Off

Aashish Chaudhary aashish.chaudhary at kitware.com
Fri Dec 11 23:23:00 EST 2015


Hi Kenji,

I created a merge request and added a test for two component (independent)
with gradient opacity here (
https://gitlab.kitware.com/vtk/vtk/merge_requests/1007/diffs). After
sending you the patch I looked at your opacity values closely and was
trying to find this tricky bug as I was not happy with the image the code
was generating. I fixed all of the remaining issues and with you original
code, I believe I am getting the correct rendering.  Thank you so much for
reporting this bug as not only I fixed the bug but hopefully increase the
code coverage as well.

Thanks,
Aashish

On Wed, Dec 9, 2015 at 3:01 PM, Aashish Chaudhary <
aashish.chaudhary at kitware.com> wrote:

> Hi Kenji,
>
> That's just my patch in case you had to send me what shader we were
> generating. You can
> ignore this as in my branch to VTK, I will remove it. Make sure that your
> gradients are matching
> with gradient opacity values or else you would not see anything or will
> see unexpected color
> and opacity.
>
> - aashish
>
> On Wed, Dec 9, 2015 at 2:58 PM, Kenji Tsumura <
> kenji.tsumura at neosoftmedical.com> wrote:
>
>> Thank for the advice.
>>
>> Now I can see volume rendering in both my application and test program
>> with gradient option.
>>
>> When I run, the console output program source code in the attached file.
>>
>> Is this because I am using latest VTK?
>>
>>
>>
>> Thank you,
>>
>>
>>
>> Kenji
>>
>>
>>
>> *From:* Aashish Chaudhary [mailto:aashish.chaudhary at kitware.com]
>> *Sent:* Wednesday, December 09, 2015 1:43 PM
>>
>> *To:* Kenji Tsumura
>> *Cc:* vtkusers at vtk.org
>> *Subject:* Re: [vtkusers] vtkVolumeProperty IndependentComponents On and
>> Off
>>
>>
>>
>> Make sure that your gradient opacity function is set correctly (or as
>> expected). I believe you are going from 0.0 - 0.5. Can you change it to 0.2
>> - 0.5 and see if something shows up?
>>
>>
>>
>> Thanks,
>>
>>
>>
>>
>>
>> On Wed, Dec 9, 2015 at 2:39 PM, Kenji Tsumura <
>> kenji.tsumura at neosoftmedical.com> wrote:
>>
>> Hi Aashish,
>>
>>
>>
>> I tried, but both my application and the test program doesn’t work with
>> gradient opacity.
>>
>> The display window were black.
>>
>> There is no apparent error…
>>
>>
>>
>> Thank you,
>>
>>
>>
>> Kenji
>>
>>
>>
>> *From:* Aashish Chaudhary [mailto:aashish.chaudhary at kitware.com]
>> *Sent:* Wednesday, December 09, 2015 12:44 PM
>>
>>
>> *To:* Kenji Tsumura
>> *Cc:* vtkusers at vtk.org
>> *Subject:* Re: [vtkusers] vtkVolumeProperty IndependentComponents On and
>> Off
>>
>>
>>
>> Kenji,
>>
>>
>>
>> Can you try the latest patch? Undo the last patch before you apply this
>> patch:
>>
>>
>>
>> Thanks,
>>
>>
>>
>>
>>
>> On Wed, Dec 9, 2015 at 1:35 PM, Aashish Chaudhary <
>> aashish.chaudhary at kitware.com> wrote:
>>
>> Let me check.. scalarsRange is the local variables (float) type. I tested
>> it on my Linux box and things were
>>
>> fine but it is possible that gcc failed to catch it.
>>
>>
>>
>> On Wed, Dec 9, 2015 at 1:25 PM, Kenji Tsumura <
>> kenji.tsumura at neosoftmedical.com> wrote:
>>
>> Hi Aashish,
>>
>>
>>
>> I applied the patch to the latest VTK (from GIT) and rebuilt it.
>>
>> An error occurred when I run the test program you gave me without
>> gradient opacity.
>>
>> Please find the attached file.
>>
>> I am not sure why…
>>
>>
>>
>> Thank you,
>>
>>
>>
>> Kenji
>>
>>
>>
>> *From:* Aashish Chaudhary [mailto:aashish.chaudhary at kitware.com]
>> *Sent:* Wednesday, December 09, 2015 9:04 AM
>>
>>
>> *To:* Kenji Tsumura
>> *Cc:* vtkusers at vtk.org
>> *Subject:* Re: [vtkusers] vtkVolumeProperty IndependentComponents On and
>> Off
>>
>>
>>
>> Hi Kenji,
>>
>>
>>
>> Could you please try the attached patch? Once if works for you, I will
>> clean it up and create a merge request.
>>
>>
>>
>> Thanks,
>>
>>
>>
>>
>>
>> On Tue, Dec 8, 2015 at 11:41 AM, Aashish Chaudhary <
>> aashish.chaudhary at kitware.com> wrote:
>>
>> Aha... I think I know how to fix the bug.  Gradient opacity was the key.
>> I will push a fix today.
>>
>>
>>
>> - Aashish
>>
>>
>>
>> On Tue, Dec 8, 2015 at 11:30 AM, Kenji Tsumura <
>> kenji.tsumura at neosoftmedical.com> wrote:
>>
>> Hi Aashish,
>>
>>
>>
>> Adding gradient opacity to the test sample causes the same error I have
>> seen in my application.
>>
>> Please refer to the attached file.
>>
>> So my application works with IndependentComponents On after removing
>> gradient opacity.
>>
>>
>>
>> Kenji
>>
>>
>>
>> *From:* Aashish Chaudhary [mailto:aashish.chaudhary at kitware.com]
>> *Sent:* Tuesday, December 08, 2015 8:22 AM
>>
>>
>> *To:* Kenji Tsumura
>> *Cc:* vtkusers at vtk.org
>> *Subject:* Re: [vtkusers] vtkVolumeProperty IndependentComponents On and
>> Off
>>
>>
>>
>> That would be great Kenji, thanks.
>>
>>
>>
>> - Aashish
>>
>>
>>
>> On Mon, Dec 7, 2015 at 5:29 PM, Kenji Tsumura <
>> kenji.tsumura at neosoftmedical.com> wrote:
>>
>> Aashish,
>>
>>
>>
>> Thank you very much.
>>
>> I will try to run the test example and see what happens.
>>
>> If the test is ok, I will try to reproduce the problem with simpler code.
>>
>>
>>
>> Kenji
>>
>>
>>
>> *From:* Aashish Chaudhary [mailto:aashish.chaudhary at kitware.com]
>> *Sent:* Monday, December 07, 2015 3:58 PM
>>
>>
>> *To:* Kenji Tsumura
>> *Cc:* vtkusers at vtk.org
>> *Subject:* Re: [vtkusers] vtkVolumeProperty IndependentComponents On and
>> Off
>>
>>
>>
>> Thanks Kenji for trying out. Its not clear in the log why the build
>> shader code crashed.
>>
>> Also, I realized that you using Java bindings. Would it be possible to
>> re-create this issue
>>
>> with a small sample code and you send it to me? We do have two component
>> and 4 component
>>
>> test (dependent and independent). Please have a look here:
>> https://github.com/Kitware/VTK/blob/master/Rendering/Volume/Testing/Cxx/TestGPURayCastTwoComponentsIndependent.cxx
>>
>>
>>
>> and
>>
>>
>>
>>
>> https://github.com/Kitware/VTK/blob/master/Rendering/Volume/Testing/Cxx/TestGPURayCastTwoComponentsDependent.cxx
>>
>>
>>
>>
>>
>> Thanks,
>>
>>
>>
>>
>>
>> On Mon, Dec 7, 2015 at 3:41 PM, Kenji Tsumura <
>> kenji.tsumura at neosoftmedical.com> wrote:
>>
>> Hi Aashish,
>>
>>
>>
>> Thank you.
>>
>> I tried with vtkGPUVolumeRayCastMapper.
>>
>> An error occurs without setting IndependentComponentsOff.
>>
>> It seems  the error occurs in
>> vtkOpenGLGPUVolumeRayCastMapper::BuildShader (See the attached file).
>>
>>
>>
>> Kenji
>>
>>
>>
>> *From:* Aashish Chaudhary [mailto:aashish.chaudhary at kitware.com]
>> *Sent:* Monday, December 07, 2015 1:54 PM
>> *To:* Kenji Tsumura
>> *Cc:* vtkusers at vtk.org
>> *Subject:* Re: [vtkusers] vtkVolumeProperty IndependentComponents On and
>> Off
>>
>>
>>
>>
>>
>>
>>
>> On Mon, Dec 7, 2015 at 12:19 PM, Kenji Tsumura <
>> kenji.tsumura at neosoftmedical.com> wrote:
>>
>> Hello,
>>
>>
>>
>> I have 3D cardiac MRI data (magnitude data and velocity data), and would
>> like to display the volume rendering of the two data.
>>
>> I create vtkVolume with two components  (first one is velocity data and
>> second one is magnitude data) and use vtkSmartVolumeMapper.
>>
>> When I set IndependentComponentsOn to the volume property, I can see what
>> I want (refer to the first figure).
>>
>> But this setting disables GPU rendering and it is slow.
>>
>>
>>
>> I don't remember vtkSmartVolumeMapper has this logic, I will have a look.
>> In the old GPU raycast mapper, there was some issue with independent
>> components so may be that is the reason that smart volume mapper switched
>> to fixed point ray cast.
>>
>>
>>
>> Is there a particular reason you are using vtkSmartVolumeMapper?  You can
>> directly use GPUVolume RayCastMapper
>>
>>
>>
>> My understanding is that I have to use IndependentComponentsOff to make
>> the mapper use GPU rendering.
>>
>> When I set IndependentComponentsOff, only one color transfer function,
>> and only one scalar opacity function to the volume property,
>>
>> the magnitude data (the second component) is also color-coded (refer to
>> the second figure).
>>
>> I thought this contradicts the method comments of
>> IndependentComponentsOn/ IndependentComponentsOff.
>>
>>
>>
>> “For 2 component data, the first is passed through the first color
>> transfer function and the second component is passed through the first
>> opacity transfer function.”
>>
>>
>>
>> Am I missing something?
>>
>> Can I make the volume rendering look the same as using two components?
>>
>>
>>
>> Thank you,
>>
>>
>>
>> BTY, I use v6.3.0, OpenGL2.
>>
>>
>>
>> --
>>
>> Kenji Tsumura
>>
>>
>>
>> “The information contained in this communication may be confidential, is
>> intended only for the use of the recipient(s) named above, and may be
>> legally privileged. If the reader of this message is not the intended
>> recipient, you are hereby notified that any dissemination, distribution, or
>> copying of this communication, or any of its contents, is strictly
>> prohibited. If you have received this communication in error, please return
>> it to the sender immediately and delete the original message and any copy
>> of it from your computer system. If you have any questions concerning this
>> message, please contact the sender.
>>
>> Disclaimer: The information contained in this communication may be
>> confidential, is intended only for the use of the recipient(s) named above,
>> and may be legally privileged. If the reader of this message is not the
>> intended recipient, you are hereby notified that any dissemination,
>> distribution, or copying of this communication, or any of its contents, is
>> strictly prohibited. If you have received this communication in error,
>> please return it to the sender immediately and delete the original message
>> and any copy of it from your computer system. If you have any questions
>> concerning this message, please contact the sender.
>>
>>
>> _______________________________________________
>> 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
>>
>>
>>
>>
>>
>> --
>>
>>
>>
>> *| Aashish Chaudhary | Technical Leader          | Kitware Inc.
>>   *
>>
>> *| http://www.kitware.com/company/team/chaudhary.html
>> <http://www.kitware.com/company/team/chaudhary.html>*
>>
>> Disclaimer: The information contained in this communication may be
>> confidential, is intended only for the use of the recipient(s) named above,
>> and may be legally privileged. If the reader of this message is not the
>> intended recipient, you are hereby notified that any dissemination,
>> distribution, or copying of this communication, or any of its contents, is
>> strictly prohibited. If you have received this communication in error,
>> please return it to the sender immediately and delete the original message
>> and any copy of it from your computer system. If you have any questions
>> concerning this message, please contact the sender.
>>
>>
>>
>>
>>
>> --
>>
>>
>>
>> *| Aashish Chaudhary | Technical Leader          | Kitware Inc.
>>   *
>>
>> *| http://www.kitware.com/company/team/chaudhary.html
>> <http://www.kitware.com/company/team/chaudhary.html>*
>>
>> Disclaimer: The information contained in this communication may be
>> confidential, is intended only for the use of the recipient(s) named above,
>> and may be legally privileged. If the reader of this message is not the
>> intended recipient, you are hereby notified that any dissemination,
>> distribution, or copying of this communication, or any of its contents, is
>> strictly prohibited. If you have received this communication in error,
>> please return it to the sender immediately and delete the original message
>> and any copy of it from your computer system. If you have any questions
>> concerning this message, please contact the sender.
>>
>>
>>
>>
>>
>> --
>>
>>
>>
>> *| Aashish Chaudhary | Technical Leader          | Kitware Inc.
>>   *
>>
>> *| http://www.kitware.com/company/team/chaudhary.html
>> <http://www.kitware.com/company/team/chaudhary.html>*
>>
>> Disclaimer: The information contained in this communication may be
>> confidential, is intended only for the use of the recipient(s) named above,
>> and may be legally privileged. If the reader of this message is not the
>> intended recipient, you are hereby notified that any dissemination,
>> distribution, or copying of this communication, or any of its contents, is
>> strictly prohibited. If you have received this communication in error,
>> please return it to the sender immediately and delete the original message
>> and any copy of it from your computer system. If you have any questions
>> concerning this message, please contact the sender.
>>
>>
>>
>>
>>
>> --
>>
>>
>>
>> *| Aashish Chaudhary | Technical Leader          | Kitware Inc.
>>   *
>>
>> *| http://www.kitware.com/company/team/chaudhary.html
>> <http://www.kitware.com/company/team/chaudhary.html>*
>>
>>
>>
>>
>>
>> --
>>
>>
>>
>> *| Aashish Chaudhary | Technical Leader          | Kitware Inc.
>>   *
>>
>> *| http://www.kitware.com/company/team/chaudhary.html
>> <http://www.kitware.com/company/team/chaudhary.html>*
>>
>> Disclaimer: The information contained in this communication may be
>> confidential, is intended only for the use of the recipient(s) named above,
>> and may be legally privileged. If the reader of this message is not the
>> intended recipient, you are hereby notified that any dissemination,
>> distribution, or copying of this communication, or any of its contents, is
>> strictly prohibited. If you have received this communication in error,
>> please return it to the sender immediately and delete the original message
>> and any copy of it from your computer system. If you have any questions
>> concerning this message, please contact the sender.
>>
>>
>>
>>
>>
>> --
>>
>>
>>
>> *| Aashish Chaudhary | Technical Leader          | Kitware Inc.
>>   *
>>
>> *| http://www.kitware.com/company/team/chaudhary.html
>> <http://www.kitware.com/company/team/chaudhary.html>*
>>
>>
>>
>>
>>
>> --
>>
>>
>>
>> *| Aashish Chaudhary | Technical Leader          | Kitware Inc.
>>   *
>>
>> *| http://www.kitware.com/company/team/chaudhary.html
>> <http://www.kitware.com/company/team/chaudhary.html>*
>>
>> Disclaimer: The information contained in this communication may be
>> confidential, is intended only for the use of the recipient(s) named above,
>> and may be legally privileged. If the reader of this message is not the
>> intended recipient, you are hereby notified that any dissemination,
>> distribution, or copying of this communication, or any of its contents, is
>> strictly prohibited. If you have received this communication in error,
>> please return it to the sender immediately and delete the original message
>> and any copy of it from your computer system. If you have any questions
>> concerning this message, please contact the sender.
>>
>>
>>
>>
>>
>> --
>>
>>
>>
>> *| Aashish Chaudhary | Technical Leader          | Kitware Inc.
>>   *
>>
>> *| http://www.kitware.com/company/team/chaudhary.html
>> <http://www.kitware.com/company/team/chaudhary.html>*
>> Disclaimer: The information contained in this communication may be
>> confidential, is intended only for the use of the recipient(s) named above,
>> and may be legally privileged. If the reader of this message is not the
>> intended recipient, you are hereby notified that any dissemination,
>> distribution, or copying of this communication, or any of its contents, is
>> strictly prohibited. If you have received this communication in error,
>> please return it to the sender immediately and delete the original message
>> and any copy of it from your computer system. If you have any questions
>> concerning this message, please contact the sender.
>>
>
>
>
> --
>
>
>
> *| Aashish Chaudhary | Technical Leader         | Kitware Inc.            *
> *| http://www.kitware.com/company/team/chaudhary.html
> <http://www.kitware.com/company/team/chaudhary.html>*
>



-- 



*| Aashish Chaudhary | Technical Leader         | Kitware Inc.            *
*| http://www.kitware.com/company/team/chaudhary.html
<http://www.kitware.com/company/team/chaudhary.html>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20151211/216aa26b/attachment.html>


More information about the vtkusers mailing list