Replace one value by NaN

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

Replace one value by NaN

ebocher
Dear,

I'd like to replace a value in my image by NaN.
Currently I use this method :

ip.setThreshold(0.0d, 500.0d, ImageProcessor.NO_LUT_UPDATE);
       
ImagePlus imp = new ImagePlus("",ip);
               
               
                WindowManager.setTempCurrentImage(imp);
                IJ.run("NaN Background");
                       
                imp.show();

Is it possible to replace only one pixel value ?

R1.


--
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: Replace one value by NaN

Michael Schmid
Hi Erwan,

if you always have a FloatProcessor (lets call it fp),
it should be easy:

        float[] pixels = (float[])fp.getPixels();
        float specialValue = 11.1; //the value you want to replace
        for (int i=0; i<pixels.length; i++)
                if (pixels[i] == specialValue)
  pixels[i] = Float.NaN;

Michael
________________________________________________________________

On 4 Sep 2007, at 16:29, erwan bocher wrote:

> Dear,
>
> I'd like to replace a value in my image by NaN.
> Currently I use this method :
>
> ip.setThreshold(0.0d, 500.0d, ImageProcessor.NO_LUT_UPDATE);
>
> ImagePlus imp = new ImagePlus("",ip);
>
>
> WindowManager.setTempCurrentImage(imp);
> IJ.run("NaN Background");
>
> imp.show();
>
> Is it possible to replace only one pixel value ?
>
> R1.
Reply | Threaded
Open this post in threaded view
|

Re: Replace one value by NaN

Wayne Rasband
In reply to this post by ebocher
How about something like this

     float[] pixels = (float[])ip.getPixels();
     for (int i=0; i<pixels.length; i++)
         if (pixels[i]==100f) pixels[i] = Float.NaN;

which replaces the value 100 by NaN.

-wayne

On Sep 4, 2007, at 10:29 AM, erwan bocher wrote:

> Dear,
>
> I'd like to replace a value in my image by NaN.
> Currently I use this method :
>
> ip.setThreshold(0.0d, 500.0d, ImageProcessor.NO_LUT_UPDATE);
>
> ImagePlus imp = new ImagePlus("",ip);
>
>
> WindowManager.setTempCurrentImage(imp);
> IJ.run("NaN Background");
>
> imp.show();
>
> Is it possible to replace only one pixel value ?
>
> R1.
>
>
> --
> 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: Replace one value by NaN

ebocher
Dear,

Thank you.

R1.


Le 04/09/07, Wayne Rasband<[hidden email]> a écrit :

> How about something like this
>
>      float[] pixels = (float[])ip.getPixels();
>      for (int i=0; i<pixels.length; i++)
>          if (pixels[i]==100f) pixels[i] = Float.NaN;
>
> which replaces the value 100 by NaN.
>
> -wayne
>
> On Sep 4, 2007, at 10:29 AM, erwan bocher wrote:
>
> > Dear,
> >
> > I'd like to replace a value in my image by NaN.
> > Currently I use this method :
> >
> > ip.setThreshold(0.0d, 500.0d, ImageProcessor.NO_LUT_UPDATE);
> >
> > ImagePlus imp = new ImagePlus("",ip);
> >
> >
> >               WindowManager.setTempCurrentImage(imp);
> >               IJ.run("NaN Background");
> >
> >               imp.show();
> >
> > Is it possible to replace only one pixel value ?
> >
> > R1.
> >
> >
> > --
> > 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
> >
>


--
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
|

Q: Definition of densitometry (probably very academic)

Wolfgang Schechinger
Dear experts,

I am in some sort of dispute about the correct definition of "densitometry" and need your help:

Mine is: When you have e.g. some spots in an image (talking about western blots) and you use ImageJ for quantification, then what you are doing is densitometry as scanning / recording an image (which actually is photometry) and then measuring the intensity of a spot is nothing but combining lots of densitometric measurements into a result.

The other opinion is that densitometry only refers do direct analysis e.g. of an xray film (where the spots are on) or a membrane which carries some fluorescent spots, by a device (sort of scanner is allowed) which directly delivers you a figure representing the optical density at a certain position / of a certain spot you have marked on a screen before.
 
I think that this opinion is missing is the fact that any scanned image actually is an array of photometric data just waiting to be analyzed by densitometry, maybe just on another device / with another software.

What do you think?

Many thanks!

Wo
--
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
Reply | Threaded
Open this post in threaded view
|

Re: Q: Definition of densitometry (probably very academic)

Michael Cammer
The real experts may step in to correct me or to elaborate, but
essentially measuring fluorescence is a linear relationship between # of
molecules and intensity.  However, densitometry is the measurement of
absorbence by a density and/or thickness of material and this is a natural
log function that is conventionally expressed as a log10 function.  e.g.
http://www.aecom.yu.edu/aif/instructions/AGFA_scanner/scan_cal.htm
-Michael



> Dear experts,
>
> I am in some sort of dispute about the correct definition of
> "densitometry" and need your help:
>
> Mine is: When you have e.g. some spots in an image (talking about western
> blots) and you use ImageJ for quantification, then what you are doing is
> densitometry as scanning / recording an image (which actually is
> photometry) and then measuring the intensity of a spot is nothing but
> combining lots of densitometric measurements into a result.
>
> The other opinion is that densitometry only refers do direct analysis e.g.
> of an xray film (where the spots are on) or a membrane which carries some
> fluorescent spots, by a device (sort of scanner is allowed) which directly
> delivers you a figure representing the optical density at a certain
> position / of a certain spot you have marked on a screen before.
>
> I think that this opinion is missing is the fact that any scanned image
> actually is an array of photometric data just waiting to be analyzed by
> densitometry, maybe just on another device / with another software.
>
> What do you think?
>
> Many thanks!
>
> Wo
> --
> Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
> Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
>


_________________________________________
Michael Cammer   http://www.aecom.yu.edu/aif/