Displaying 32-bit stack
Posted by Piotr Wendykier on
URL: http://imagej.273.s1.nabble.com/Displaying-32-bit-stack-tp3693285.html
Hello,
Is there a way to display a 32-bit stack so that each slice uses its
own min and max values for color balance?
Here is my code for creating and displaying the stack:
ImageStack stack = new ImageStack(columns, rows);
for (int s = 0; s < slices; s++) {
FloatProcessor ip = new FloatProcessor(columns, rows);
assignPixelsToProcessor(ip, X.viewPart(s * sliceStride, sliceStride));
ip.resetMinAndMax();
stack.addSlice(null, ip, s);
}
ImagePlus imp = new ImagePlus("", stack);
imp.show();
I know that ImageStack.addSlice() method always takes the min and max
values from the first slice:
public void addSlice(String sliceLabel, ImageProcessor ip) {
if (ip.getWidth()!=width || ip.getHeight()!=height)
throw new IllegalArgumentException("Dimensions do not match");
if (nSlices==0) {
cm = ip.getColorModel();
min = ip.getMin();
max = ip.getMax();
}
addSlice(sliceLabel, ip.getPixels());
}
Piotr Wendykier