[vtkusers] converting vtkImageData to vtkUnstructuredGrid

Liam Kurmos quantum.leaf at gmail.com
Sun Apr 10 11:21:57 EDT 2011


Does vtk provide a way to turn quads into tetras?

Liam


On Sat, Apr 9, 2011 at 11:52 AM, Liam Kurmos <quantum.leaf at gmail.com> wrote:
> Thanks David!
>
> On Sat, Apr 9, 2011 at 11:27 AM, David E DeMarle
> <dave.demarle at kitware.com> wrote:
>> It produces voxel cells not tetrahedral cells, so the mapping is one to one.
>>
>> David E DeMarle
>> Kitware, Inc.
>> R&D Engineer
>> 28 Corporate Drive
>> Clifton Park, NY 12065-8662
>> Phone: 518-371-3971 x109
>>
>>
>>
>> On Sat, Apr 9, 2011 at 3:59 AM, Liam Kurmos <quantum.leaf at gmail.com> wrote:
>>> I've attempted to convert imagedata to unstructured data as you
>>> suggested some time back using vtkthreshold.
>>> In the code below vtkVol is a vtkImageData with scalar point data.
>>> However when i query the number of cells in the output unstructured
>>> grid i get the same as in the structured data. I would image there
>>> should be twice as many unstructured tetrahedra as cells in the
>>> structured data, can you comment on this?
>>>
>>> Liam
>>>
>>>
>>>    vtkSmartPointer<vtkThreshold>
>>> threshold=vtkSmartPointer<vtkThreshold>::New();
>>>    threshold->SetInput(vtkVol);
>>>    threshold->ThresholdByUpper(0);//scalars are all postive so threshold all
>>>    vtkSmartPointer<vtkUnstructuredGrid> volumeMesh=threshold->GetOutput();
>>>    threshold->Update();
>>>    cout<<" vtkug num cells "<<volumeMesh->GetNumberOfCells()<<endl;
>>>    cout<<" imagedata num cells "<<vtkVol->GetNumberOfCells()<<endl;
>>>
>>>
>>>
>>> On Wed, Feb 9, 2011 at 3:34 PM, David E DeMarle
>>> <dave.demarle at kitware.com> wrote:
>>>> Threshold and many other subsetting filters produce arbitrary sets of
>>>> cells, thus by definition they can not produce structured data.
>>>>
>>>> David E DeMarle
>>>> Kitware, Inc.
>>>> R&D Engineer
>>>> 28 Corporate Drive
>>>> Clifton Park, NY 12065-8662
>>>> Phone: 518-371-3971 x109
>>>>
>>>>
>>>>
>>>> On Wed, Feb 9, 2011 at 10:05 AM, Liam Kurmos <quantum.leaf at gmail.com> wrote:
>>>>> Hi David,
>>>>>
>>>>> Thanks for replying.
>>>>>
>>>>>> One way is to apply the threshold filter and set the threshold so that
>>>>>> it includes the entire scalar range.
>>>>>
>>>>> is it a side affect of the threshold filter that it will also produce
>>>>> an unstructured grid from a structured one?
>>>>>
>>>>> cheers,
>>>>>
>>>>> Liam
>>>>>
>>>>
>>>
>>
>



More information about the vtkusers mailing list