Displaying 32-bit stack

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

Displaying 32-bit stack

Piotr Wendykier
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
Reply | Threaded
Open this post in threaded view
|

Re: Displaying 32-bit stack

Wayne Rasband
An n-image stack normally has  a single LUT but convert it to an
n-channel composite image and there will be a LUT for each image. There
is an example at

     http://rsb.info.nih.gov/ij/plugins/multiple-lut-stack.html

-wayne


On Mar 16, 2009, at 7:30 PM, Piotr Wendykier wrote:

> 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
>