Re: Stack.setChannel works inconsistently?

Posted by TimFeinstein on
URL: http://imagej.273.s1.nabble.com/Stack-setChannel-works-inconsistently-tp5017161p5017176.html

After more troubleshooting I discovered that Stack.selectChannel() works
fine, but selecting a ROI from the ROI manager interferes with it.  In the
following two examples, Stack.setChannel() works in example #1 but does
not work in #2.  

#1:

for (i = 0; i < roiManager("count"); i++){
 roiManager("select", i);
 getSelectionCoordinates(x, y);
 //***
 selectWindow(name);
 Stack.setChannel(ciliaChannel);
 //***
 makeRectangle(x[i]-50, y[i]-50, 100, 100);
 run("Duplicate...", name);
 //etc


}

#2:

for (i = 0; i < roiManager("count"); i++){
 //***

 selectWindow(name);
 Stack.setChannel(ciliaChannel);
 //***
 roiManager("select", i);

 getSelectionCoordinates(x, y);
 makeRectangle(x[i]-50, y[i]-50, 100, 100);
 run("Duplicate...", name)

 //etc

}


After cleaning up some problems with my looping design, the macro works
quite well.  

All the best,


Tim  

Timothy Feinstein, Ph.D.
Research Scientist
University of Pittsburgh Department of Developmental Biology





On 9/8/16, 9:24 AM, "ImageJ Interest Group on behalf of Feinstein, Timothy
N" <[hidden email] on behalf of [hidden email]> wrote:

>Hi folks,
>
>Here is a large macro that I am working on which is a bit of a stretch
>for my skills, but it seems to be pretty close.  I am specifically
>pinging the board about the Stack.SetChannel() command, which only seems
>to work once.  The first time I use Stack.setChannel() it correctly
>selects stain#2 ("GPR161Channel") for thresholding.  However the next
>time when I want it to duplicate stain#1 ("ciliaChannel") for analysis in
>a smaller window it just copies stain#2 again.  This is line 59 in the
>macro.  I don't see why Stack.setChannel() should work the first time and
>not the second.
>
>I am also working out how to correctly call up point ROIs from the ROI
>manager one at a time for making rectangles (lines 62 and 68) but that
>looks more like I need to keep learning the syntax of working with
>arrays.  The select channels problem feels like it might be a bug.
>
>Here is a link to the macro and an example image:
>
>https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fwww.dropb
>ox.com%2fsh%2fgh0zkznpsrkalfi%2fAAAL_gqTXoKCTbjGegpN2AjNa%3fdl%3d0&data=01
>%7c01%7ctnf8%40pitt.edu%7c85eb85cf32ec4e37d6b808d3d7ed5bf3%7c9ef9f489e0a04
>eeb87cc3a526112fd0d%7c1&sdata=ymZS7qfHMLy05SMyJVooN9GbE%2bN7fRNojiHPoHV2nL
>g%3d
>
>Thanks!
>
>
>Tim
>
>Timothy Feinstein, Ph.D.
>Research Scientist
>University of Pittsburgh Department of Developmental Biology
>
>
>--
>ImageJ mailing list:
>https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fimagej.nih
>.gov%2fij%2flist.html&data=01%7c01%7ctnf8%40pitt.edu%7c85eb85cf32ec4e37d6b
>808d3d7ed5bf3%7c9ef9f489e0a04eeb87cc3a526112fd0d%7c1&sdata=nPcOCDYn37bLCCD
>uXw3brhFUi6kU2rqXXYFgs0Y6ak0%3d

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