Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
12 posts
|
Hi IJ list,
I wonder if someone could help, please? I'm trying to work out how best to use overlays on an image with two channels. I'm using Micro-manager to acquire images (displayed as greyscale channels that the user can choose between, not a composite image) and I would like to draw on the overlays of individual channels of the same image. Is this something that is possible to do with IJ directly or do I need to code this myself? I recall that it can be made to work the way I want with stacks of images (eg each image in the stack has it's own overlay) but I can't make this happen using channels. Any help gratefully receieved - thanks in advance. Best regards, Ed |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
1064 posts
|
On May 20, 2013, at 7:45 AM, edsimmons wrote:
> Hi IJ list, > > I wonder if someone could help, please? > > I'm trying to work out how best to use overlays on an image with two > channels. I'm using Micro-manager to acquire images (displayed as greyscale > channels that the user can choose between, not a composite image) and I > would like to draw on the overlays of individual channels of the same image. > > Is this something that is possible to do with IJ directly or do I need to > code this myself? You can add overlays to multichannel images. Here are JavaScript and macro examples that create a 2 channel, 10 frame hyperstack and then add an overlay containing a rectangle that is displayed on channel 1 of all 10 frames, a rectangle that is only displayed on channel 1 of frame 1, a circle that is displayed on channel 2 of all 10 frames and a circle that is only displayed only on channel 2 of frame 2. -wayne // This script demonstrates how to create a two // channel hyperstack and add an overlay to it. channels = 2; slices = 1; frames = 10; imp = IJ.createHyperStack("Test", 500, 500, channels, slices, frames, 8); imp.setMode(CompositeImage.GRAYSCALE); overlay = new Overlay(); // add rectangle that will be displayed on channel 1 of all 10 frames rect1 = new Roi(100, 100, 100, 100); rect1.setPosition(1, 1, 0); overlay.add(rect1); // add rectangle that will be displayed on channel 1 of 1st frame rect2 = new Roi(100, 250, 100, 100); rect2.setPosition(1, 1, 1); overlay.add(rect2); // add circle that will be displayed on channel 2 of all 10 frames circle1 = new OvalRoi(250, 100, 100, 100); circle1.setPosition(2, 1, 0); overlay.add(circle1); // add circle that will be displayed on channel 2 of 2nd frame circle2 = new OvalRoi(250, 250, 100, 100); circle2.setPosition(2, 1, 2); overlay.add(circle2); imp.setOverlay(overlay); imp.show(); // This macro demonstrates how to create a two // channel hyperstack and add an overlay to it. // It requires the ImageJ 1.47r daily build. requires("1.47r"); channels = 2; slices = 1; frames = 10; newImage("Test", "8-bit black", 500, 500, channels, slices, frames); Stack.setDisplayMode("grayscale"); // add rectangle that will be displayed on channel 1 of all 10 frames makeRectangle(100, 100, 100, 100); Overlay.addSelection; Overlay.setPosition(1, 1, 0) // add rectangle that will be displayed on channel 1 of 1st frame makeRectangle(100, 250, 100, 100); Overlay.addSelection; Overlay.setPosition(1, 1, 1) // add circle that will be displayed on channel 2 of all 10 frames makeOval(250, 100, 100, 100); Overlay.addSelection; Overlay.setPosition(2, 1, 0) // add circle that will be displayed on channel 2 of 2nd frame makeOval(250, 250, 100, 100); Overlay.addSelection; Overlay.setPosition(2, 1, 2); Overlay.show; run("Select None"); -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
211 posts
|
Dear all,
On 21.05.2013 6:31 PM, Rasband, Wayne (NIH/NIMH) [E] wrote: > You can add overlays to multichannel images. Here are JavaScript and macro examples that create a 2 channel, 10 frame hyperstack and then add an overlay containing a rectangle that is displayed on channel 1 of all 10 frames, a rectangle that is only displayed on channel 1 of frame 1, a circle that is displayed on channel 2 of all 10 frames and a circle that is only displayed only on channel 2 of frame 2. Thanks, Wayne, for this illustrative code. Just a note for *Fiji* users: in order for the Javascript example to work in Fiji, you have to add: importClass(Packages.ij.gui.Overlay); to the begining of the code. Jan > > // This script demonstrates how to create a two > // channel hyperstack and add an overlay to it. > channels = 2; > slices = 1; > frames = 10; > imp = IJ.createHyperStack("Test", 500, 500, channels, slices, frames, 8); > imp.setMode(CompositeImage.GRAYSCALE); > overlay = new Overlay(); > // add rectangle that will be displayed on channel 1 of all 10 frames > rect1 = new Roi(100, 100, 100, 100); > rect1.setPosition(1, 1, 0); > overlay.add(rect1); > // add rectangle that will be displayed on channel 1 of 1st frame > rect2 = new Roi(100, 250, 100, 100); > rect2.setPosition(1, 1, 1); > overlay.add(rect2); > // add circle that will be displayed on channel 2 of all 10 frames > circle1 = new OvalRoi(250, 100, 100, 100); > circle1.setPosition(2, 1, 0); > overlay.add(circle1); > // add circle that will be displayed on channel 2 of 2nd frame > circle2 = new OvalRoi(250, 250, 100, 100); > circle2.setPosition(2, 1, 2); > overlay.add(circle2); > imp.setOverlay(overlay); > imp.show(); > ... [show rest of quote] -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
12 posts
|
In reply to this post by Rasband, Wayne (NIH/NIMH) [E]
Thanks Wayne, very nice example. Please could you steer me towards the Java API equivalent of imp.setMode(CompositeImage.GRAYSCALE);? I've tried looking at the ImagePlus and Stack api docs, but not found the way to actually do it to the imageplus i'm trying to work with. Thanks, Ed |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
59 posts
|
Hi Ed,
I believe you are looking for CompositeImage::setMode. Best, John Le 24 mai 2013 à 13:06, edsimmons a écrit : > Rasband, Wayne (NIH/NIMH) [E] wrote >> imp.setMode(CompositeImage.GRAYSCALE); >> overlay = new Overlay(); >> // add rectangle that will be displayed on channel 1 of all 10 frames >> rect1 = new Roi(100, 100, 100, 100); >> rect1.setPosition(1, 1, 0); >> overlay.add(rect1); >> > > Thanks Wayne, very nice example. > > Please could you steer me towards the Java API equivalent of > imp.setMode(CompositeImage.GRAYSCALE);? > > I've tried looking at the ImagePlus and Stack api docs, but not found the > way to actually do it to the imageplus i'm trying to work with. > > Thanks, > Ed > > > > -- > View this message in context: http://imagej.1557.x6.nabble.com/Using-overlays-on-image-channels-tp5003054p5003107.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html ... [show rest of quote] -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Disable Popup Ads | Edit this page |