octave contributor?

View: New views
6 Messages — Rating Filter:   Alert me  

octave contributor?

by thomas.l.scofield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I have a general interest in contributing code to octave-forge.  
While it is possible I will contribute code to more than one package  
(or perhaps not at all, as I have to get accustomed to distributed  
programming---svn, in particular), my primary focus will likely be on  
functions for the image package, at least initially.

Thomas L. Scofield
--------------------------------------------------------
Associate Professor
Department of Mathematics and Statistics
Calvin College
--------------------------------------------------------


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Octave-dev mailing list
Octave-dev@...
https://lists.sourceforge.net/lists/listinfo/octave-dev

Re: octave contributor?

by Søren Hauberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

tor, 19 06 2008 kl. 12:41 -0400, skrev Thomas L. Scofield:
> I have a general interest in contributing code to octave-forge.  
> While it is possible I will contribute code to more than one package  
> (or perhaps not at all, as I have to get accustomed to distributed  
> programming---svn, in particular), my primary focus will likely be on  
> functions for the image package, at least initially.

Sounds great. In general we prefer to see some code before we give
access to the SVN. This is just to keep the number of users with SVN
access down. So, just show us some code, and give us your source-forge
user name, and we'll give you SVN access.

As to learning SVN, then don't worry, it's quite easy. But if you have
problems just ask :-)

Søren


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Octave-dev mailing list
Octave-dev@...
https://lists.sourceforge.net/lists/listinfo/octave-dev

Parent Message unknown Re: octave contributor?

by Søren Hauberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
  Replies below...

tor, 19 06 2008 kl. 13:26 -0400, skrev Thomas L. Scofield:
> I do not currently have any code to contribute.  You and I first
> conversed several months ago when I was thinking about contributions
> to Octave itself, imread and imwrite functions, in particular.  My
> inquiries came a while before the free time needed to write anything,
> but as far as I can determine, these functions have not been added to
> core Octave as of yet and, if that is correct, that's what I'll focus
> on first.

'imread' and 'imwrite' have not yet been moved to core Octave, so if
you're up to the task, I think many people would be grateful. If this is
something you want to do, I think a good first step would be to ask on
the maintainers list about what work has been done so far (I think John
did some work that he didn't publish).

> I am quite interested in imaging in general, perhaps also in helping
> to develop a level set method package for Octave.

The general advice we give people is to do what ever interests you. So,
if you're into level set methods, then I'd welcome some to the image
package (this reminds me, I have a decent implementation of the
Chan-Vese segmentation algorithm lying around somewhere, that I really
should publish).

> So, if you want some code first before giving me SVN access, can you
> suggest some good starter function for the image package for me to
> write?  (I'm thinking something here that would be of some
> use---perhaps something that exists in Matlab's image processing
> toolbox, which I have---but that is not now in the image package.

I have a few functions on my wish list that are in the matlab image
processing toolbox:
  * radon (I think that's the name of the radon transform)
  * bwtraceborder (again, I think that's the name). I have some code for
this, so let me know if you want to work on it.
  * generalise 'bwdist' to handle ND data (this shouldn't be too hard)
  * implement some different distance measures for 'bwdist'
We probably miss more functions, but to be honest, I think the 'image'
package already is soo much better than the matlab one, so I tend to
introduce features not available in Matlab. Here are a few from my
current wish list:
  * It would be nice to have one (or more) function(s) for plotting
'standard' things on top of images. You know, functions for plotting
lines, points, circles, ellipses (perhaps with a special syntax for
visualising covariance matrices?).
  * An interest point detector. This function should be able to detect
Harris points, LoG/DoG extremas, etc.
  * Reimplement 'bwlabel' as the one we currently have, doesn't have any
license, and we really should have one that's GPL.
  * Extend 'im2bw' such that it includes several standard segmentation
algorithms.
  * Extend 'imsmooth' to support other algorithms (I would love to see
support for Joachim Weickert's anisotropic filters).

I have some code lying around that can get you started on any of these
subjects if they interest you. So let me know if you want to work on
some of this. But you should just do what ever you find interesting...

Søren



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Octave-dev mailing list
Octave-dev@...
https://lists.sourceforge.net/lists/listinfo/octave-dev

Parent Message unknown Re: octave contributor?

by Søren Hauberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

tor, 19 06 2008 kl. 16:59 -0400, skrev Thomas L. Scofield:
> OK.  Just to get my feet wet, I'm looking at bwdist.  You've
> implemented just the Euclidean method, and all of the work is really
> done by code in __bwdist.oct, right?
Yes.

> I'm thinking .oct files are produced somehow using mkoctfile (not sure
> if its done in a shell, or from within Octave).  At any rate, this
> being a binary file and your code, what is preferred here?  Make
> alterations within __bwdist (source file) (something I do not have),
> or create a separate branch in bwdist that, after verifying the chosen
> method is "e", checks the dimensions of the input matrix and continues
> to call __bwdist.oct if the matrix is 2D, but calls some other routine
> when ND with N > 2?
You would need to look at the source code of __bwdist, and change that.
You can just download the image package from sourceforge and uncompress
that, there you'll find the source code. The source can then be compiled
with the mkoctfile command from within Octave. Basically, what the code
does is that it implements the 1D Euclidian distance transform. This is
then computed along each dimension of the image. This is currently hard
coded to two dimensions. What I'd do is to change __bwdist to only work
on 1D data, and then I would change bwdist.m to call this function for
each dimension.

> Even if the latter is preferred, it might be nice to see how you
> implemented the 2D case.
Actually, I didn't do the implementation. This is an implementation by
the author of the used method. I've just ported it to Octave.

Søren



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Octave-dev mailing list
Octave-dev@...
https://lists.sourceforge.net/lists/listinfo/octave-dev

bwdist

by thomas.l.scofield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello Mr. Hauberg.

I've been thinking some about this alteration to bwdist to handle  
NDArrays.  I have hit on a couple of snags, and am hoping you can  
point me in the right direction.  You made the following suggestion:


On Jun 20, 2008, at 1:02 AM, Søren Hauberg wrote:

> You would need to look at the source code of __bwdist, and change  
> that.
> You can just download the image package from sourceforge and  
> uncompress
> that, there you'll find the source code. The source can then be  
> compiled
> with the mkoctfile command from within Octave. Basically, what the  
> code
> does is that it implements the 1D Euclidian distance transform.  
> This is
> then computed along each dimension of the image. This is currently  
> hard
> coded to two dimensions. What I'd do is to change __bwdist to only  
> work
> on 1D data, and then I would change bwdist.m to call this function for
> each dimension.
>

First off, the existing bwdist.m works for 1 and 2D arrays (since,  
apparently, an n-vector is seen by ndims as having 2 dimensions, so  
just like a matrix).  Thus, an extension is really only needed in  
cases of ND arrays with N > 2.

Supposing that I follow you advice for a binary N-by-N-by-N array im,  
and let us assume that I could make direct calls to the dt() function  
inside the file __bwdist.cc whose declaration looks like

   static float* dt (float *f, int n)

Then I would have Octave code (inside bwdist.m) something like

   im = 1 ./ im - 1;

   for ii = 1:N
     for jj = 1:N
       im(ii, jj, :) = dt (im(ii, jj, :), N);
     end
   end

   for ii = 1:N
     for kk = 1:N
       im(ii, :, kk) = dt (im(ii, :, kk), N);
     end
   end

   for jj = 1:N
     for kk = 1:N
       im(:, jj, kk) = dt (im(:, jj, kk), N);
     end
   end

This is, of course, the kind of thing Octave/Matlab programmers are  
encouraged NOT to do---handle repetitive things inside of FOR loops  
(instead of finding ways to achieve the same goal through some  
"vectorized" approach).  I suppose if FOR loops are the only way to  
carry this out, then those loops are best implemented inside  
__bwdist.cc where they will be compiled rather than executed by the  
Octave interpreter.  (More on that below.)  That aside, this code  
handles only the N-by-N-by-N case, so is not much of an extension of  
the existing bwdist.m at this point.  Is there a way to avoid  
embedding this code inside a SWITCH-CASE type construct like

   dims = ndims (im);
   switch
     case dims < 3:
       # handled like currently

     case dims == 3:
       # insert the above code

     case dims == 4:
       # redo the code above so that it contains 4 FOR loops, at each  
stage
       # fixing 3 of the four coordinates in im

     case dims == 5:
       # redo the code above so that it contains 5 FOR loops, at each  
stage
       # fixing 4 of the four coordinates in im

     etc.

As for implementing the FOR loops inside __bwdist.cc instead of  
bwdist.m, the likely place for these loops would be in the dt()  
function whose declaration is

   static void dt (NDArray &im)

I think I run into the same difficulty as above having to hardcode  
the various cases (although I know very little about the Octave API  
to C++, so perhaps there are methods that would streamline this).  
But here I may run into another difficulty.  I believe there is a  
dim3 method that matches dim1 and dim2 currently being used in this dt
() function.  But I see no indication that there is a dim4 method.  
What would make more sense is a method dim that accepts the dimension  
number as an argument.  Is there such a thing, so far as you know?

Thanks.


Thomas L. Scofield
--------------------------------------------------------
Associate Professor
Department of Mathematics and Statistics
Calvin College
--------------------------------------------------------


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Octave-dev mailing list
Octave-dev@...
https://lists.sourceforge.net/lists/listinfo/octave-dev

Re: bwdist

by Søren Hauberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
   It's great to see somebody pick up my work, and try to finish it. Thank you.
(answers below)

Quoting "Thomas L. Scofield" <scofield@...>:
> First off, the existing bwdist.m works for 1 and 2D arrays (since,  
> apparently, an n-vector is seen by ndims as having 2 dimensions, so  
> just like a matrix).  Thus, an extension is really only needed in  
> cases of ND arrays with N > 2.

Yes.

> Supposing that I follow you advice for a binary N-by-N-by-N array  
> im,  and let us assume that I could make direct calls to the dt()  
> function  inside the file __bwdist.cc whose declaration looks like
>
>   static float* dt (float *f, int n)
>
> Then I would have Octave code (inside bwdist.m) something like
>
>   im = 1 ./ im - 1;
>
>   for ii = 1:N
>     for jj = 1:N
>       im(ii, jj, :) = dt (im(ii, jj, :), N);
>     end
>   end
>
>   for ii = 1:N
>     for kk = 1:N
>       im(ii, :, kk) = dt (im(ii, :, kk), N);
>     end
>   end
>
>   for jj = 1:N
>     for kk = 1:N
>       im(:, jj, kk) = dt (im(:, jj, kk), N);
>     end
>   end

The problem with this approach is that then you'll only handle the 3D  
case. You'll need another implementation for the 4D case, the 5D case,  
etc. This way the amount of code will quickly grow, and the result  
will likely be a mess, and we would still only support a limited set  
of dimensions. In general, working with ND can be quite a pain, but  
it's quite nice to have support for the ND case.


[snip]

> I think I run into the same difficulty as above having to hardcode  
> the various cases (although I know very little about the Octave API  
> to C++, so perhaps there are methods that would streamline this).    
> But here I may run into another difficulty.  I believe there is a  
> dim3 method that matches dim1 and dim2 currently being used in this  
> dt () function.  But I see no indication that there is a dim4  
> method.   What would make more sense is a method dim that accepts  
> the dimension  number as an argument.  Is there such a thing, so far  
> as you know?

I think the function you want is called 'dims'. It returns a  
'dim_vector' which you can then index, i.e. something like this  
(untested code):

   const dim_vector my_dims = my_nd_array.dims ();
   for (int k = 0; k < mu_dims.length (); k++)
     printf ("my_dims [%d] = %d\n", k, my_dims (k));

The way I imagined ND support in 'bwdist' was to be implemented is  
something like this. Basically I would change the '__bwdist' function  
to only wrap the

   static float* dt (float *f, int n)

function. That is, I think '__bwdist' should only implement the 1D  
squared distance transform. You should then call '__bwidst' with a  
dimension argument that tells it along which dimension the distance  
transform should be computed. Then the 'bwdist' function should look  
something like this:

function D = bwdist (I)
   ## Compute squared distance transform
   for dim = 1:ndims (I)
     I = __bwdist (I, dim);
   endfor

   ## Convert to Euclidian distances
   D = sqrt (I);
endfunction

That way the number of interpreted for loops would be quite low. I  
think this approach can be implemented, but as I haven't actually done  
it, it might be harder then I think.

Anyway, thanks for looking into this,
Søren


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Octave-dev mailing list
Octave-dev@...
https://lists.sourceforge.net/lists/listinfo/octave-dev