Posted by
Seamus Holden on
Jul 29, 2013; 1:41pm
URL: http://imagej.273.s1.nabble.com/ImageStack-unexpected-behaviour-tp5004200.html
Hi there
I am trying to preallocate a stack and then write some data to it
(specifically images from a microscope in micromanager).
Every time I try to write images to the preallocated stack, the first
image is always blank. I have no idea why!
Specifically, the script below gives a blank first frame, all other
frames have a white diagonal as expected.
Can anyone see where I am going wrong?
Thanks in advance for your help.
Regards,
Seamus
[test script]
import ij.*;
import ij.gui.*;
int numImages=10;
int w = 16;
int h = 16;
ImagePlus acqIm = NewImage.createShortImage("test", w, h, numImages,
NewImage.FILL_BLACK);
ImageStack acqStack = acqIm.getStack();
int nn = 1;
for (int i = 0; i < numImages; i++) {
short[] pixels = new short[w * h]; // zero-filled
for (int j = 0; j < w && j < h; j++) { // set diagonal to nonzero
pixels[j + w * j] = (short)15000;
}
acqStack.setPixels(pixels, nn);
nn++;
}
acqIm.show();
[end of test script]
--
Dr Seamus Holden
Post-doctoral Fellow
Bâtiment des Sciences Physiques
École Polytechnique Fédérale de Lausanne
CH-1015 Lausanne, Switzerland
Phone: +41-(0)21-693-0557
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html