Extending plugin from 2D to 3D

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

Extending plugin from 2D to 3D

aelalaily
Hello,

I have a plugin code that executes certain instructions on medical images. However the purpose of my application is to extend that to a 3D model of constructed stacks.

I use run(ImageProcessor ip) to get the current image and from there I use class methods to manipulate it. What do I do to use an imported image sequence?

I do not think it should be hard, but so far my internet search has not been very fruitful. Any help would be appreciated here.

Cheers!
Reply | Threaded
Open this post in threaded view
|

Re: Extending plugin from 2D to 3D

John Dunsmuir
It isn't clear to me what you are trying to do. The complexity of extending 2D plugins to 3D depends on the nature of the operation.  Without knowing, its hard to say.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Extending plugin from 2D to 3D

aelalaily
I'm trying to access pixels of each frame, get their value, and then depending on the value collected set certain pixels to values other than they were originally assigned. My problem right now, is how to import a sequence of images in code, and from there accessing individual images by their stack index number for instance.
Reply | Threaded
Open this post in threaded view
|

Re: Extending plugin from 2D to 3D

John Dunsmuir
In reply to this post by aelalaily
Ok, The code below accesses the pixels in a stack and if they are >0 sets them to a new value.  This should help get you started.

Regards

import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.filter.*;

public class StackAccess_Plugin implements PlugInFilter
{
        ImagePlus imp;

        public int setup(String arg, ImagePlus imp)
        {
                this.imp = imp;
                return DOES_ALL+STACK_REQUIRED;
        }

        public void run(ImageProcessor ip)
        {
  ImageStack stack;
                int width,height,depth;
                int i,j,k;

                stack = imp.getStack();
                width = stack.getWidth();
  height = stack.getHeight();
  depth = stack.getSize();

                for(k=0;k<depth;k++)
                {
                        for(j=0;j<height;j++)
                        {
                                for(i=0;i<width;i++)
                                {
                                        if(stack.getVoxel(i,j,k)>0) stack.setVoxel(i,j,k,i+j+k);
                                }
                        }
                }
        }
}

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Extending plugin from 2D to 3D

aelalaily
This is all the code I needed to know. Thank you! Much obliged kind sir!