Login  Register

Re: NeuronJ + Straighten Plugin

Posted by S.I. Rusu on Jan 10, 2007; 9:38am
URL: http://imagej.273.s1.nabble.com/NeuronJ-Straighten-Plugin-tp3700634p3700635.html

  here is a macro that creates a polyline selection from a excel file
containing the coordinates of a trace from Neuronj:

  macro "NjTraces"{
        dir=getDirectory("image");
        ntraces=getFileList(dir+"\\traces");
        j=ntraces.length;

        for (k=1;k<j;k++){
                r=File.openAsString(dir+"traces\\trace.N"+k+".xls");
                s=split(r, "\n");
                l=lengthOf(s);
                startx=newArray(l);
                starty=newArray(l);

                for (i=0; i<l;i++){
                        coord=split(s[i], "\t");
                        startx[i]=coord[0];
                        }

                for (i=0; i<l;i++){
                        coord=split(s[i], "\t");
                        starty[i]=coord[1];
                        }

        makeSelection("polyline", startx, starty);
        roiManager("Add");
                }
        }

  you'll have to export the traces as "tab-delimited text files: separate
file for each tracing" and save it as an excel file. also the traces
must be saved (rename to "trace") in a new folder (called "traces") in
the directory containing the image. it can still be improved....
hope it helps.

silviu


>
> My idea is to first create a segmented/curved linear ROI from the file,
> and then laungh the Straighten Plugin. Do anybody know how I can get a
> ROI to be build from a text file containing coordinates ?
>


--
Silviu Rusu,
Erasmus MC Rotterdam
Ee 1230
Tel: +31 10 46 38094
Fax: +31 10 40 89459
Dr. Molewaterplein 50
NL-3015 GE Rotterdam
email: [hidden email]
web: http://www2.eur.nl/fgg/neuro/