[vtkusers] Getting the scalar value from vtkCell
Dominik Szczerba
domi at vision.ee.ethz.ch
Mon Aug 13 11:16:43 EDT 2007
Hi Mark,
I am not sure what you are after. Why do you need to have cells with the
same scalar? I thought you just wanted to highlight a picked cell (or
cells). In any case, you can get the scalar value by
dataset->GetCellData()-> ... and getting you array by name for example.
But I dont see why you would want that. You can extract the selected
cell's edges and color their actor to your liking.
- Dominik
Mark Kobine wrote:
> Hi Dominik,
>
> Thanks for that - vtkExtractEdges looks like the way to go.
>
> What I think I need to do next is to get the set of cells that share the
> same scalar value (as allocated by vtkSTLReader with ScalarTagsOn())
> when the STL file was read in. I can get the cell the user clicked
> easily with vtkCellPicker but I haven't been able to find anything that
> will give me that cell's scalar value or the rest of the cells with the
> same scalar.
>
> Or am I approaching this the wrong way?
>
> Many thanks,
> Mark
>
> Dominik Szczerba wrote:
>> Hi Mark,
>> Please make cc's to the mailing list.
>> The easiest thing to set up (not necessarily the fastest to perform)
>> would be to extract the picked selection and use the vtkExtractEdges
>> filter on it. Then set linewidth to 2 or 3 and color to red in a
>> corresponding actor.
>> bye, Dominik
>>
>> Mark Kobine wrote:
>>> Hi Dominik,
>>>
>>> Many thanks for the advice.
>>>
>>> If I were to go about plotting the edges of the selected geometry, as
>>> you suggest, how would I go about this?
>>>
>>> Many thanks,
>>> Mark
>>>
>>> Dominik Szczerba wrote:
>>>> This has been frequently asked here. There is no way to change a cell
>>>> color other than to change its scalar value. This is not elegant as you
>>>> have to write to your original dataset, supposedly writing down the
>>>> overwritten value temporarily and taking care it is written back when
>>>> you un-pick. Then, you have to remember that the modified scalar has
>>>> still go through a color lookup table to be seen and having it always
>>>> e.g. red may not always be that trivial and robust.
>>>> I would recommend a different way without modifying the actual data,
>>>> like shrinking the element, plotting it edges, or annotating it's
>>>> nodes etc.
>>>> - Dominik
>>>>
>>>> Mark Kobine wrote:
>>>>> Hi,
>>>>>
>>>>> I have some geometry read in from an STL file that contains several
>>>>> "solid" sections. These sections are currently coloured automatically
>>>>> by vtk based on the scalar value assigned to each section as it is
>>>>> read in. I want to change the appearance of one of these sections if
>>>>> the user clicks on it in the renderer window.
>>>>>
>>>>> I'm using vtkCellPicker and from that I can get the selected vtkCell.
>>>>> From there is there a way to get the scalar value for that cell?
>>>>>
>>>>> My approach is to use that scalar to somehow change the appearance of
>>>>> all cells with the same scalar value.
>>>>>
>>>>> Can any one help? Is this a sensible approach?
>>>>>
>>>>> Many thanks,
>>>>> Mark
>>>>> _______________________________________________
>>>>> This is the private VTK discussion list. Please keep messages
>>>>> on-topic.
>>>>> Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>>> Follow this link to subscribe/unsubscribe:
>>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
--
Dominik Szczerba, Ph.D.
Computer Vision Lab CH-8092 Zurich
http://www.vision.ee.ethz.ch/~domi
More information about the vtkusers
mailing list