|
Hi Tony,
I can't pretend to understand how the contrast settings are automatically handled when a new ImageProcessor is added to a stack, but it had me very confused and I didn't like the variability.
So I bodged it..... When I create a stack I create a synthetic canvas which runs from white to black and added it first to the stack. Following this any further added ImageProcessors seem to have a normal and standard contrast range. Code (for a float processor):
//originalFloat is my source FloatProcessor- I use it to get dimensions
float[][] blankCanvas = new float[originalFloat.getWidth()][originalFloat.getHeight()];
for (int f = 0; f < width; ++f) {
for (int g = 0; g < height; ++g) {
blankCanvas[f][g] = (float) (255.0/((height*1.0)/(g+1)));
}
}
ImageStack blankstack = new ImageStack(originalFloat.getWidth(), originalFloat.getHeight());
FloatProcessor f1 = new FloatProcessor(blankCanvas);
blankstack.addSlice("white to black", f1);
BW
e
|