API way to set channel LUT in composite image.

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

API way to set channel LUT in composite image.

Aryeh Weiss
I am trying to do set the LUt of a channel (actually, three of them) for
a composite image.

     fusedImp.setC(1)
     IJ.run(fusedImp, "Grays", "")
     fusedImp.setC(2)
     IJ.run(fusedImp, "Red", "")
     fusedImp.setC(3)
     IJ.run(fusedImp, "Green", "")

Above is a way that works. However, it means that the image (which is
large) updates with each IJ.run call,

I tries the following:

     compFused = CompositeImage(fusedImp)

     compFused.setChannelLut(LUT.createLutFromColor(Color.GRAY), 1)
     compFused.setChannelLut(LUT.createLutFromColor(Color.RED), 2)
     compFused.setChannelLut(LUT.createLutFromColor(Color.GREEN), 3)

for i in compFused.getLuts():
     print i

compFused.updateAllChannelsAndDraw()

but although the correct LUTs print out, the image is unchanged.

What am I missing?

Tnx in advance
--aryeh

--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: API way to set channel LUT in composite image. [SOLVED]

Aryeh Weiss
I found the answer to this problem.

My mistake was that I did not realize that

compFused = CompositeImage(fusedImp)

creates a separate image. I thought (incorrectly) that it was the same
image, just with teh composite methods added.
Since it is a new image, I needed to run show() to display it.

adding compFused.show() displayed the new image with the correct LUTs.


--aryeh

On 23/08/2018 12:40, Aryeh Weiss wrote:

>
> I am trying to do set the LUt of a channel (actually, three of them)
> for a composite image.
>
>     fusedImp.setC(1)
>     IJ.run(fusedImp, "Grays", "")
>     fusedImp.setC(2)
>     IJ.run(fusedImp, "Red", "")
>     fusedImp.setC(3)
>     IJ.run(fusedImp, "Green", "")
>
> Above is a way that works. However, it means that the image (which is
> large) updates with each IJ.run call,
>
> I tries the following:
>
>     compFused = CompositeImage(fusedImp)
>
>     compFused.setChannelLut(LUT.createLutFromColor(Color.GRAY), 1)
>     compFused.setChannelLut(LUT.createLutFromColor(Color.RED), 2)
>     compFused.setChannelLut(LUT.createLutFromColor(Color.GREEN), 3)
>
> for i in compFused.getLuts():
>     print i
>
> compFused.updateAllChannelsAndDraw()
>
> but although the correct LUTs print out, the image is unchanged.
>
> What am I missing?
>
> Tnx in advance
> --aryeh
>
> --
> Aryeh Weiss
> Faculty of Engineering
> Bar Ilan University
> Ramat Gan 52900 Israel
>
> Ph:  972-3-5317638
> FAX: 972-3-7384051
>

--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html