Login  Register

Re: Writing a plugin that displays two images overlapping and semi-opaque

Posted by Ed Simmons on Sep 30, 2013; 4:37pm
URL: http://imagej.273.s1.nabble.com/Writing-a-plugin-that-displays-two-images-overlapping-and-semi-opaque-tp5004982p5004998.html

On 30/09/13 17:15, Rasband, Wayne (NIH/NIMH) [E] wrote:

> On Sep 30, 2013, at 10:26 AM, Ed Simmons wrote:
>
>> Hi IJ list,
>>
>> I'm currently writing a plugin for Micro-Manager that makes use of IJ quite a bit. I'm processing images that arrive from the camera on the fly and trying to display an image formed from bits of the incoming images.
>>
>> The images arrive from the camera in MM - this is actually the multi-camera plugin and provides two greyscale images in channels 1 + 2. The two cameras have two physically different views and the images from each are being analysed to determine the location of some alignment features, using the positions determined from these alignment features (already working) I would like to choose ROIs on the source channels and form a new image - formed of one ROI from each channel where the two ROIs overlap in the destination image. I have this working in principle using the code below, but the aim is to have the two overlapping ROIs semi-transparent so that the alignment of one image can be checked against the other visually.
> Here is a small, but self-contained, JavaScript example that displays two images overlapping and semi-opaque:
>
>   imp = IJ.openImage("http://imagej.nih.gov/ij/images/FluorescentCells.zip");
>   imp2 = IJ.openImage("http://imagej.nih.gov/ij/images/boats.gif");
>   ip = imp2.getProcessor().resize(360,288);
>   imageRoi = new ImageRoi(50,50, ip);
>   imageRoi.setOpacity(0.40);
>   imp.setRoi(imageRoi);
>   imp.show();
>
> -wayne

Thanks Wayne,

I wondered what I was missing there...  :-)

Best,
Ed

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