How to create a 3d image

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to create a 3d image

Melissa Goh
I am working on a plugin to create image slices to form a image stack based
on a set of data points (x and y). Any tips? :)
Reply | Threaded
Open this post in threaded view
|

Re: How to create a 3d image

Yaseen Ladak
On a similar lines..I am keen too I have data with X, Y and Z (stacks). Is
it possible to have 3 D projection  from x, y, z?

Best,
Yaseen

On 7 March 2012 17:54, Melissa Goh <[hidden email]> wrote:

> I am working on a plugin to create image slices to form a image stack based
> on a set of data points (x and y). Any tips? :)
>
Reply | Threaded
Open this post in threaded view
|

Re: How to create a 3d image

Melissa Goh
In reply to this post by Melissa Goh
Hi Wayne,

Yes the data points (x,y,z) are stored in a text file. The z will be the
slice number and the x and y will be used to draw pixel for each slice.

Best regards,
Melissa

On Thu, Mar 8, 2012 at 2:21 AM, Rasband, Wayne (NIH/NIMH) [E] <
[hidden email]> wrote:

> Hi Melissa,
>
> On Mar 7, 2012, at 12:54 PM, Melissa Goh wrote:
>
> > I am working on a plugin to create image slices to form a image stack
> based
> > on a set of data points (x and y). Any tips? :)
>
> I should be able to write a macro that does this, but I need a little more
> information. Why do you need a stack if all you have are (x,y) data points?
> Are the data points in a text file?
>
> Best regards,
>
> -wayne
>
>
Reply | Threaded
Open this post in threaded view
|

Re: How to create a 3d image

Thomas Boudier
Hi,

You can also have a look to 3d tools on the wiki :

http://imagejdocu.tudor.lu/doku.php?id=plugin:stacks:3d_tools:start

Thomas


Le 07/03/2012 19:30, Melissa Goh a écrit :

> Hi Wayne,
>
> Yes the data points (x,y,z) are stored in a text file. The z will be the
> slice number and the x and y will be used to draw pixel for each slice.
>
> Best regards,
> Melissa
>
> On Thu, Mar 8, 2012 at 2:21 AM, Rasband, Wayne (NIH/NIMH) [E]<
> [hidden email]>  wrote:
>
>> Hi Melissa,
>>
>> On Mar 7, 2012, at 12:54 PM, Melissa Goh wrote:
>>
>>> I am working on a plugin to create image slices to form a image stack
>> based
>>> on a set of data points (x and y). Any tips? :)
>> I should be able to write a macro that does this, but I need a little more
>> information. Why do you need a stack if all you have are (x,y) data points?
>> Are the data points in a text file?
>>
>> Best regards,
>>
>> -wayne
>>
>>
>

--
  /**********************************************************/
     Thomas Boudier, MCU Université Pierre et Marie Curie,
     Modélisation Cellulaire et Imagerie Biologique (EE1),
     IFR 83, Bat B 7ème étage, porte 723, Campus Jussieu.
     Tel : 01 44 27 46 92   Fax : 01 44 27 22 91
/*******************************************************/
Reply | Threaded
Open this post in threaded view
|

Re: How to create a 3d image

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by Melissa Goh
On Mar 7, 2012, at 12:54 PM, Melissa Goh wrote:

> I am working on a plugin to create image slices to form a image stack based
> on a set of data points (x and y). Any tips? :)

Here is a plugin that plots a list of x,y,z values in a text file on a 512x512x512 stack.

-wayne


import ij.*;
import ij.plugin.*;
import ij.measure.ResultsTable;
import ij.util.Tools;

public class Plot_XYZ implements PlugIn {

    public void run(String arg) {
        int size = 512;  // stack size
        ImagePlus imp = IJ.createImage("Untitled", "8-bit black", size, size, size);
        IJ.run("Results... ");  // file>import>results
        ResultsTable rt = ResultsTable.getResultsTable();
        if (rt==null) return;
        double[] x = rt.getColumnAsDoubles(0);
        double[] y = rt.getColumnAsDoubles(1);
        double[] z = rt.getColumnAsDoubles(2);
        double[] mm = Tools.getMinMax(x);
        double xmin=mm[0], xmax=mm[1];
        mm = Tools.getMinMax(y);
        double ymin=mm[0], ymax=mm[1];
        mm = Tools.getMinMax(z);
        double zmin=mm[0], zmax=mm[1];
        ImageStack stack = imp.getStack();
        int xc, yc, zc;
        for (int i=0; i<x.length; i++) {
            xc = (int)((x[i]-xmin)*size/(xmax-xmin)+0.5);
            yc = (int)((y[i]-ymin)*size/(ymax-ymin)+0.5);
            zc = (int)((z[i]-zmin)*size/(zmax-zmin)+0.5);
            stack.setVoxel(xc, yc, zc, 255);
        }
        imp.show();
    }

}