http://imagej.273.s1.nabble.com/Get-name-of-stack-or-how-to-choose-an-inactive-window-tp3688896p3688901.html
suggestions.
> Hello Kristian
> Could this be to any help?
>
> ----fragment of a plugin
>
> public int setup(String arg, ImagePlus imp) {
> if (imp != null && !showDialog()) {
> return DONE;
> }
> rt.reset();
> sliceNumber = 0;
> numChan = imp.getImageStack().getSize();
> sliceName = imp.getImageStack().getSliceLabels();
> // prepare direct save of results
> tw.append("slice asm contrast correlation idm Entropy suma");
> cycleNo++;
> return DOES_8G + DOES_STACKS + SUPPORTS_MASKING;
> }
>
> public void run(ImageProcessor ip) {
>
> byte[] pixels = (byte[]) ip.getPixels();
> int width = ip.getWidth();
> Rectangle r = ip.getRoi();
> int a; // actual pixel in scope
> int b; // neighbour pixel
>
> // compute the glcm matrix
> double[][] glcm = new double[256][256];
>
>
> glcm = doGLCM(selectedDirection, step, ip);
>
> // Make a stack of GLCM images
> float[][] glcmf = new float[256][256];
> for (a = 0; a < 256; a++) {
> for (b = 0; b < 256; b++) {
> glcmf[a][b] = (float) glcm[a][b];
> }
> }
> FloatProcessor fp = new FloatProcessor(glcmf);
>
>
> ImagePlus glcmImage = new ImagePlus("glcm", fp);
>
>
> glcmStack.addSlice(selectedDirection, fp);
> sliceNumber++;
> glcmStack.setSliceLabel(sliceName[sliceNumber - 1], sliceNumber); //
> Different start!
>
>
> if (glcmStack.getSize() == numChan) {
> new ImagePlus("Stack" + cycleNo, glcmStack).show();
> }
>
>
> Regards
> Knut
>
>
> On 19.03.10 12.40, "KJ" <
[hidden email]> wrote:
>
> Hi everybody
>
> Im working with a macro which basically takes a stack and converting it
> into
> images - no problems until now.
>
> However my problem is when I'm trying to get the first image in the stack
> (ie. not the active image).
>
> The stack is divided into images with "name of stack"-0001 and so on.
>
> I've figured that I most likely could use the command:
>
> selectWindow('-0001');
>
> But how do I get the "name of the stack" or how do I choose the first
> window
> (the "name of the stack"-0001)
>
> Sincerely
> Kristian
>
>
> _____________________________
> Knut Kvaal, Associate Professor
> Department of Mathematical Sciences and Technology
> P.O.Box 5003
> Norwegian University of Life Sciences (UMB) N - 1432 Ås NORWAY
>
> Tel: +47 64965394 (Norway)
> Cell: +47 90920332 (Norway)
>
> Personal Homepage:
http://knut.kvaal.net <
http://knut.kvaal.net/>
>
BSc.
v. Roskilde Universitetscenter