Calculate the concentration in a CT image

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

Calculate the concentration in a CT image

Yongqiang Chen
Dear ImageJ experts,

I am processing a CT image. They have two different brines mixed together. One fluid is high CT number. Its concentration is 2mol/L (KI doped). Another brine is pure water and its CT number is low.

I want to relate the CT number to the concentration value. (Let's assume that the brightest part is 2 mol/L fluid and pure water is lowest CT number)

Can anybody help me with the above question?


Thank you very much.

Regards,
Yongqiang

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

Re: Calculate the concentration in a CT image

Kenneth Sloan-2
Knowing nothing about this particular application, I will assume nothing.

So far, you seem to have two pairs of (CT Number, concentration):

        (loCT, loConcentration)
        (hiCT, hiConcentration)

You want to convert intermediate (or more extreme?) CT numbers into concentrations.

Method a) assume everything is linear, and just use linear interpolation:

          u = (CT-loCT) / (hiCT-loCT)
          CT = loConcentration + (u  * (hiConcentration-loConcentration))

I DO NOT RECOMMEND this method!


Method b) gather more data - measure CT numbers for known concentrations, fit a function to your measurements,
            and evaluate this function at new measured CT numbers.

I might start by measuring the CT number for (loConcentration + hiConcentration)/2.  If (by some miracle)
this turns out to be = (loCT + hiCT) / 2, then go to Method a)  Otherwise, measure at ¼ and ¾.  Continue
sub-dividing until you are happy with a low-degree polynomial that fits your data.

The usual caveats about fitting a predictor to data apply -  in particular, it is dangerous to EXTRAPOLATE from
the measured values.  Interpolation is much safer.  And, avoid high-degree polynomials which may overfit your data.

Also consider exponential/log functions.  If you know anything about the physics of the imaging, use that.

--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.




>  
>
> I am processing a CT image. They have two different brines mixed together. One fluid is high CT number. Its concentration is 2mol/L (KI doped). Another brine is pure water and its CT number is low.
>
> I want to relate the CT number to the concentration value. (Let's assume that the brightest part is 2 mol/L fluid and pure water is lowest CT number)
>
> Can anybody help me with the above question?
>  

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

Re: Calculate the concentration in a CT image

Stein Rørvik
Yes this is doable as per Kenneth's explanation, but you really need to understand the physics involved in your imaging.

If you are using monochromatic X-rays (from a synchrotron) and your software's "CT number" is proportional to your material's linear attenuation coefficient, then the simple linear interpolation "method a" will work. As this is quite unlikely (you probably have a polychromatic source if you are using an in-house CT system), it greatly depends on whether or not your elements distribution is radially symmetric in all directions. The reason for this is that the X-rays loose energy as they pass through the sample, so the apparent concentration in the central parts will be lower than in the outer parts. This phenomenon is called "beam hardening". You can compensate this with X-Ray filtering, or software corrections (if the distribution is symmetric). My experience is that software corrections work better, as filtering really kills the signal noise ratio. Anyway your CT software must still be calculating the attenuation coefficients correctly, and that greatly depends on how clever your software is.

This is in any case easy to check: Just scan a round plastic container with pure KI brine, and then check the radial profile. Is it flat?  If yes, then "method b" should work; it probably needs an exponential profile. If it is not flat, you must revise your imaging setup and/or your CT software processing settings. If the KI profile is flat, repeat the experiment with pure water. If that is flat too, even "method a" should work. If KI is your heaviest compound in your system and the overall concentration is low, and all your other elements are light (low atomic numbers), then "method a" might also work even if the test profiles for KI is not flat. But again that will depend on your elements' distribution in the sample and the symmetry of everything. So again you need to understand the X-Ray imaging physics and how it applies to your sample.

It will help if you post some example images, including all instrument related metadata. Also please tell what instrument and what software you are using for the generation of the CT images. I have considerable experience with such measurements from µCT images so I should be able to see if your images are analyzable or not.

Stein

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Kenneth Sloan
Sent: 7. november 2019 21:35
To: [hidden email]
Subject: Re: Calculate the concentration in a CT image

Knowing nothing about this particular application, I will assume nothing.

So far, you seem to have two pairs of (CT Number, concentration):

        (loCT, loConcentration)
        (hiCT, hiConcentration)

You want to convert intermediate (or more extreme?) CT numbers into concentrations.

Method a) assume everything is linear, and just use linear interpolation:

          u = (CT-loCT) / (hiCT-loCT)
          CT = loConcentration + (u  * (hiConcentration-loConcentration))

I DO NOT RECOMMEND this method!


Method b) gather more data - measure CT numbers for known concentrations, fit a function to your measurements,
            and evaluate this function at new measured CT numbers.

I might start by measuring the CT number for (loConcentration + hiConcentration)/2.  If (by some miracle) this turns out to be = (loCT + hiCT) / 2, then go to Method a)  Otherwise, measure at ¼ and ¾.  Continue sub-dividing until you are happy with a low-degree polynomial that fits your data.

The usual caveats about fitting a predictor to data apply -  in particular, it is dangerous to EXTRAPOLATE from the measured values.  Interpolation is much safer.  And, avoid high-degree polynomials which may overfit your data.

Also consider exponential/log functions.  If you know anything about the physics of the imaging, use that.

--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.




>  
>
> I am processing a CT image. They have two different brines mixed together. One fluid is high CT number. Its concentration is 2mol/L (KI doped). Another brine is pure water and its CT number is low.
>
> I want to relate the CT number to the concentration value. (Let's
> assume that the brightest part is 2 mol/L fluid and pure water is
> lowest CT number)
>
> Can anybody help me with the above question?
>  

--
ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=02%7C01%7Cstein.rorvik%40sintef.no%7Cf22112f0eb0844a6569708d763c37804%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637087563501115145&amp;sdata=XFl%2FV1LOQkf2E3QxibNVnO32vSvvk38lss%2Bs07lT3w8%3D&amp;reserved=0

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

Re: Calculate the concentration in a CT image

Yongqiang Chen
Hi Kenneth and Stein,

Thank you for your kind replies.

To summarize the problem in one sentence, it is to replace the CT number with concentration value or whatever else we want.
I believe interpolation can work. Could you please give me some hints for interpolation implement in ImageJ (or to replace CT number with concentration.)?

Thank you so much.
Yongqiang

-----Original Message-----
From: Stein Rørvik <[hidden email]>
Sent: 08 November 2019 01:54
To: [hidden email]
Subject: Re: Calculate the concentration in a CT image

Yes this is doable as per Kenneth's explanation, but you really need to understand the physics involved in your imaging.

If you are using monochromatic X-rays (from a synchrotron) and your software's "CT number" is proportional to your material's linear attenuation coefficient, then the simple linear interpolation "method a" will work. As this is quite unlikely (you probably have a polychromatic source if you are using an in-house CT system), it greatly depends on whether or not your elements distribution is radially symmetric in all directions. The reason for this is that the X-rays loose energy as they pass through the sample, so the apparent concentration in the central parts will be lower than in the outer parts. This phenomenon is called "beam hardening". You can compensate this with X-Ray filtering, or software corrections (if the distribution is symmetric). My experience is that software corrections work better, as filtering really kills the signal noise ratio. Anyway your CT software must still be calculating the attenuation coefficients correctly, and that greatly depends on how clever your software is.

This is in any case easy to check: Just scan a round plastic container with pure KI brine, and then check the radial profile. Is it flat?  If yes, then "method b" should work; it probably needs an exponential profile. If it is not flat, you must revise your imaging setup and/or your CT software processing settings. If the KI profile is flat, repeat the experiment with pure water. If that is flat too, even "method a" should work. If KI is your heaviest compound in your system and the overall concentration is low, and all your other elements are light (low atomic numbers), then "method a" might also work even if the test profiles for KI is not flat. But again that will depend on your elements' distribution in the sample and the symmetry of everything. So again you need to understand the X-Ray imaging physics and how it applies to your sample.

It will help if you post some example images, including all instrument related metadata. Also please tell what instrument and what software you are using for the generation of the CT images. I have considerable experience with such measurements from µCT images so I should be able to see if your images are analyzable or not.

Stein

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Kenneth Sloan
Sent: 7. november 2019 21:35
To: [hidden email]
Subject: Re: Calculate the concentration in a CT image

Knowing nothing about this particular application, I will assume nothing.

So far, you seem to have two pairs of (CT Number, concentration):

        (loCT, loConcentration)
        (hiCT, hiConcentration)

You want to convert intermediate (or more extreme?) CT numbers into concentrations.

Method a) assume everything is linear, and just use linear interpolation:

          u = (CT-loCT) / (hiCT-loCT)
          CT = loConcentration + (u  * (hiConcentration-loConcentration))

I DO NOT RECOMMEND this method!


Method b) gather more data - measure CT numbers for known concentrations, fit a function to your measurements,
            and evaluate this function at new measured CT numbers.

I might start by measuring the CT number for (loConcentration + hiConcentration)/2.  If (by some miracle) this turns out to be = (loCT + hiCT) / 2, then go to Method a)  Otherwise, measure at ¼ and ¾.  Continue sub-dividing until you are happy with a low-degree polynomial that fits your data.

The usual caveats about fitting a predictor to data apply -  in particular, it is dangerous to EXTRAPOLATE from the measured values.  Interpolation is much safer.  And, avoid high-degree polynomials which may overfit your data.

Also consider exponential/log functions.  If you know anything about the physics of the imaging, use that.

--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.




>  
>
> I am processing a CT image. They have two different brines mixed together. One fluid is high CT number. Its concentration is 2mol/L (KI doped). Another brine is pure water and its CT number is low.
>
> I want to relate the CT number to the concentration value. (Let's
> assume that the brightest part is 2 mol/L fluid and pure water is
> lowest CT number)
>
> Can anybody help me with the above question?
>  

--
ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=02%7C01%7Cstein.rorvik%40sintef.no%7Cf22112f0eb0844a6569708d763c37804%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637087563501115145&amp;sdata=XFl%2FV1LOQkf2E3QxibNVnO32vSvvk38lss%2Bs07lT3w8%3D&amp;reserved=0

--
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: Calculate the concentration in a CT image

Yongqiang Chen
In reply to this post by Stein Rørvik
Some supplementary information,

The data is from Diamond Light Source, England, UK. It is synchrotron X-rays. I don't know the software they used for reconstruction. Maybe it is DAWN (https://dawnsci.org/ ) or other their own software.

Cheers,
Yongqiang

-----Original Message-----
From: Stein Rørvik <[hidden email]>
Sent: 08 November 2019 01:54
To: [hidden email]
Subject: Re: Calculate the concentration in a CT image

Yes this is doable as per Kenneth's explanation, but you really need to understand the physics involved in your imaging.

If you are using monochromatic X-rays (from a synchrotron) and your software's "CT number" is proportional to your material's linear attenuation coefficient, then the simple linear interpolation "method a" will work. As this is quite unlikely (you probably have a polychromatic source if you are using an in-house CT system), it greatly depends on whether or not your elements distribution is radially symmetric in all directions. The reason for this is that the X-rays loose energy as they pass through the sample, so the apparent concentration in the central parts will be lower than in the outer parts. This phenomenon is called "beam hardening". You can compensate this with X-Ray filtering, or software corrections (if the distribution is symmetric). My experience is that software corrections work better, as filtering really kills the signal noise ratio. Anyway your CT software must still be calculating the attenuation coefficients correctly, and that greatly depends on how clever your software is.

This is in any case easy to check: Just scan a round plastic container with pure KI brine, and then check the radial profile. Is it flat?  If yes, then "method b" should work; it probably needs an exponential profile. If it is not flat, you must revise your imaging setup and/or your CT software processing settings. If the KI profile is flat, repeat the experiment with pure water. If that is flat too, even "method a" should work. If KI is your heaviest compound in your system and the overall concentration is low, and all your other elements are light (low atomic numbers), then "method a" might also work even if the test profiles for KI is not flat. But again that will depend on your elements' distribution in the sample and the symmetry of everything. So again you need to understand the X-Ray imaging physics and how it applies to your sample.

It will help if you post some example images, including all instrument related metadata. Also please tell what instrument and what software you are using for the generation of the CT images. I have considerable experience with such measurements from µCT images so I should be able to see if your images are analyzable or not.

Stein

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Kenneth Sloan
Sent: 7. november 2019 21:35
To: [hidden email]
Subject: Re: Calculate the concentration in a CT image

Knowing nothing about this particular application, I will assume nothing.

So far, you seem to have two pairs of (CT Number, concentration):

        (loCT, loConcentration)
        (hiCT, hiConcentration)

You want to convert intermediate (or more extreme?) CT numbers into concentrations.

Method a) assume everything is linear, and just use linear interpolation:

          u = (CT-loCT) / (hiCT-loCT)
          CT = loConcentration + (u  * (hiConcentration-loConcentration))

I DO NOT RECOMMEND this method!


Method b) gather more data - measure CT numbers for known concentrations, fit a function to your measurements,
            and evaluate this function at new measured CT numbers.

I might start by measuring the CT number for (loConcentration + hiConcentration)/2.  If (by some miracle) this turns out to be = (loCT + hiCT) / 2, then go to Method a)  Otherwise, measure at ¼ and ¾.  Continue sub-dividing until you are happy with a low-degree polynomial that fits your data.

The usual caveats about fitting a predictor to data apply -  in particular, it is dangerous to EXTRAPOLATE from the measured values.  Interpolation is much safer.  And, avoid high-degree polynomials which may overfit your data.

Also consider exponential/log functions.  If you know anything about the physics of the imaging, use that.

--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.




>  
>
> I am processing a CT image. They have two different brines mixed together. One fluid is high CT number. Its concentration is 2mol/L (KI doped). Another brine is pure water and its CT number is low.
>
> I want to relate the CT number to the concentration value. (Let's
> assume that the brightest part is 2 mol/L fluid and pure water is
> lowest CT number)
>
> Can anybody help me with the above question?
>  

--
ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=02%7C01%7Cstein.rorvik%40sintef.no%7Cf22112f0eb0844a6569708d763c37804%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637087563501115145&amp;sdata=XFl%2FV1LOQkf2E3QxibNVnO32vSvvk38lss%2Bs07lT3w8%3D&amp;reserved=0

--
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: Calculate the concentration in a CT image

Gabriel Landini
On Friday, 8 November 2019 07:53:34 GMT Yongqiang Chen wrote:
> The data is from Diamond Light Source, England, UK. It is synchrotron
> X-rays. I don't know the software they used for reconstruction. Maybe it is
> DAWN (https://dawnsci.org/ ) or other their own software.
 
Well, lots of unknowns there... I would encourage you to talk to the resident
scientists associated with that particular experiment at Diamond. They do this
all the time and should know exactly what you need. You might be missing all
sorts of details and corrections applied to the data.

Cheers

Gabriel

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

Re: Calculate the concentration in a CT image

Mauro Maiorca
In reply to this post by Yongqiang Chen
Dear Yongqiang,

I understand you are aiming to linearly rescale intensity values in the
image using ImageJ.

I will give you an example of how I would do it, and you can adapt it to
your specific problem.

Assuming you want to convert your recorded "CT number" values to Hounsfield
Unit, and (as an example) you are using the conversion formula described on
wikipedia (https://en.wikipedia.org/wiki/Hounsfield_scale):
HU=1000*(mu-mu_water)/(mu_water-mu_air)
Assuming your recorded mu_water is 15, and your recorded mu_air is -1100:
HU=1000*(mu-15)/(15+1100)= (1000/1115)*(mu-15) = 0.897*(mu-15)
Open your image with ImageJ,
go to Process>Math>Subtract, put value 15 and click OK
go to Process>Math>Multiply, put value 0.897 and click OK
The intensity values in the image are now linearly rescaled.

Is this what you were looking for?

cheers,
Mauro


On Fri, Nov 8, 2019 at 7:45 AM Yongqiang Chen <
[hidden email]> wrote:

> Hi Kenneth and Stein,
>
> Thank you for your kind replies.
>
> To summarize the problem in one sentence, it is to replace the CT number
> with concentration value or whatever else we want.
> I believe interpolation can work. Could you please give me some hints for
> interpolation implement in ImageJ (or to replace CT number with
> concentration.)?
>
> Thank you so much.
> Yongqiang
>
> -----Original Message-----
> From: Stein Rørvik <[hidden email]>
> Sent: 08 November 2019 01:54
> To: [hidden email]
> Subject: Re: Calculate the concentration in a CT image
>
> Yes this is doable as per Kenneth's explanation, but you really need to
> understand the physics involved in your imaging.
>
> If you are using monochromatic X-rays (from a synchrotron) and your
> software's "CT number" is proportional to your material's linear
> attenuation coefficient, then the simple linear interpolation "method a"
> will work. As this is quite unlikely (you probably have a polychromatic
> source if you are using an in-house CT system), it greatly depends on
> whether or not your elements distribution is radially symmetric in all
> directions. The reason for this is that the X-rays loose energy as they
> pass through the sample, so the apparent concentration in the central parts
> will be lower than in the outer parts. This phenomenon is called "beam
> hardening". You can compensate this with X-Ray filtering, or software
> corrections (if the distribution is symmetric). My experience is that
> software corrections work better, as filtering really kills the signal
> noise ratio. Anyway your CT software must still be calculating the
> attenuation coefficients correctly, and that greatly depends on how clever
> your software is.
>
> This is in any case easy to check: Just scan a round plastic container
> with pure KI brine, and then check the radial profile. Is it flat?  If yes,
> then "method b" should work; it probably needs an exponential profile. If
> it is not flat, you must revise your imaging setup and/or your CT software
> processing settings. If the KI profile is flat, repeat the experiment with
> pure water. If that is flat too, even "method a" should work. If KI is your
> heaviest compound in your system and the overall concentration is low, and
> all your other elements are light (low atomic numbers), then "method a"
> might also work even if the test profiles for KI is not flat. But again
> that will depend on your elements' distribution in the sample and the
> symmetry of everything. So again you need to understand the X-Ray imaging
> physics and how it applies to your sample.
>
> It will help if you post some example images, including all instrument
> related metadata. Also please tell what instrument and what software you
> are using for the generation of the CT images. I have considerable
> experience with such measurements from µCT images so I should be able to
> see if your images are analyzable or not.
>
> Stein
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Kenneth
> Sloan
> Sent: 7. november 2019 21:35
> To: [hidden email]
> Subject: Re: Calculate the concentration in a CT image
>
> Knowing nothing about this particular application, I will assume nothing.
>
> So far, you seem to have two pairs of (CT Number, concentration):
>
>         (loCT, loConcentration)
>         (hiCT, hiConcentration)
>
> You want to convert intermediate (or more extreme?) CT numbers into
> concentrations.
>
> Method a) assume everything is linear, and just use linear interpolation:
>
>           u = (CT-loCT) / (hiCT-loCT)
>           CT = loConcentration + (u  * (hiConcentration-loConcentration))
>
> I DO NOT RECOMMEND this method!
>
>
> Method b) gather more data - measure CT numbers for known concentrations,
> fit a function to your measurements,
>             and evaluate this function at new measured CT numbers.
>
> I might start by measuring the CT number for (loConcentration +
> hiConcentration)/2.  If (by some miracle) this turns out to be = (loCT +
> hiCT) / 2, then go to Method a)  Otherwise, measure at ¼ and ¾.  Continue
> sub-dividing until you are happy with a low-degree polynomial that fits
> your data.
>
> The usual caveats about fitting a predictor to data apply -  in
> particular, it is dangerous to EXTRAPOLATE from the measured values.
> Interpolation is much safer.  And, avoid high-degree polynomials which may
> overfit your data.
>
> Also consider exponential/log functions.  If you know anything about the
> physics of the imaging, use that.
>
> --
> Kenneth Sloan
> [hidden email]
> Vision is the art of seeing what is invisible to others.
>
>
>
>
> >
> >
> > I am processing a CT image. They have two different brines mixed
> together. One fluid is high CT number. Its concentration is 2mol/L (KI
> doped). Another brine is pure water and its CT number is low.
> >
> > I want to relate the CT number to the concentration value. (Let's
> > assume that the brightest part is 2 mol/L fluid and pure water is
> > lowest CT number)
> >
> > Can anybody help me with the above question?
> >
>
> --
> ImageJ mailing list:
> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=02%7C01%7Cstein.rorvik%40sintef.no%7Cf22112f0eb0844a6569708d763c37804%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637087563501115145&amp;sdata=XFl%2FV1LOQkf2E3QxibNVnO32vSvvk38lss%2Bs07lT3w8%3D&amp;reserved=0
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> 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: Calculate the concentration in a CT image

Yongqiang Chen
Dear Mauro,

Thank you so much.
Yes, I think it is a right direction.

Do you have any idea to handle the non-linear relationship? I just got their scanning information. They did calibration scanning with different concentration of KI in water. So the data need to be fitted to get the relation between CT number and (most probably it's not a linear relation).

In the Process->Math, to use other operator, like log, exp or square, to do it?


Cheers,
Yongqiang

-----Original Message-----
From: Mauro Maiorca <[hidden email]>
Sent: 08 November 2019 12:40
To: [hidden email]
Subject: Re: Calculate the concentration in a CT image

Dear Yongqiang,

I understand you are aiming to linearly rescale intensity values in the image using ImageJ.

I will give you an example of how I would do it, and you can adapt it to your specific problem.

Assuming you want to convert your recorded "CT number" values to Hounsfield Unit, and (as an example) you are using the conversion formula described on wikipedia (https://en.wikipedia.org/wiki/Hounsfield_scale):
HU=1000*(mu-mu_water)/(mu_water-mu_air)
Assuming your recorded mu_water is 15, and your recorded mu_air is -1100:
HU=1000*(mu-15)/(15+1100)= (1000/1115)*(mu-15) = 0.897*(mu-15) Open your image with ImageJ, go to Process>Math>Subtract, put value 15 and click OK go to Process>Math>Multiply, put value 0.897 and click OK The intensity values in the image are now linearly rescaled.

Is this what you were looking for?

cheers,
Mauro


On Fri, Nov 8, 2019 at 7:45 AM Yongqiang Chen < [hidden email]> wrote:

> Hi Kenneth and Stein,
>
> Thank you for your kind replies.
>
> To summarize the problem in one sentence, it is to replace the CT
> number with concentration value or whatever else we want.
> I believe interpolation can work. Could you please give me some hints
> for interpolation implement in ImageJ (or to replace CT number with
> concentration.)?
>
> Thank you so much.
> Yongqiang
>
> -----Original Message-----
> From: Stein Rørvik <[hidden email]>
> Sent: 08 November 2019 01:54
> To: [hidden email]
> Subject: Re: Calculate the concentration in a CT image
>
> Yes this is doable as per Kenneth's explanation, but you really need
> to understand the physics involved in your imaging.
>
> If you are using monochromatic X-rays (from a synchrotron) and your
> software's "CT number" is proportional to your material's linear
> attenuation coefficient, then the simple linear interpolation "method a"
> will work. As this is quite unlikely (you probably have a
> polychromatic source if you are using an in-house CT system), it
> greatly depends on whether or not your elements distribution is
> radially symmetric in all directions. The reason for this is that the
> X-rays loose energy as they pass through the sample, so the apparent
> concentration in the central parts will be lower than in the outer
> parts. This phenomenon is called "beam hardening". You can compensate
> this with X-Ray filtering, or software corrections (if the
> distribution is symmetric). My experience is that software corrections
> work better, as filtering really kills the signal noise ratio. Anyway
> your CT software must still be calculating the attenuation
> coefficients correctly, and that greatly depends on how clever your software is.
>
> This is in any case easy to check: Just scan a round plastic container
> with pure KI brine, and then check the radial profile. Is it flat?  If
> yes, then "method b" should work; it probably needs an exponential
> profile. If it is not flat, you must revise your imaging setup and/or
> your CT software processing settings. If the KI profile is flat,
> repeat the experiment with pure water. If that is flat too, even
> "method a" should work. If KI is your heaviest compound in your system
> and the overall concentration is low, and all your other elements are light (low atomic numbers), then "method a"
> might also work even if the test profiles for KI is not flat. But
> again that will depend on your elements' distribution in the sample
> and the symmetry of everything. So again you need to understand the
> X-Ray imaging physics and how it applies to your sample.
>
> It will help if you post some example images, including all instrument
> related metadata. Also please tell what instrument and what software
> you are using for the generation of the CT images. I have considerable
> experience with such measurements from µCT images so I should be able
> to see if your images are analyzable or not.
>
> Stein
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Kenneth
> Sloan
> Sent: 7. november 2019 21:35
> To: [hidden email]
> Subject: Re: Calculate the concentration in a CT image
>
> Knowing nothing about this particular application, I will assume nothing.
>
> So far, you seem to have two pairs of (CT Number, concentration):
>
>         (loCT, loConcentration)
>         (hiCT, hiConcentration)
>
> You want to convert intermediate (or more extreme?) CT numbers into
> concentrations.
>
> Method a) assume everything is linear, and just use linear interpolation:
>
>           u = (CT-loCT) / (hiCT-loCT)
>           CT = loConcentration + (u  *
> (hiConcentration-loConcentration))
>
> I DO NOT RECOMMEND this method!
>
>
> Method b) gather more data - measure CT numbers for known
> concentrations, fit a function to your measurements,
>             and evaluate this function at new measured CT numbers.
>
> I might start by measuring the CT number for (loConcentration +
> hiConcentration)/2.  If (by some miracle) this turns out to be = (loCT
> +
> hiCT) / 2, then go to Method a)  Otherwise, measure at ¼ and ¾.  
> Continue sub-dividing until you are happy with a low-degree polynomial
> that fits your data.
>
> The usual caveats about fitting a predictor to data apply -  in
> particular, it is dangerous to EXTRAPOLATE from the measured values.
> Interpolation is much safer.  And, avoid high-degree polynomials which
> may overfit your data.
>
> Also consider exponential/log functions.  If you know anything about
> the physics of the imaging, use that.
>
> --
> Kenneth Sloan
> [hidden email]
> Vision is the art of seeing what is invisible to others.
>
>
>
>
> >
> >
> > I am processing a CT image. They have two different brines mixed
> together. One fluid is high CT number. Its concentration is 2mol/L (KI
> doped). Another brine is pure water and its CT number is low.
> >
> > I want to relate the CT number to the concentration value. (Let's
> > assume that the brightest part is 2 mol/L fluid and pure water is
> > lowest CT number)
> >
> > Can anybody help me with the above question?
> >
>
> --
> ImageJ mailing list:
> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimage
> j.nih.gov%2Fij%2Flist.html&amp;data=02%7C01%7Cstein.rorvik%40sintef.no
> %7Cf22112f0eb0844a6569708d763c37804%7Ce1f00f39604145b0b309e0210d8b32af
> %7C1%7C0%7C637087563501115145&amp;sdata=XFl%2FV1LOQkf2E3QxibNVnO32vSvv
> k38lss%2Bs07lT3w8%3D&amp;reserved=0
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
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: Calculate the concentration in a CT image

Stein Rørvik
Since you say the data is from a synchrotron, that makes things a whole lot easier, assuming that the X-Rays are monochromatic. In that case, the complications in the physics of the imaging I mentioned in my post do not apply. There should be a direct and reliable relationship between the brine concentration and the image greylevels.

All you need to do in ImageJ is to use the Calibrate... command. You enter your known values and measured values as two columns in the table, and then choose the desired type calibration function. Most likely it will be exponential, or maybe just a straight line if the pure water attenuation is very low. After you have done this, the image greylevels will be reported as concentration numbers instead of just the grey value.

Also, if the X-Rays are monochromatic you can calculate your expected attenuation values from the NIST database at https://physics.nist.gov/PhysRefData/Xcom/html/xcom1.html

State your X-Ray energy, calculate for water and high concentration brine and some intermediate values in between to check how the curve is shaped. (Remember that you need to take into account that the ions of KI are differently sized from water so the brine density is not necessarily proportional to the molar concentration. You can probably find a calculator for this too on the web.) You can this way compare the calibration data you got provided with the theoretical physics values. If these match, you can be pretty sure that you are doing things correctly.

Stein

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Yongqiang Chen
Sent: 8. november 2019 16:08
To: [hidden email]
Subject: Re: Calculate the concentration in a CT image

Dear Mauro,

Thank you so much.
Yes, I think it is a right direction.

Do you have any idea to handle the non-linear relationship? I just got their scanning information. They did calibration scanning with different concentration of KI in water. So the data need to be fitted to get the relation between CT number and (most probably it's not a linear relation).

In the Process->Math, to use other operator, like log, exp or square, to do it?


Cheers,
Yongqiang

-----Original Message-----
From: Mauro Maiorca <[hidden email]>
Sent: 08 November 2019 12:40
To: [hidden email]
Subject: Re: Calculate the concentration in a CT image

Dear Yongqiang,

I understand you are aiming to linearly rescale intensity values in the image using ImageJ.

I will give you an example of how I would do it, and you can adapt it to your specific problem.

Assuming you want to convert your recorded "CT number" values to Hounsfield Unit, and (as an example) you are using the conversion formula described on wikipedia (https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FHounsfield_scale&amp;data=02%7C01%7Cstein.rorvik%40sintef.no%7C39bd900e18994388535d08d7645db26d%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C1%7C637088225895074738&amp;sdata=uQPgoPYKki0e3uaSlEFv7FSqYQdqS3n8BkV7fJPDi2Q%3D&amp;reserved=0):
HU=1000*(mu-mu_water)/(mu_water-mu_air)
Assuming your recorded mu_water is 15, and your recorded mu_air is -1100:
HU=1000*(mu-15)/(15+1100)= (1000/1115)*(mu-15) = 0.897*(mu-15) Open your image with ImageJ, go to Process>Math>Subtract, put value 15 and click OK go to Process>Math>Multiply, put value 0.897 and click OK The intensity values in the image are now linearly rescaled.

Is this what you were looking for?

cheers,
Mauro


On Fri, Nov 8, 2019 at 7:45 AM Yongqiang Chen < [hidden email]> wrote:

> Hi Kenneth and Stein,
>
> Thank you for your kind replies.
>
> To summarize the problem in one sentence, it is to replace the CT
> number with concentration value or whatever else we want.
> I believe interpolation can work. Could you please give me some hints
> for interpolation implement in ImageJ (or to replace CT number with
> concentration.)?
>
> Thank you so much.
> Yongqiang
>
> -----Original Message-----
> From: Stein Rørvik <[hidden email]>
> Sent: 08 November 2019 01:54
> To: [hidden email]
> Subject: Re: Calculate the concentration in a CT image
>
> Yes this is doable as per Kenneth's explanation, but you really need
> to understand the physics involved in your imaging.
>
> If you are using monochromatic X-rays (from a synchrotron) and your
> software's "CT number" is proportional to your material's linear
> attenuation coefficient, then the simple linear interpolation "method a"
> will work. As this is quite unlikely (you probably have a
> polychromatic source if you are using an in-house CT system), it
> greatly depends on whether or not your elements distribution is
> radially symmetric in all directions. The reason for this is that the
> X-rays loose energy as they pass through the sample, so the apparent
> concentration in the central parts will be lower than in the outer
> parts. This phenomenon is called "beam hardening". You can compensate
> this with X-Ray filtering, or software corrections (if the
> distribution is symmetric). My experience is that software corrections
> work better, as filtering really kills the signal noise ratio. Anyway
> your CT software must still be calculating the attenuation
> coefficients correctly, and that greatly depends on how clever your software is.
>
> This is in any case easy to check: Just scan a round plastic container
> with pure KI brine, and then check the radial profile. Is it flat?  If
> yes, then "method b" should work; it probably needs an exponential
> profile. If it is not flat, you must revise your imaging setup and/or
> your CT software processing settings. If the KI profile is flat,
> repeat the experiment with pure water. If that is flat too, even
> "method a" should work. If KI is your heaviest compound in your system
> and the overall concentration is low, and all your other elements are light (low atomic numbers), then "method a"
> might also work even if the test profiles for KI is not flat. But
> again that will depend on your elements' distribution in the sample
> and the symmetry of everything. So again you need to understand the
> X-Ray imaging physics and how it applies to your sample.
>
> It will help if you post some example images, including all instrument
> related metadata. Also please tell what instrument and what software
> you are using for the generation of the CT images. I have considerable
> experience with such measurements from µCT images so I should be able
> to see if your images are analyzable or not.
>
> Stein
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Kenneth
> Sloan
> Sent: 7. november 2019 21:35
> To: [hidden email]
> Subject: Re: Calculate the concentration in a CT image
>
> Knowing nothing about this particular application, I will assume nothing.
>
> So far, you seem to have two pairs of (CT Number, concentration):
>
>         (loCT, loConcentration)
>         (hiCT, hiConcentration)
>
> You want to convert intermediate (or more extreme?) CT numbers into
> concentrations.
>
> Method a) assume everything is linear, and just use linear interpolation:
>
>           u = (CT-loCT) / (hiCT-loCT)
>           CT = loConcentration + (u  *
> (hiConcentration-loConcentration))
>
> I DO NOT RECOMMEND this method!
>
>
> Method b) gather more data - measure CT numbers for known
> concentrations, fit a function to your measurements,
>             and evaluate this function at new measured CT numbers.
>
> I might start by measuring the CT number for (loConcentration +
> hiConcentration)/2.  If (by some miracle) this turns out to be = (loCT
> +
> hiCT) / 2, then go to Method a)  Otherwise, measure at ¼ and ¾.  
> Continue sub-dividing until you are happy with a low-degree polynomial
> that fits your data.
>
> The usual caveats about fitting a predictor to data apply -  in
> particular, it is dangerous to EXTRAPOLATE from the measured values.
> Interpolation is much safer.  And, avoid high-degree polynomials which
> may overfit your data.
>
> Also consider exponential/log functions.  If you know anything about
> the physics of the imaging, use that.
>
> --
> Kenneth Sloan
> [hidden email]
> Vision is the art of seeing what is invisible to others.
>
>
>
>
> >
> >
> > I am processing a CT image. They have two different brines mixed
> together. One fluid is high CT number. Its concentration is 2mol/L (KI
> doped). Another brine is pure water and its CT number is low.
> >
> > I want to relate the CT number to the concentration value. (Let's
> > assume that the brightest part is 2 mol/L fluid and pure water is
> > lowest CT number)
> >
> > Can anybody help me with the above question?
> >
>
> --
> ImageJ mailing list:
> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimage
> j.nih.gov%2Fij%2Flist.html&amp;data=02%7C01%7Cstein.rorvik%40sintef.no
> %7Cf22112f0eb0844a6569708d763c37804%7Ce1f00f39604145b0b309e0210d8b32af
> %7C1%7C0%7C637087563501115145&amp;sdata=XFl%2FV1LOQkf2E3QxibNVnO32vSvv
> k38lss%2Bs07lT3w8%3D&amp;reserved=0
>
> --
> ImageJ mailing list:
> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimage
> j.nih.gov%2Fij%2Flist.html&amp;data=02%7C01%7Cstein.rorvik%40sintef.no
> %7C39bd900e18994388535d08d7645db26d%7Ce1f00f39604145b0b309e0210d8b32af
> %7C1%7C1%7C637088225895074738&amp;sdata=fDqT%2FVYT1kHH%2F6OtZNxPe7zSeT
> 48cDfnDSg8jy9IMbU%3D&amp;reserved=0
>
> --
> ImageJ mailing list:
> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimage
> j.nih.gov%2Fij%2Flist.html&amp;data=02%7C01%7Cstein.rorvik%40sintef.no
> %7C39bd900e18994388535d08d7645db26d%7Ce1f00f39604145b0b309e0210d8b32af
> %7C1%7C1%7C637088225895074738&amp;sdata=fDqT%2FVYT1kHH%2F6OtZNxPe7zSeT
> 48cDfnDSg8jy9IMbU%3D&amp;reserved=0
>

--
ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=02%7C01%7Cstein.rorvik%40sintef.no%7C39bd900e18994388535d08d7645db26d%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C1%7C637088225895074738&amp;sdata=fDqT%2FVYT1kHH%2F6OtZNxPe7zSeT48cDfnDSg8jy9IMbU%3D&amp;reserved=0

--
ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=02%7C01%7Cstein.rorvik%40sintef.no%7C39bd900e18994388535d08d7645db26d%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C1%7C637088225895074738&amp;sdata=fDqT%2FVYT1kHH%2F6OtZNxPe7zSeT48cDfnDSg8jy9IMbU%3D&amp;reserved=0

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

Re: Calculate the concentration in a CT image

CARL Philippe (LBP)
In reply to this post by Yongqiang Chen
Dear Yongqiang,
Within the Process->Math operations you have already several operators and especially the one you asked for, i.e. log, exp or square.
Nevertheless in the case you need to do even more fancy operations, you have always the macro getPixel(x, y) and setPixel(x, y, value) methods.
My best regards,
Philippe


Philippe CARL
Laboratoire de Bioimagerie et Pathologies
UMR 7021 CNRS - Université de Strasbourg
Faculté de Pharmacie
74 route du Rhin
67401 ILLKIRCH
Tel : +33(0)3 68 85 41 84

----- Mail original -----
De: "Yongqiang Chen" <[hidden email]>
À: "imagej" <[hidden email]>
Envoyé: Vendredi 8 Novembre 2019 16:07:30
Objet: Re: Calculate the concentration in a CT image

Dear Mauro,

Thank you so much.
Yes, I think it is a right direction.

Do you have any idea to handle the non-linear relationship? I just got their scanning information. They did calibration scanning with different concentration of KI in water. So the data need to be fitted to get the relation between CT number and (most probably it's not a linear relation).

In the Process->Math, to use other operator, like log, exp or square, to do it?


Cheers,
Yongqiang

-----Original Message-----
From: Mauro Maiorca <[hidden email]>
Sent: 08 November 2019 12:40
To: [hidden email]
Subject: Re: Calculate the concentration in a CT image

Dear Yongqiang,

I understand you are aiming to linearly rescale intensity values in the image using ImageJ.

I will give you an example of how I would do it, and you can adapt it to your specific problem.

Assuming you want to convert your recorded "CT number" values to Hounsfield Unit, and (as an example) you are using the conversion formula described on wikipedia (https://en.wikipedia.org/wiki/Hounsfield_scale):
HU=1000*(mu-mu_water)/(mu_water-mu_air)
Assuming your recorded mu_water is 15, and your recorded mu_air is -1100:
HU=1000*(mu-15)/(15+1100)= (1000/1115)*(mu-15) = 0.897*(mu-15) Open your image with ImageJ, go to Process>Math>Subtract, put value 15 and click OK go to Process>Math>Multiply, put value 0.897 and click OK The intensity values in the image are now linearly rescaled.

Is this what you were looking for?

cheers,
Mauro


On Fri, Nov 8, 2019 at 7:45 AM Yongqiang Chen < [hidden email]> wrote:

> Hi Kenneth and Stein,
>
> Thank you for your kind replies.
>
> To summarize the problem in one sentence, it is to replace the CT
> number with concentration value or whatever else we want.
> I believe interpolation can work. Could you please give me some hints
> for interpolation implement in ImageJ (or to replace CT number with
> concentration.)?
>
> Thank you so much.
> Yongqiang
>
> -----Original Message-----
> From: Stein Rørvik <[hidden email]>
> Sent: 08 November 2019 01:54
> To: [hidden email]
> Subject: Re: Calculate the concentration in a CT image
>
> Yes this is doable as per Kenneth's explanation, but you really need
> to understand the physics involved in your imaging.
>
> If you are using monochromatic X-rays (from a synchrotron) and your
> software's "CT number" is proportional to your material's linear
> attenuation coefficient, then the simple linear interpolation "method a"
> will work. As this is quite unlikely (you probably have a
> polychromatic source if you are using an in-house CT system), it
> greatly depends on whether or not your elements distribution is
> radially symmetric in all directions. The reason for this is that the
> X-rays loose energy as they pass through the sample, so the apparent
> concentration in the central parts will be lower than in the outer
> parts. This phenomenon is called "beam hardening". You can compensate
> this with X-Ray filtering, or software corrections (if the
> distribution is symmetric). My experience is that software corrections
> work better, as filtering really kills the signal noise ratio. Anyway
> your CT software must still be calculating the attenuation
> coefficients correctly, and that greatly depends on how clever your software is.
>
> This is in any case easy to check: Just scan a round plastic container
> with pure KI brine, and then check the radial profile. Is it flat?  If
> yes, then "method b" should work; it probably needs an exponential
> profile. If it is not flat, you must revise your imaging setup and/or
> your CT software processing settings. If the KI profile is flat,
> repeat the experiment with pure water. If that is flat too, even
> "method a" should work. If KI is your heaviest compound in your system
> and the overall concentration is low, and all your other elements are light (low atomic numbers), then "method a"
> might also work even if the test profiles for KI is not flat. But
> again that will depend on your elements' distribution in the sample
> and the symmetry of everything. So again you need to understand the
> X-Ray imaging physics and how it applies to your sample.
>
> It will help if you post some example images, including all instrument
> related metadata. Also please tell what instrument and what software
> you are using for the generation of the CT images. I have considerable
> experience with such measurements from µCT images so I should be able
> to see if your images are analyzable or not.
>
> Stein
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Kenneth
> Sloan
> Sent: 7. november 2019 21:35
> To: [hidden email]
> Subject: Re: Calculate the concentration in a CT image
>
> Knowing nothing about this particular application, I will assume nothing.
>
> So far, you seem to have two pairs of (CT Number, concentration):
>
>         (loCT, loConcentration)
>         (hiCT, hiConcentration)
>
> You want to convert intermediate (or more extreme?) CT numbers into
> concentrations.
>
> Method a) assume everything is linear, and just use linear interpolation:
>
>           u = (CT-loCT) / (hiCT-loCT)
>           CT = loConcentration + (u  *
> (hiConcentration-loConcentration))
>
> I DO NOT RECOMMEND this method!
>
>
> Method b) gather more data - measure CT numbers for known
> concentrations, fit a function to your measurements,
>             and evaluate this function at new measured CT numbers.
>
> I might start by measuring the CT number for (loConcentration +
> hiConcentration)/2.  If (by some miracle) this turns out to be = (loCT
> +
> hiCT) / 2, then go to Method a)  Otherwise, measure at ¼ and ¾.  
> Continue sub-dividing until you are happy with a low-degree polynomial
> that fits your data.
>
> The usual caveats about fitting a predictor to data apply -  in
> particular, it is dangerous to EXTRAPOLATE from the measured values.
> Interpolation is much safer.  And, avoid high-degree polynomials which
> may overfit your data.
>
> Also consider exponential/log functions.  If you know anything about
> the physics of the imaging, use that.
>
> --
> Kenneth Sloan
> [hidden email]
> Vision is the art of seeing what is invisible to others.
>
>
>
>
> >
> >
> > I am processing a CT image. They have two different brines mixed
> together. One fluid is high CT number. Its concentration is 2mol/L (KI
> doped). Another brine is pure water and its CT number is low.
> >
> > I want to relate the CT number to the concentration value. (Let's
> > assume that the brightest part is 2 mol/L fluid and pure water is
> > lowest CT number)
> >
> > Can anybody help me with the above question?
> >
>
> --
> ImageJ mailing list:
> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimage
> j.nih.gov%2Fij%2Flist.html&amp;data=02%7C01%7Cstein.rorvik%40sintef.no
> %7Cf22112f0eb0844a6569708d763c37804%7Ce1f00f39604145b0b309e0210d8b32af
> %7C1%7C0%7C637087563501115145&amp;sdata=XFl%2FV1LOQkf2E3QxibNVnO32vSvv
> k38lss%2Bs07lT3w8%3D&amp;reserved=0
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

--
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: Calculate the concentration in a CT image

Mauro Maiorca
In reply to this post by Yongqiang Chen
Dear Yongqian,

Thank you so much.
> Yes, I think it is a right direction.
>

that's good! ;-)


> Do you have any idea to handle the non-linear relationship? I just got
> their scanning information. They did calibration scanning with different
> concentration of KI in water. So the data need to be fitted to get the
> relation between CT number and (most probably it's not a linear relation).
>
> In the Process->Math, to use other operator, like log, exp or square, to
> do it?
>

yep, once you figure out the right formula to use, then you can translate
it to a cascade of operators (like log, exp or square, as you suggested),
and even write a macro if you want to automatise the procedure.
Furthermore, if in your formula you need more instances of the initial
image, you can go "image->duplicate" from the original image, and use
"process->Image Calculator" accordingly.

said that, although effective, this may not be the most elegant way to
proceed. As others suggested, you can use getPixel/setPixel macros, or you
can implement your own plugin, or you may consider rescaling your images
using external programs (for example using matlab/octave/python/etc ), and
so on.

cheers,
Mauro


-----Original Message-----

> From: Mauro Maiorca <[hidden email]>
> Sent: 08 November 2019 12:40
> To: [hidden email]
> Subject: Re: Calculate the concentration in a CT image
>
> Dear Yongqiang,
>
> I understand you are aiming to linearly rescale intensity values in the
> image using ImageJ.
>
> I will give you an example of how I would do it, and you can adapt it to
> your specific problem.
>
> Assuming you want to convert your recorded "CT number" values to
> Hounsfield Unit, and (as an example) you are using the conversion formula
> described on wikipedia (https://en.wikipedia.org/wiki/Hounsfield_scale):
> HU=1000*(mu-mu_water)/(mu_water-mu_air)
> Assuming your recorded mu_water is 15, and your recorded mu_air is -1100:
> HU=1000*(mu-15)/(15+1100)= (1000/1115)*(mu-15) = 0.897*(mu-15) Open your
> image with ImageJ, go to Process>Math>Subtract, put value 15 and click OK
> go to Process>Math>Multiply, put value 0.897 and click OK The intensity
> values in the image are now linearly rescaled.
>
> Is this what you were looking for?
>
> cheers,
> Mauro
>
>
> On Fri, Nov 8, 2019 at 7:45 AM Yongqiang Chen <
> [hidden email]> wrote:
>
> > Hi Kenneth and Stein,
> >
> > Thank you for your kind replies.
> >
> > To summarize the problem in one sentence, it is to replace the CT
> > number with concentration value or whatever else we want.
> > I believe interpolation can work. Could you please give me some hints
> > for interpolation implement in ImageJ (or to replace CT number with
> > concentration.)?
> >
> > Thank you so much.
> > Yongqiang
> >
> > -----Original Message-----
> > From: Stein Rørvik <[hidden email]>
> > Sent: 08 November 2019 01:54
> > To: [hidden email]
> > Subject: Re: Calculate the concentration in a CT image
> >
> > Yes this is doable as per Kenneth's explanation, but you really need
> > to understand the physics involved in your imaging.
> >
> > If you are using monochromatic X-rays (from a synchrotron) and your
> > software's "CT number" is proportional to your material's linear
> > attenuation coefficient, then the simple linear interpolation "method a"
> > will work. As this is quite unlikely (you probably have a
> > polychromatic source if you are using an in-house CT system), it
> > greatly depends on whether or not your elements distribution is
> > radially symmetric in all directions. The reason for this is that the
> > X-rays loose energy as they pass through the sample, so the apparent
> > concentration in the central parts will be lower than in the outer
> > parts. This phenomenon is called "beam hardening". You can compensate
> > this with X-Ray filtering, or software corrections (if the
> > distribution is symmetric). My experience is that software corrections
> > work better, as filtering really kills the signal noise ratio. Anyway
> > your CT software must still be calculating the attenuation
> > coefficients correctly, and that greatly depends on how clever your
> software is.
> >
> > This is in any case easy to check: Just scan a round plastic container
> > with pure KI brine, and then check the radial profile. Is it flat?  If
> > yes, then "method b" should work; it probably needs an exponential
> > profile. If it is not flat, you must revise your imaging setup and/or
> > your CT software processing settings. If the KI profile is flat,
> > repeat the experiment with pure water. If that is flat too, even
> > "method a" should work. If KI is your heaviest compound in your system
> > and the overall concentration is low, and all your other elements are
> light (low atomic numbers), then "method a"
> > might also work even if the test profiles for KI is not flat. But
> > again that will depend on your elements' distribution in the sample
> > and the symmetry of everything. So again you need to understand the
> > X-Ray imaging physics and how it applies to your sample.
> >
> > It will help if you post some example images, including all instrument
> > related metadata. Also please tell what instrument and what software
> > you are using for the generation of the CT images. I have considerable
> > experience with such measurements from µCT images so I should be able
> > to see if your images are analyzable or not.
> >
> > Stein
> >
> > -----Original Message-----
> > From: ImageJ Interest Group <[hidden email]> On Behalf Of Kenneth
> > Sloan
> > Sent: 7. november 2019 21:35
> > To: [hidden email]
> > Subject: Re: Calculate the concentration in a CT image
> >
> > Knowing nothing about this particular application, I will assume nothing.
> >
> > So far, you seem to have two pairs of (CT Number, concentration):
> >
> >         (loCT, loConcentration)
> >         (hiCT, hiConcentration)
> >
> > You want to convert intermediate (or more extreme?) CT numbers into
> > concentrations.
> >
> > Method a) assume everything is linear, and just use linear interpolation:
> >
> >           u = (CT-loCT) / (hiCT-loCT)
> >           CT = loConcentration + (u  *
> > (hiConcentration-loConcentration))
> >
> > I DO NOT RECOMMEND this method!
> >
> >
> > Method b) gather more data - measure CT numbers for known
> > concentrations, fit a function to your measurements,
> >             and evaluate this function at new measured CT numbers.
> >
> > I might start by measuring the CT number for (loConcentration +
> > hiConcentration)/2.  If (by some miracle) this turns out to be = (loCT
> > +
> > hiCT) / 2, then go to Method a)  Otherwise, measure at ¼ and ¾.
> > Continue sub-dividing until you are happy with a low-degree polynomial
> > that fits your data.
> >
> > The usual caveats about fitting a predictor to data apply -  in
> > particular, it is dangerous to EXTRAPOLATE from the measured values.
> > Interpolation is much safer.  And, avoid high-degree polynomials which
> > may overfit your data.
> >
> > Also consider exponential/log functions.  If you know anything about
> > the physics of the imaging, use that.
> >
> > --
> > Kenneth Sloan
> > [hidden email]
> > Vision is the art of seeing what is invisible to others.
> >
> >
> >
> >
> > >
> > >
> > > I am processing a CT image. They have two different brines mixed
> > together. One fluid is high CT number. Its concentration is 2mol/L (KI
> > doped). Another brine is pure water and its CT number is low.
> > >
> > > I want to relate the CT number to the concentration value. (Let's
> > > assume that the brightest part is 2 mol/L fluid and pure water is
> > > lowest CT number)
> > >
> > > Can anybody help me with the above question?
> > >
> >
> > --
> > ImageJ mailing list:
> > https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimage
> > j.nih.gov%2Fij%2Flist.html&amp;data=02%7C01%7Cstein.rorvik%40sintef.no
> > %7Cf22112f0eb0844a6569708d763c37804%7Ce1f00f39604145b0b309e0210d8b32af
> > %7C1%7C0%7C637087563501115145&amp;sdata=XFl%2FV1LOQkf2E3QxibNVnO32vSvv
> > k38lss%2Bs07lT3w8%3D&amp;reserved=0
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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