[Insight-users] stl::priority_queue

Lydia Ng lng@insightful.com
Wed, 16 Apr 2003 10:27:00 -0700


Hi Zein,

The fast marching algorithm uses std::priority_queue inside which you =
might be able to use as example.

Have a look at the declaration of LevelSetNode in Common/itkLevelSet.h =
to see how to declare the required operators.

Then look in FastMarchingImageFilter.h to look at the declaration of =
HeapType to see how to define a min-heap.

Hope this helps,
Lydia

> -----Original Message-----
> From: salah [mailto:salah@gris.uni-tuebingen.de]
> Sent: Wednesday, April 16, 2003 10:12 AM
> To: ITK Users
> Subject: [Insight-users] stl::priority_queue
>=20
> Hi all,
>=20
> I am new to the use of stl containers. I want to define and use a =
priority
> queue whose element are of type QueuePixelNode,
> where QueuePixelNode is defined as
>=20
>  typedef struct {
>      IndexType  v_Index;  //    usual itk-image index type
>      float  v_Weight;
>   } QueuePixelNode;
>=20
> I want the elements to be sorted according to their v_Weight value.
> can anybody provide me with the minimal feasible code to define such
> a priority queue.
>=20
> I have written something like
>=20
>   std::priority_queue<QueuePixelNode,
> 	                  std::vector<QueuePixelNode>,
>                               ????????                       >
> my_Queue;
>=20
> I could really not know how to deal with the comparison function ?! ?! =
?!
>=20
> Can anybody please help ??
>=20
> Thanks,
> Zein
>=20
>=20
> =
->8<------------->8<------------->8<------------->8<------------->8<-----=
-
> ------->8<-
> Zein I. Salah
> University of T=FCbingen, WSI-GRIS, Sand 14, 72076 T=FCbingen
> Email: salah@gris.uni-tuebingen.de
> Tel.: (07071) 29 75465 (GRIS),           Fax: (07071) 29 54 66
>=20
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users