|
Hi all,
I've written a plugin for setting the opacity. This works well for single
images, but don´t work for stacks. I think the pixel values will be changed
in the right way, but there is no update. Can somebody help?
My plugin implements PlugInFilter. Further more there is a additional frame
that contains a slider to change opacity individually. Here´s the code for
applying the changes to the entire stack.
...
ImageStack imgStack = imagePlus.getStack();
int pixelVal = 0;
int[] pixelData = new int[width*height];
...
for (int i = 1; i < slices; i++) { // handle all slices
// getting pixel data of current slice
pixelData = (int[]) imgStack.getPixels(i);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
// get pixel value
pixVal = pixelData[x + y * width];
// changing pixel values
...
}
}
// write back
pixelData[i] = pixVal;
imgStack.setPixels(pixelData, i);
}
THX in advance.
--
regards
heiko
|