How to suppress warning window appearing?

console
Tags: #<Tag:0x00007fb8833698e8>

#1

Hi! In my app I use ImageJ and the warning window about changing parameters is pure annoying.
Site docs http://imagej.net/Logging do not help .

Such obvious tricks are useless.

System.setProperty("scijava.log.level", "error")
IJ.debugMode = false

How to fix?


Run plugin from java/scala program
#2

@Claus1 Could you please paste the stderr output? From your description, I do not understand which warnings you are talking about. The best solution would be to fix things so that those warnings are not emitted. But how to do that depends on what they are.


#3

Hi! In using plugin they wrote a lot code like
IJ.log(“Bernsen: changed contrast_threshold from :” + contrast_threshold + " to:" + par1);
and when I use it with my parameters a window shows up with all that warnings. Every call all the time!


#4

@Claus1 Yes, you’re right, that plugin always wrote to the ImageJ1 log. I have committed a fix:

@gabriel I hope you do not mind this change. If there is some reason these log statements need to stay in place, let me know and I’ll revert this commit.

@Claus1 Tangentially: here is an example of using local Bernsen thresholding with ImageJ Ops:

#@ OpService ops
#@ Img image

import net.imglib2.algorithm.neighborhood.HyperSphereShape
import net.imglib2.type.logic.BitType

// Secondary parameter values. These are wild guesses.
contrastThreshold = 10
halfMaxValue = 10
radius = 8

shape = new HyperSphereShape(radius)
result = ops.run("create.img", image, new BitType())
ops.threshold().localBernsenThreshold(result, image, shape, contrastThreshold, halfMaxValue)

And the output:


#5

Thanks! Found required ones in ops!


#6

I am not clear if the Local Threshold is causing a problem or you are just commenting on the code?
If the former, can you post an example where the change of parameter is shown in the log window?
There is a reason for this.

A common dialog selects the different methods. Several of these have their own parameters that cannot loaded as default before knowing which method you’ll chose (this is because the way the GenericDialog class works).
So the “default value” of 0 for parameters 1 and 2 are not really “0” but act as flag for “using the default”.
For example Bernsen’s contrast parameter is 15 by default, Phansalkar’s k is 0.25 and r is 0.5.

When changing that 0 to some other value, it shows you what is the original algorithm value and what it was changed to. But the reason I question whether this is really a problem is that this never shows unless you are fiddling with the internal parameters of the algorithms. In which situation do you get an output?


#7

I am not clear if the Local Threshold is causing a problem or you are just commenting on the code?

Local Threshold causes. But for me it should be a way to supress the log window. If someone want to log in his code it is normal. abnormally if a code user can not lock or filter for his purposes.

If the former, can you post an example where the change of parameter is shown in the log window?

thresholder.exec(dup, “Phansalkar” ,35,k,r,false) //direct call of Auto_Local_Threshold method

In which situation do you get an output?

In my case k, r sometimes should be different. When I need to detect areas with a slight difference in intensity.


#8

You said “every call all the time” and that does not sound right.
Do you mean that you never use the default values?
Or do you get the message also when using the defaults?


#9

Of course I get message when the parameters are not by default. Every call my console prog I get that window. ~100 methods are called every execution, 90% non default parameters :slight_smile: