How can i change a color of an image programmatically?

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

How can i change a color of an image programmatically?

mukesh14149
This post has NOT been accepted by the mailing list yet.
Suppose i have a stack of 30 images and i want to change color of some of the image using LUTs

         LUT overlayLUT;
        // Create overlay LUT
                byte[] red = new byte[ 256 ];
                byte[] green = new byte[ 256 ];
                byte[] blue = new byte[ 256 ];

        public void setLut(List<Color> colors ){
                int i=0;
                for(Color color: colors){
                        red[i] = (byte) color.getRed();
                        green[i] = (byte) color.getGreen();
                        blue[i] = (byte) color.getBlue();
                        i++;
                }
                overlayLUT = new LUT(red, green, blue);
        }


ImagePlus t= IJ.openImage("/home/mg/Downloads/tifs/image.tif");
t.show();
t.getStack().getProcessor(5).setColorModel(ss.overlayLUT);
t.getStack().getProcessor(15).setColorModel(ss.overlayLUT);
t.getStack().getProcessor(5).fill();
t.getStack().getProcessor(15).fill();
t.updateAndDraw();

I am still getting black color images at index 5 and 15?