Using Brush Tool in Java

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

Using Brush Tool in Java

jck
Hi,

i want to use the Brush tool of ImageJ in my own Java programm.
It is no problem to set the tool, but i cannot use it.
When a image is open i can draw on it, but all i get is an yellow frame, where the color should be.

I already tried to set up the color with:
Toolbar.setBackgroundColor() und Toolbar.setForegroundColor()

Maybe someone can help, or show me a tutorial how to do it, i could not find one.

This is how i call the Toolbar/Tool:
       
Toolbar t = new Toolbar();
	Toolbar.setBrushSize(10); 
	t.setTool(7);

Another question:
Is there a plugin that splits an Image by Colors? (About 10 Colors, i only found the Color_Deconvolution, but it only can split 3 different colors).


Thanks in advance.
Michael.
Reply | Threaded
Open this post in threaded view
|

Re: Using Brush Tool in Java

Herbie-2
Good day Michael,

regarding colors, I assume that you deal with RGB images that are
composed of (only) three 8bit images: a red, a green, and a blue.

Another story are stacks composed of more than these three
color-specific images...

HTH

Herbie
____________________________
On 15.04.13 16:40, jck wrote:

> Hi,
>
> i want to use the Brush tool of ImageJ in my own Java programm.
> It is no problem to set the tool, but i cannot use it.
> When a image is open i can draw on it, but all i get is an yellow frame,
> where the color should be.
>
> I already tried to set up the color with:
> Toolbar.setBackgroundColor() und Toolbar.setForegroundColor()
>
> Maybe someone can help, or show me a tutorial how to do it, i could not find
> one.
>
> This is how i call the Toolbar/Tool:
>
>
> Another question:
> Is there a plugin that splits an Image by Colors? (About 10 Colors, i only
> found the Color_Deconvolution, but it only can split 3 different colors).
>
>
> Thanks in advance.
> Michael.
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Using-Brush-Tool-in-Java-tp5002648.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Re: Using Brush Tool in Java

jck
Hello,

i know it is only RGB.
But the colors are display togehter, so in i can see other colors, like Yellow, Purple, (Black).

The Color_Deconvolution Plugin can already do this, it does split by every 3 colors i want.

My problem is:
I have a picture (scan) with circles in different colors (up to 10 colors). I want to know the area of every color, so for example all red circles include an area of 10mm^2.
But i have to split the image to only measure one color.


Michael.



On 04/15/2013 at 5:40 PM, "Herbie-2 [via ImageJ]" <[hidden email]> wrote:

>
>Good day Michael,
>
>regarding colors, I assume that you deal with RGB images that are
>composed of (only) three 8bit images: a red, a green, and a blue.
>
>Another story are stacks composed of more than these three
>color-specific images...
>
>HTH
>
>Herbie
>____________________________
>On 15.04.13 16:40, jck wrote:
>> Hi,
>>
>> i want to use the Brush tool of ImageJ in my own Java programm.
>> It is no problem to set the tool, but i cannot use it.
>> When a image is open i can draw on it, but all i get is an
>yellow frame,
>> where the color should be.
>>
>> I already tried to set up the color with:
>> Toolbar.setBackgroundColor() und Toolbar.setForegroundColor()
>>
>> Maybe someone can help, or show me a tutorial how to do it, i
>could not find
>> one.
>>
>> This is how i call the Toolbar/Tool:
>>
>>
>> Another question:
>> Is there a plugin that splits an Image by Colors? (About 10
>Colors, i only
>> found the Color_Deconvolution, but it only can split 3 different
>colors).
>>
>>
>> Thanks in advance.
>> Michael.
>>
>>
>>
>> --
>> View this message in context:
>http://imagej.1557.x6.nabble.com/Using-Brush-Tool-in-Java-
>tp5002648.html
>> Sent from the ImageJ mailing list archive at Nabble.com.
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>
>--
>ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
>
>
>
>_______________________________________________
>If you reply to this email, your message will be added to the
>discussion below:
>http://imagej.1557.x6.nabble.com/Using-Brush-Tool-in-Java-
>tp5002648p5002650.html
>
>To unsubscribe from Using Brush Tool in Java, visit
>http://imagej.1557.x6.nabble.com/template/NamlServlet.jtp?macro=uns
>ubscribe_by_code&node=5002648&code=bWVuemVsQGh1c2guY29tfDUwMDI2NDh8
>MzU4NDEwMDM0

Reply | Threaded
Open this post in threaded view
|

Re: Using Brush Tool in Java

Michael Schmid
In reply to this post by jck
Hi Michael,

(1) on the Brush tool:
Your description sounds like you have the Selection Brush tool (available manually via the Toolbar by right-clicking on the second field, which is usually the ellipse). The interior of the brush becomes a selection; the outline of the selection is usually orange or yellow, depending on Edit>Options>Color.

The true brush tool is usually loaded with the StartupMacros.txt to one of the free slots.


(2) Finding 10 colors in an image? Does this mean, you have 10 different color shades, each of them with different hue, saturation or brightness, but not exactly that value, in an image with 3 primary colors (RGB)? To get started, you may have a look at the color space using the Color Inspection plugin
  http://rsbweb.nih.gov/ij/plugins/color-inspector.html
I don't know any good way to proceed.
Or does it mean, you have an image with 10 or more channels for specific wavelengths?

Michael
________________________________________________________________
On Apr 15, 2013, at 16:40, jck wrote:

> Hi,
>
> i want to use the Brush tool of ImageJ in my own Java programm.
> It is no problem to set the tool, but i cannot use it.
> When a image is open i can draw on it, but all i get is an yellow frame,
> where the color should be.
>
> I already tried to set up the color with:
> Toolbar.setBackgroundColor() und Toolbar.setForegroundColor()
>
> Maybe someone can help, or show me a tutorial how to do it, i could not find
> one.
>
> This is how i call the Toolbar/Tool:
>
>
> Another question:
> Is there a plugin that splits an Image by Colors? (About 10 Colors, i only
> found the Color_Deconvolution, but it only can split 3 different colors).
>
>
> Thanks in advance.
> Michael.
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Using-Brush-Tool-in-Java-tp5002648.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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

autoAdjust

CARL Philippe (LBP)
In reply to this post by jck
Dear all,
I would like to use the method auto-adjust contrast on a picture (within a plugin) which is I guess the ContrastAdjuster.autoAdjust(ImagePlus imp, ImageProcessor ip) method from ij.plugin.frame.ContrastAdjuster.
But this method is not public and thus cannot be accessed from outside package.
Also is there an alternative way of running an auto-adjust contrast?
I thank you very much in advance for your help.
My best regards,
Philippe

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

Re: Using Brush Tool in Java

Herbie-2
In reply to this post by jck
Well Michael,

so why not detect the desired color mixtures according to their definition?
(As has been pointed out by Michael Schmid, you can't create arbitrary
colors from RGB-channels but this doesn't seem to be the issue here.)

Maybe I'm missing something...

Best

Herbie
____________________________
On 15.04.13 18:21, jck wrote:

> Hello,
>
> i know it is only RGB.
> But the colors are display togehter, so in i can see other colors, like Yellow, Purple, (Black).
>
> The Color_Deconvolution Plugin can already do this, it does split by every 3 colors i want.
>
> My problem is:
> I have a picture (scan) with circles in different colors (up to 10 colors). I want to know the area of every color, so for example all red circles include an area of 10mm^2.
> But i have to split the image to only measure one color.
>
>
> Michael.
>
>
>
> On 04/15/2013 at 5:40 PM, "Herbie-2 [via ImageJ]"<[hidden email]>  wrote:
>>
>> Good day Michael,
>>
>> regarding colors, I assume that you deal with RGB images that are
>> composed of (only) three 8bit images: a red, a green, and a blue.
>>
>> Another story are stacks composed of more than these three
>> color-specific images...
>>
>> HTH
>>
>> Herbie
>> ____________________________
>> On 15.04.13 16:40, jck wrote:
>>> Hi,
>>>
>>> i want to use the Brush tool of ImageJ in my own Java programm.
>>> It is no problem to set the tool, but i cannot use it.
>>> When a image is open i can draw on it, but all i get is an
>> yellow frame,
>>> where the color should be.
>>>
>>> I already tried to set up the color with:
>>> Toolbar.setBackgroundColor() und Toolbar.setForegroundColor()
>>>
>>> Maybe someone can help, or show me a tutorial how to do it, i
>> could not find
>>> one.
>>>
>>> This is how i call the Toolbar/Tool:
>>>
>>>
>>> Another question:
>>> Is there a plugin that splits an Image by Colors? (About 10
>> Colors, i only
>>> found the Color_Deconvolution, but it only can split 3 different
>> colors).
>>>
>>>
>>> Thanks in advance.
>>> Michael.
>>>
>>>
>>>
>>> --
>>> View this message in context:
>> http://imagej.1557.x6.nabble.com/Using-Brush-Tool-in-Java-
>> tp5002648.html
>>> Sent from the ImageJ mailing list archive at Nabble.com.
>>>
>>> --
>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>>
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>>
>>
>>
>> _______________________________________________
>> If you reply to this email, your message will be added to the
>> discussion below:
>> http://imagej.1557.x6.nabble.com/Using-Brush-Tool-in-Java-
>> tp5002648p5002650.html
>>
>> To unsubscribe from Using Brush Tool in Java, visit
>> http://imagej.1557.x6.nabble.com/template/NamlServlet.jtp?macro=uns
>> ubscribe_by_code&node=5002648&code=bWVuemVsQGh1c2guY29tfDUwMDI2NDh8
>> MzU4NDEwMDM0
>
>
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Using-Brush-Tool-in-Java-tp5002648p5002652.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Re: Using Brush Tool in Java

Michael Schmid
In reply to this post by jck
Hi Michael,

did you try the 'threshold color' command? You can select a color range with it.
When doing it manually, adjust the sliders until you have selected only the color you like, then press 'select' to convert it into a region of interest. With 'Area' checked in the measurement options, 'Measure' will give you the area.
You can also create a macro creating a mask image (Macro button), then use
  run("Create Selection");
Beware: the macro destroys the original image, so work on a copy.
You can run everything in the macro starting from 'min[0]=0;' in a loop to get it done for each of your colors.

Michael
________________________________________________________________
On Apr 15, 2013, at 18:21, jck wrote:

> Hello,
>
> i know it is only RGB.
> But the colors are display togehter, so in i can see other colors, like Yellow, Purple, (Black).
>
> The Color_Deconvolution Plugin can already do this, it does split by every 3 colors i want.
>
> My problem is:
> I have a picture (scan) with circles in different colors (up to 10 colors). I want to know the area of every color, so for example all red circles include an area of 10mm^2.
> But i have to split the image to only measure one color.
>
>
> Michael.
>
>
>
> On 04/15/2013 at 5:40 PM, "Herbie-2 [via ImageJ]" <[hidden email]> wrote:
>>
>> Good day Michael,
>>
>> regarding colors, I assume that you deal with RGB images that are
>> composed of (only) three 8bit images: a red, a green, and a blue.
>>
>> Another story are stacks composed of more than these three
>> color-specific images...
>>
>> HTH
>>
>> Herbie
>> ____________________________
>> On 15.04.13 16:40, jck wrote:
>>> Hi,
>>>
>>> i want to use the Brush tool of ImageJ in my own Java programm.
>>> It is no problem to set the tool, but i cannot use it.
>>> When a image is open i can draw on it, but all i get is an
>> yellow frame,
>>> where the color should be.
>>>
>>> I already tried to set up the color with:
>>> Toolbar.setBackgroundColor() und Toolbar.setForegroundColor()
>>>
>>> Maybe someone can help, or show me a tutorial how to do it, i
>> could not find
>>> one.
>>>
>>> This is how i call the Toolbar/Tool:
>>>
>>>
>>> Another question:
>>> Is there a plugin that splits an Image by Colors? (About 10
>> Colors, i only
>>> found the Color_Deconvolution, but it only can split 3 different
>> colors).
>>>
>>>
>>> Thanks in advance.
>>> Michael.
>>>
>>>
>>>
>>> --
>>> View this message in context:
>> http://imagej.1557.x6.nabble.com/Using-Brush-Tool-in-Java-
>> tp5002648.html
>>> Sent from the ImageJ mailing list archive at Nabble.com.
>>>
>>> --
>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>>
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>>
>>
>>
>> _______________________________________________
>> If you reply to this email, your message will be added to the
>> discussion below:
>> http://imagej.1557.x6.nabble.com/Using-Brush-Tool-in-Java-
>> tp5002648p5002650.html
>>
>> To unsubscribe from Using Brush Tool in Java, visit
>> http://imagej.1557.x6.nabble.com/template/NamlServlet.jtp?macro=uns
>> ubscribe_by_code&node=5002648&code=bWVuemVsQGh1c2guY29tfDUwMDI2NDh8
>> MzU4NDEwMDM0
>
>
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Using-Brush-Tool-in-Java-tp5002648p5002652.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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

Re: autoAdjust

Michael Schmid
In reply to this post by CARL Philippe (LBP)
Hi Philippe,

you can try
  ContrastEnhancer.stretchHistogram(ImageProcessor ip, double saturated) or
  ContrastEnhancer.stretchCompositeImageHistogram(CompositeImage imp, double saturated, ImageStatistics stats)
The default value for auto adjustment is saturated = 0.35 (in percent).

Michael
________________________________________________________________
On Apr 15, 2013, at 23:58, CARL Philippe (PHA) wrote:

> Dear all,
> I would like to use the method auto-adjust contrast on a picture (within a plugin) which is I guess the ContrastAdjuster.autoAdjust(ImagePlus imp, ImageProcessor ip) method from ij.plugin.frame.ContrastAdjuster.
> But this method is not public and thus cannot be accessed from outside package.
> Also is there an alternative way of running an auto-adjust contrast?
> I thank you very much in advance for your help.
> My best regards,
> Philippe

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

Re: Using Brush Tool in Java

jck
In reply to this post by Michael Schmid
Hi.

it seems like i have the selection brush tool.
Is there a list available which tool has which number?

I use the method setTool() of the toolbar Object, example:
t.setTool(5);
------------

I have 10 different color shades, the colors come from a scan of transparent film where people draw lines.

If i only look at the direction of the vector (which represents the color) and not the length it should be possible to split the image.
But since this seems to be a pretty common task to me i tried to find an plugin which already does this.



On 04/15/2013 at 7:02 PM, "Michael Schmid-3 [via ImageJ]" <[hidden email]> wrote:

>
>Hi Michael,
>
>(1) on the Brush tool:
>Your description sounds like you have the Selection Brush tool
>(available manually via the Toolbar by right-clicking on the
>second field, which is usually the ellipse). The interior of the
>brush becomes a selection; the outline of the selection is usually
>orange or yellow, depending on Edit>Options>Color.
>
>The true brush tool is usually loaded with the StartupMacros.txt
>to one of the free slots.
>
>
>(2) Finding 10 colors in an image? Does this mean, you have 10
>different color shades, each of them with different hue,
>saturation or brightness, but not exactly that value, in an image
>with 3 primary colors (RGB)? To get started, you may have a look
>at the color space using the Color Inspection plugin
>  http://rsbweb.nih.gov/ij/plugins/color-inspector.html
>I don't know any good way to proceed.
>Or does it mean, you have an image with 10 or more channels for
>specific wavelengths?
>
>Michael
>________________________________________________________________
>On Apr 15, 2013, at 16:40, jck wrote:
>
>> Hi,
>>
>> i want to use the Brush tool of ImageJ in my own Java programm.
>> It is no problem to set the tool, but i cannot use it.
>> When a image is open i can draw on it, but all i get is an
>yellow frame,
>> where the color should be.
>>
>> I already tried to set up the color with:
>> Toolbar.setBackgroundColor() und Toolbar.setForegroundColor()
>>
>> Maybe someone can help, or show me a tutorial how to do it, i
>could not find
>> one.
>>
>> This is how i call the Toolbar/Tool:
>>
>>
>> Another question:
>> Is there a plugin that splits an Image by Colors? (About 10
>Colors, i only
>> found the Color_Deconvolution, but it only can split 3 different
>colors).
>>
>>
>> Thanks in advance.
>> Michael.
>>
>>
>>
>> --
>> View this message in context:
>http://imagej.1557.x6.nabble.com/Using-Brush-Tool-in-Java-
>tp5002648.html
>> Sent from the ImageJ mailing list archive at Nabble.com.
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
>--
>ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
>
>
>
>_______________________________________________
>If you reply to this email, your message will be added to the
>discussion below:
>http://imagej.1557.x6.nabble.com/Using-Brush-Tool-in-Java-
>tp5002648p5002653.html
>
>To unsubscribe from Using Brush Tool in Java, visit
>http://imagej.1557.x6.nabble.com/template/NamlServlet.jtp?macro=uns
>ubscribe_by_code&node=5002648&code=bWVuemVsQGh1c2guY29tfDUwMDI2NDh8
>MzU4NDEwMDM0