[vtkusers] Distinctive indexes on a vtkPolyData
Hila Hiler
hilahiler at gmail.com
Sat May 5 03:08:38 EDT 2012
Hi Wen,
Many thanks for your helpful ideas.
I've tried to manage with those ideas and got to the following algorithm
and code:
generaly, I'd like to divide my poly (actually, the outer skin of the head)
to regions such that each point in the surface will be in a region. after
that I'd like to select from each region the point with the lower value
(scalar).
The head is represented with vtkPolyData and vtkFloatArray such that
indexes is locations(address) in the head and scalars are values as
described below.
the technique to do that is to divide my poly by vtkOctree to X regions:
vtkSmartPointer<vtkOctreePointLocator> octree =
vtkSmartPointer<vtkOctreePointLocator>::New();
octree->SetDataSet(polyHead);
octree->SetMaximumPointsPerRegion(polyHead->GetNumberOfPoints()/divisionFactor);//divisionFactor
is the number of regions that I'd like to divide my head
octree->BuildLocator();
go to each region and find the point with the lowest value by vtkFloatArray
for(int i=1; i<divisionFactor; i++)//division factor is number of
regions of the head
{
vtkIdTypeArray* points = octree->GetPointsInRegion(i);
minValInRegion=1000000;
//get address that represents location on the head, go to that
index in the array and get its value
for(vtkIdType idx=1; idx< points->GetSize(); idx++)
{
curIdxInRegion = points->GetValue(idx);
curValInRegion = headArray->GetValue(curIdxInRegion);
if(curValInRegion < minValInRegion)
{
minValInRegion = curValInRegion;
minIdxInRegion = curIdxInRegion;
}
}
}
With this code, I don't get distinct indexes which are far away from each
other.
I want to get indexes in each region ...
How do I get that ?
Thanks in advance.
Hila
On Wed, May 2, 2012 at 12:07 AM, Li, Wen <wen-li at uiowa.edu> wrote:
> Hi Hila,
>
> I understand better about your problem now.
>
> You want to group your vertices on a surface according to some distance?
> Can you search of a seed vertex(point) with extreme coordinates along one
> axis (x, or y, or z).
> And then use the Euclidean distance to classify vertices?
>
> Maybe the problem you are facing is more complicated than this.
>
> Hope it helps though,
> Wen
>
> On May 1, 2012, at 7:49 AM, Hila Hiler wrote:
>
>
> Hi Wen,
> many thanks for your answer.
>
> I've read about kDTree and wondered if the OcTree is better (I have a 3D
> image).
> please detail (if you know) why KdTree is better than OcTree or the
> opposite ...
>
> regarding my first q:
> -------------------------
> my data structure:
> vtkPolyData <=> vtkFloatArray <=> Scalars
>
> I'm searching for a method that divides the poly to regions (how do I
> insert the number of the required regions) and returns the indexes
> (vtkIdType) + its corresponding scalar (float) in each region.
>
> How I can get this?
>
> Best and thanks in advance.
> Hila
>
>
>
> On Sun, Apr 29, 2012 at 10:32 PM, Li, Wen <wen-li at uiowa.edu> wrote:
>
>> Hila,
>>
>> Is vtkKdTreePointLocator::FindPointsWithinRadius going to help you?
>>
>> You can exclude points within a specific radius and the rest points on
>> the surface are beyond that value.
>>
>> You are right about the point ids. neighboring points could have very
>> different point Ids.
>>
>> Good Luck,
>> Wen
>>
>> On Apr 29, 2012, at 2:21 PM, Hila Hiler wrote:
>>
>> Hi All,
>>
>> I'd like to get some *distant points* on a surface (in this case, a
>> head).
>> How do I know what the distance value should be?
>>
>> Actually, in my program I use this type: vtkIdType and with a loop move
>> on a vtkPolyData.
>> I tried to guess a number (5000), presented the points on the surface but
>> realized that even that those points look very close, their indexes are
>> faraway from each other- so I guess that I don't have a clue about it :-)
>>
>>
>> so, any idea how I should find indexes/points which are faraway from each
>> other on a surface ?
>>
>>
>> Thanks in advance.
>>
>> Hila
>> _______________________________________________
>> 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/20120505/57bc8039/attachment.htm>
More information about the vtkusers
mailing list