contrast in stacks

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

contrast in stacks

Tony Shepherd
I have a greyscale stack, and the images should get darker from the first
slice to the last but they dont. It is as if the contrast is re-calculated
for each slice.

Can I set a 'global' contrast with a plugin command? It is not just the
display brightness, the actual pixel values seem to have been recalculated
by some LUT or calibration.

many thanks,

Tony
Reply | Threaded
Open this post in threaded view
|

Re: contrast in stacks

EHB2010
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