FloodFiller selectively not performing action

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

FloodFiller selectively not performing action

gankaku
Hi all,

I tried to figure out what is the problem of the following but neither the
IJ-API, nor the source code or Google did lead to any functional
suggestion. So here's the confusing problem:

I use the FloodFiller to selectively eliminate particles in an 8-bit image.
I do this for 2 independent images and purposes. once it perfectly works
and the second part of the code does not work. Potentially, I am blinded by
my own code and can't find the obvious problem after a day of trial and
error. Anybody experience anything similar or has a potential suggestion to
solve this problem.

All variables, ImagePlus and ImageProcessors are defined and I do not get
any error messages or null-pointer exceptions. It simply refuses to fill
what it is supposed to fill

Working code snippet:

.....
FloodFiller filledImage = new FloodFiller(tempIP);
tempIP.setValue(0.0);

Boolean end;
for(int n=0; n<initialResultNumber; n++) {

end=false;
if(Extent!="0.00-1.00" & end==false) {

double ExtentMin = Double.parseDouble(Extent.substring(0,
Extent.indexOf("-")));

double ExtentMax =
Double.parseDouble(Extent.substring(Extent.indexOf("-")+1));

if(extent[n]<ExtentMin || extent[n]>ExtentMax) {

filledImage.fill8(X[n], Y[n]);

end=true;

IJ.log("Extent");

}

}

}
.....


And here comes the snippet which does not work:

FloodFiller bcFF = new FloodFiller(ip2);
ip2.setValue(0.0);

if(Correction=="Top-Left" || Correction=="Top-Right" ||
Correction=="Bottom-Left") {

bcFF.fill8(width, height);
IJ.log("Fill 01");
imp2.show();

} else if(Correction=="Bottom-Right") {

bcFF.fill8(0, 0);
IJ.log("Fill02");
imp2.show();

}



I hope the snippets are sufficient to interpret any problem. Interesting is
also that all control output in the log window is produced. So it is not a
problem of ignored if-statement performance.

I would be greatful for any suggestions.

Have a nice weekend,
Jan

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

Re: FloodFiller selectively not performing action

Gabriel Landini
On Friday 09 May 2014 17:14:59 BioVoxxel wrote:
> if(Correction=="Top-Left" || Correction=="Top-Right" ||
> Correction=="Bottom-Left") {
>
> bcFF.fill8(width, height);
> IJ.log("Fill 01");
> imp2.show();
>
> } else if(Correction=="Bottom-Right") {

I think your problem is that you are comparing strings and that is not done
that way in Java.

You need something like:
if (Correction.equals(""Bottom-Right") ....
and so on

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