Operating on lines in an image slice

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

Operating on lines in an image slice

Ethan Cohen
I am working with a stack of images.
For each slice from the stack,

1. I want to scrool through each line of the slice from top to bottom and:
2. Box select a horizontal line segment of (pixel thickness 1) of the image.

3. Shift it horizontally by an arbitrary amount (from another array variable) and paste it back in place.  


So I can:
selectWindow();
//setTool("rectangle");
makeRectangle(0, 265, 400, 1);
run("Copy");

But then how do I copy it back into the same line, say shifted 10 pixels horizontally?

run("Paste", 10, 265, 400, 1);?

Subarray.

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

Re: Operating on lines in an image slice

Glen MacDonald-2
Ethan,

Try this
for(i=1;i<nSlices();i++){
        getSelectionBounds(x, y, width, height);
        deltax=10;(some calculated thingy)
        newx=x+deltax;
        setSlice(i);
setSelectionLocation(newx, y);
run("Draw","slice");
//or makeRectangle(newx,y, width, height)
}


Glen
Glen MacDonald
Cellular Morphology Core
Center for Human Development and Disability
Box 357920
University of Washington
Seattle, WA 98195-7920  USA
(206) 616-4156
[hidden email]


On Oct 24, 2012, at 12:52 PM, Ethan Cohen wrote:

> I am working with a stack of images.
> For each slice from the stack,
>
> 1. I want to scrool through each line of the slice from top to bottom and:
> 2. Box select a horizontal line segment of (pixel thickness 1) of the image.
>
> 3. Shift it horizontally by an arbitrary amount (from another array variable) and paste it back in place.  
>
>
> So I can:
> selectWindow();
> //setTool("rectangle");
> makeRectangle(0, 265, 400, 1);
> run("Copy");
>
> But then how do I copy it back into the same line, say shifted 10 pixels horizontally?
>
> run("Paste", 10, 265, 400, 1);?
>
> Subarray.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html