Path: news.mathworks.com!not-for-mail
From: "Matt Fetterman" <mattinjersey@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Doubly Linked Lists of objects
Date: Sat, 7 Nov 2009 20:56:01 +0000 (UTC)
Organization: Penn State University Electro Optics Center
Lines: 52
Message-ID: <hd4mt1$t1f$1@fred.mathworks.com>
References: <hd4e7h$ak2$1@fred.mathworks.com>
Reply-To: "Matt Fetterman" <mattinjersey@yahoo.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1257627361 29743 172.30.248.38 (7 Nov 2009 20:56:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 7 Nov 2009 20:56:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 495229
Xref: news.mathworks.com comp.soft-sys.matlab:583263


"rebecca donnelly" <rdonnelly10@qub.ac.uk> wrote in message <hd4e7h$ak2$1@fred.mathworks.com>...
> Hi,
> I am a first year PhD student and am implementing the image processing algorithm "Seeded Region Growing" as an exercise to help me get to grips with Matlab and to gain a deeper understanding of the algorithm.
> 
> The paper asks for a datastructure they call a "Sequentially Sorted List", it needs to hold an object which contains the x and y coordinates of a pixel and another value called Sigma which the list is sorted by.
> 
> I attempted to do this using the following code:
> 
>  % Calculate sigma and create a new pxladrs object 
>         sigma_value = abs(seg_img(x+1, y) - mean_gl);
>         p = pxladrs(sigma_value);
>         % Add x and y coords to pxladrs object
>         p.Xvalue = x+1;
>         p.Yvalue = y;
>         % Add object to SSL
>         if counter==0
>             ssl_start = dlnode(p);
>         else
>             cur = ssl_start;
>             % Insert ordered by sigma value
>             while cur ~= 0
>                 if p.Sigma < cur.Data.Sigma 
>                     ssl_insert = dlnode(p);
>                     ssl_insert.insertBefore(cur);
>                     break
>                 end
>          end
>                 cur = cur.Next;
> 
> However this didn't work as I couldn't store the pxladrs object in the doubly linked list. 
> 
> Error:
> ??? Undefined function or method 'dlnode' for input arguments of
> type 'pxladrs'.
> Error in ==> SeededRegionGrowing at 58
>             ssl_start = dlnode(p);
> 
> So my question is; How do I modify the doubly linked list so it can handle objects? Or am I going about this totally the wrong way?
> 
> Any comments appriciated,
> Rebecca

I think you have to define the dlnode object as described in the documentation, it is not a built-in Matlab object.

classdef dlnode < handle
   properties
      Data
   end 
   properties (SetAccess = private)
      Next
      Prev
   end