[vtkusers] Transparency

Darshan Pai darshanpai at gmail.com
Tue Feb 23 14:34:44 EST 2010


I think you cannot use Piecewise function for opacity when showing polydata
. There is no function like that .

On Tue, Feb 23, 2010 at 1:19 PM, Gomez, Alberto <alberto.gomez at kcl.ac.uk>wrote:

> The vtkPiecewiseFunction class defines a function (that used for color
> transfer function, or opacity transfer function for instance). Add segment
> adds a line to that function. For example,
>
>
> volumeScalarOpacity->AddSegment(-10,0.5,10,0.5);
>
>
>
> creates a straight line in the function from x=-10 to x=+10. In this case
> the line is horizontal (constant ) and the value is 0.5. This means that if
> your image has in one pixel a value of 2, as 2€[-10,10] it will be assigned
> an opacity of 0.5. If you remove a point, that point is mapped to 0.
>
> I am not sure how but I believe that you can do the same thing if you have
> a polydata... Maybe someone else is more helpful in that case.
>
>
>
> Banks, Robert wrote:
>
>> Will this work with vtkPolyData?
>>
>> Looking at the class, I'm not sure what the AddSegment() routine is doing.
>> Can you elaborate?
>>
>> Thanks
>> Robbie
>>
>> Robbie Banks
>>
>> -----Original Message-----
>> From: Gomez, Alberto [mailto:alberto.gomez at kcl.ac.uk] Sent: Tuesday,
>> February 23, 2010 9:49 AM
>> To: Banks, Robert
>> Cc: 'vtkusers at vtk.org'
>> Subject: Re: [vtkusers] Transparency
>>
>> Hi,
>>
>> You can set a point of your opacity transfer function (i.e. one scalar
>> value) to transparent without changing the rest. For example, if you are
>> using vtkPiecewiseFunction, then you set it up as you like and you remove
>> the 0 value with the method RemovePoint(0):
>>
>> vtkSmartPointer<vtkPiecewiseFunction> volumeScalarOpacity =
>> vtkSmartPointer<vtkPiecewiseFunction>::New();
>>
>> volumeScalarOpacity->AddSegment(-10,0.5,10,0.5);
>> volumeScalarOpacity->RemovePoint(0);
>>
>>
>>
>> Banks, Robert wrote:
>>
>>
>>> Hi all.
>>>
>>> Two questions, although the answer for one, may be the same for the
>>> other.
>>>
>>> I have a dataset that is the cross sectional displacement of a model.
>>> However, that model is in void, so there is no displacement in the void.
>>> When I plot the info, I get a large band of color around the data relating
>>> to the 0 value of the displacement in void. Is it possible to hide or make
>>> this data transparent? Or should I window the data?
>>>
>>> I'm thinking, I could set this color value to transparent, but am not
>>> sure how this would affect the rest of the data, having a transparent color
>>> data value in the middle of the plotting range.
>>>
>>> The second question is on a similar vein. Using the same example, if I
>>> have a model of, say 5 different materials, which I have defined each
>>> material as a different color. Can I just set that color value to fully
>>> transparent to hide it in the rendered picture?
>>>
>>> Or is there a better way to achieve the described problems?
>>>
>>> Thanks
>>> Robbie
>>>
>>>
>>> Robbie Banks
>>>
>>>
>>>
>>> ---------------------------------------------------------------------------------------------------
>>> Weidlinger Associates, Inc. made the following annotations.
>>>
>>> "This message and any attachments are solely for the intended recipient
>>> and may contain confidential or privileged information. If you are not the
>>> intended recipient, any disclosure, copying, use, or distribution of the
>>> information included in this message and any attachments is prohibited. If
>>> you have received this communication in error, please notify us by reply
>>> e-mail and immediately and permanently delete this message and any
>>> attachments. Thank you."
>>>
>>> "Please consider our environment before printing this email."
>>>
>>>
>>>
>>
>>
>>
>>
>
>
> --
>
> Alberto Gómez
>
> /Division of Imaging Sciences
> The Rayne Institute
> 4th Floor, Lambeth Wing
> St Thomas' Hospital
> London SE1 7EH /
>
> phone: +44 (0) 20 718 88364
> email: alberto.gomez at kcl.ac.uk <mailto:alberto.gomez at kcl.ac.uk>
>
> _______________________________________________
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100223/92a90808/attachment.htm>


More information about the vtkusers mailing list