[vtkusers] converting vtkImageData to vtkUnstructuredGrid

David E DeMarle dave.demarle at kitware.com
Sat Apr 9 06:27:40 EDT 2011


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