setThreshold NaN value

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

setThreshold NaN value

ebocher
Dear all,

I try to set a NaN value to my image.

I use this

ip.setThreshold(0.0d, 500.0d, ImageProcessor.RED_LUT);

 ImagePlus imp = new ImagePlus("",ip);
imp.show();
 IJ.run("NaN Background");

It works fine but I don't want to show the imagePlus.

Is it another way to do this ?

Thanks

R1.

Ps :  I use this code in a java application.

--
Ingénieur de recherche
Docteur en géographie,
spécialité géomatique
École Centrale de Nantes
Institut de recherche en sciences et techniques de la ville
http://www.irstv.cnrs.fr/
http://geosysin.iict.ch/irstv-trac/wiki
http://r1.bocher.free.fr
http://www.projet-sigle.org
Reply | Threaded
Open this post in threaded view
|

Re: setThreshold NaN value

Volker Baecker
Try WindowManager.setTempCurrentImage(imp) instead of imp.show();

Volker

erwan bocher a écrit :

> Dear all,
>
> I try to set a NaN value to my image.
>
> I use this
>
> ip.setThreshold(0.0d, 500.0d, ImageProcessor.RED_LUT);
>
>  ImagePlus imp = new ImagePlus("",ip);
> imp.show();
>  IJ.run("NaN Background");
>
> It works fine but I don't want to show the imagePlus.
>
> Is it another way to do this ?
>
> Thanks
>
> R1.
>
> Ps :  I use this code in a java application.
>

--
passerelle antivirus du campus CNRS de Montpellier
--
Reply | Threaded
Open this post in threaded view
|

Re: setThreshold NaN value

ebocher
Hi,

Thank you but it doesn't work.

I obtain the value 0 for the pixel. If I use imp.show() the pixel value is
NaN.

R1.

2007/8/30, Volker Bäcker <[hidden email]>:

>
> Try WindowManager.setTempCurrentImage(imp) instead of imp.show();
>
> Volker
>
> erwan bocher a écrit :
> > Dear all,
> >
> > I try to set a NaN value to my image.
> >
> > I use this
> >
> > ip.setThreshold(0.0d, 500.0d, ImageProcessor.RED_LUT);
> >
> >  ImagePlus imp = new ImagePlus("",ip);
> > imp.show();
> >  IJ.run("NaN Background");
> >
> > It works fine but I don't want to show the imagePlus.
> >
> > Is it another way to do this ?
> >
> > Thanks
> >
> > R1.
> >
> > Ps :  I use this code in a java application.
> >
>
> --
> passerelle antivirus du campus CNRS de Montpellier
> --
>



--
Ingénieur de recherche
Docteur en géographie,
spécialité géomatique
École Centrale de Nantes
Institut de recherche en sciences et techniques de la ville
http://www.irstv.cnrs.fr/
http://geosysin.iict.ch/irstv-trac/wiki
http://r1.bocher.free.fr
http://www.projet-sigle.org
Reply | Threaded
Open this post in threaded view
|

Re: setThreshold NaN value

Volker Baecker
Hi,
the following works fine for me:

ImagePlus imp = NewImage.createFloatImage("test", 300, 200, 1,
NewImage.FILL_BLACK);
imp.getProcessor().setThreshold(1d, 500.0d, ImageProcessor.RED_LUT);
WindowManager.setTempCurrentImage(imp);
IJ.run("NaN Background");
System.out.println(imp.getProcessor().getf(0, 0));

You have to use a method with a float result like getf or getPixelValue,
since if the return type is int the NaN will automatically be converted
into 0 of type int.

Volker

erwan bocher a écrit :

> Hi,
>
> Thank you but it doesn't work.
>
> I obtain the value 0 for the pixel. If I use imp.show() the pixel value is
> NaN.
>
> R1.
>
> 2007/8/30, Volker Bäcker <[hidden email]>:
>> Try WindowManager.setTempCurrentImage(imp) instead of imp.show();
>>
>> Volker
>>
>> erwan bocher a écrit :
>>> Dear all,
>>>
>>> I try to set a NaN value to my image.
>>>
>>> I use this
>>>
>>> ip.setThreshold(0.0d, 500.0d, ImageProcessor.RED_LUT);
>>>
>>>  ImagePlus imp = new ImagePlus("",ip);
>>> imp.show();
>>>  IJ.run("NaN Background");
>>>
>>> It works fine but I don't want to show the imagePlus.
>>>
>>> Is it another way to do this ?
>>>
>>> Thanks
>>>
>>> R1.
>>>
>>> Ps :  I use this code in a java application.
>>>
>> --
>> passerelle antivirus du campus CNRS de Montpellier
>> --
>>
>
>
>

--
passerelle antivirus du campus CNRS de Montpellier
--
Reply | Threaded
Open this post in threaded view
|

Re: setThreshold NaN value

ebocher
Hi,

Merci

It works fine. I was using :

int[] v = imp.getPixel(pixelx, pixely);

 System.out.println(Float.intBitsToFloat(v[0]));


R1.

2007/8/30, Volker Bäcker <[hidden email]>:

>
> Hi,
> the following works fine for me:
>
> ImagePlus imp = NewImage.createFloatImage("test", 300, 200, 1,
> NewImage.FILL_BLACK);
> imp.getProcessor().setThreshold(1d, 500.0d, ImageProcessor.RED_LUT);
> WindowManager.setTempCurrentImage(imp);
> IJ.run("NaN Background");
> System.out.println(imp.getProcessor().getf(0, 0));
>
> You have to use a method with a float result like getf or getPixelValue,
> since if the return type is int the NaN will automatically be converted
> into 0 of type int.
>
> Volker
>
> erwan bocher a écrit :
> > Hi,
> >
> > Thank you but it doesn't work.
> >
> > I obtain the value 0 for the pixel. If I use imp.show() the pixel value
> is
> > NaN.
> >
> > R1.
> >
> > 2007/8/30, Volker Bäcker <[hidden email]>:
> >> Try WindowManager.setTempCurrentImage(imp) instead of imp.show();
> >>
> >> Volker
> >>
> >> erwan bocher a écrit :
> >>> Dear all,
> >>>
> >>> I try to set a NaN value to my image.
> >>>
> >>> I use this
> >>>
> >>> ip.setThreshold(0.0d, 500.0d, ImageProcessor.RED_LUT);
> >>>
> >>>  ImagePlus imp = new ImagePlus("",ip);
> >>> imp.show();
> >>>  IJ.run("NaN Background");
> >>>
> >>> It works fine but I don't want to show the imagePlus.
> >>>
> >>> Is it another way to do this ?
> >>>
> >>> Thanks
> >>>
> >>> R1.
> >>>
> >>> Ps :  I use this code in a java application.
> >>>
> >> --
> >> passerelle antivirus du campus CNRS de Montpellier
> >> --
> >>
> >
> >
> >
>
> --
> passerelle antivirus du campus CNRS de Montpellier
> --
>



--
Ingénieur de recherche
Docteur en géographie,
spécialité géomatique
École Centrale de Nantes
Institut de recherche en sciences et techniques de la ville
http://www.irstv.cnrs.fr/
http://geosysin.iict.ch/irstv-trac/wiki
http://r1.bocher.free.fr
http://www.projet-sigle.org