T2* computation...

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

T2* computation...

Gonzalo Rojas Costa
Hi:

  Which plugin computes T2* mapping ?.. Because "MRI Analysis Calculator
v1.0" only computes T2 mapping...

  Sincerely,


Gonzalo Rojas Costa
Chair LABMAN (OHBM)

Laboratory for Advanced Medical Image Processing
Department of Radiology
Health Innovation Center
Clínica las Condes
Lo Fontecilla 441, Las Condes, Santiago, Chile.
Tel: 56-2-2105170
Cel: 56-9-97771785
http://www.aribrain.info
https://scholar.google.com/citations?user=LO7LZ3oAAAAJ
https://www.researchgate.net/profile/Gonzalo_Rojas2
http://www.researcherid.com/rid/B-2036-2013
https://cl.linkedin.com/in/gonzalorojascosta

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

Re: T2* computation...

Fred Damen
Greetings,

It depends on what exactly what you mean by T2* mapping?

If you are referring to determining the time constant then the same post
processing plugin will work.  1/T2* = 1/T2 + 1/T2'; A spin echo pulse
sequence eliminates, i.e, reduces to negligible level, the T2' component
leaving just the T2 component.  A gradient echo sequence includes the T2'
component.

If you are referring to creating deltaB0 map, then you need to do a linear
fit to the phase image, albeit with special handling of the phase wrap.  I
have a plugin for this. (I have not yet dressed the code up for release
though)

If you are referring to Susceptibility Weighted Imaging, I do not know of
a ImageJ plugin, albeit there are other tools out there.

Enjoy,

Fred

On Mon, February 3, 2020 12:44 pm, Gonzalo Rojas Costa wrote:

> Hi:
>
>   Which plugin computes T2* mapping ?.. Because "MRI Analysis Calculator
> v1.0" only computes T2 mapping...
>
>   Sincerely,
>
>
> Gonzalo Rojas Costa
> Chair LABMAN (OHBM)
>
> Laboratory for Advanced Medical Image Processing
> Department of Radiology
> Health Innovation Center
> Clínica las Condes
> Lo Fontecilla 441, Las Condes, Santiago, Chile.
> Tel: 56-2-2105170
> Cel: 56-9-97771785
> http://www.aribrain.info
> https://scholar.google.com/citations?user=LO7LZ3oAAAAJ
> https://www.researchgate.net/profile/Gonzalo_Rojas2
> http://www.researcherid.com/rid/B-2036-2013
> https://cl.linkedin.com/in/gonzalorojascosta
>
> --
> 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: T2* computation...

Gonzalo Rojas Costa
Hi Fred:

For T2* mapping I mean T2 mapping for gradient echo sequence...

Sincerely,


Gonzalo Rojas Costa


El lun., 3 de febrero de 2020 21:06, Fred Damen <[hidden email]> escribió:

> Greetings,
>
> It depends on what exactly what you mean by T2* mapping?
>
> If you are referring to determining the time constant then the same post
> processing plugin will work.  1/T2* = 1/T2 + 1/T2'; A spin echo pulse
> sequence eliminates, i.e, reduces to negligible level, the T2' component
> leaving just the T2 component.  A gradient echo sequence includes the T2'
> component.
>
> If you are referring to creating deltaB0 map, then you need to do a linear
> fit to the phase image, albeit with special handling of the phase wrap.  I
> have a plugin for this. (I have not yet dressed the code up for release
> though)
>
> If you are referring to Susceptibility Weighted Imaging, I do not know of
> a ImageJ plugin, albeit there are other tools out there.
>
> Enjoy,
>
> Fred
>
> On Mon, February 3, 2020 12:44 pm, Gonzalo Rojas Costa wrote:
> > Hi:
> >
> >   Which plugin computes T2* mapping ?.. Because "MRI Analysis Calculator
> > v1.0" only computes T2 mapping...
> >
> >   Sincerely,
> >
> >
> > Gonzalo Rojas Costa
> > Chair LABMAN (OHBM)
> >
> > Laboratory for Advanced Medical Image Processing
> > Department of Radiology
> > Health Innovation Center
> > Clínica las Condes
> > Lo Fontecilla 441, Las Condes, Santiago, Chile.
> > Tel: 56-2-2105170
> > Cel: 56-9-97771785
> > http://www.aribrain.info
> > https://scholar.google.com/citations?user=LO7LZ3oAAAAJ
> > https://www.researchgate.net/profile/Gonzalo_Rojas2
> > http://www.researcherid.com/rid/B-2036-2013
> > https://cl.linkedin.com/in/gonzalorojascosta
> >
> > --
> > 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: T2* computation...

Fred Damen
Greetings Gonzalo,

I have not used the plugin that you had mentioned, albeit, I suspect it
will work for your purpose.  Here is a pitch for a couple of plugins that
I have written for this generic purpose.  DICOM_open will open a
multivolume DICOM dataset and sort them into a hyperstack with the slice
label set to the variable/value describing the frame dimension.  And
F_Projector, which will process the data voxelwise through the frame
dimension.  In your case, you would want the 'Fit: Exponential'.

Note: I have tested DICOM_open extensively for multi b-value, not DTI,
datasets.  I do not have a multi variable/TE dataset to test with though.
If you try it, I would be grateful for feedback.

Note: even if you don't use these plugin, but you are playing with DICOM
dataset, heed the warning in the third paragraph of DICOM_open wiki page.


Enjoy,

Fred

https://imagejdocu.tudor.lu/plugin/inputoutput/dicom_open/start
https://imagejdocu.tudor.lu/plugin/stacks/frame_projector/start

On Mon, February 3, 2020 2:53 pm, Gonzalo Rojas Costa wrote:

> Hi Fred:
>
> For T2* mapping I mean T2 mapping for gradient echo sequence...
>
> Sincerely,
>
>
> Gonzalo Rojas Costa
>
>
> El lun., 3 de febrero de 2020 21:06, Fred Damen <[hidden email]>
> escribió:
>
>> Greetings,
>>
>> It depends on what exactly what you mean by T2* mapping?
>>
>> If you are referring to determining the time constant then the same post
>> processing plugin will work.  1/T2* = 1/T2 + 1/T2'; A spin echo pulse
>> sequence eliminates, i.e, reduces to negligible level, the T2' component
>> leaving just the T2 component.  A gradient echo sequence includes the
>> T2'
>> component.
>>
>> If you are referring to creating deltaB0 map, then you need to do a
>> linear
>> fit to the phase image, albeit with special handling of the phase wrap.
>> I
>> have a plugin for this. (I have not yet dressed the code up for release
>> though)
>>
>> If you are referring to Susceptibility Weighted Imaging, I do not know
>> of
>> a ImageJ plugin, albeit there are other tools out there.
>>
>> Enjoy,
>>
>> Fred
>>
>> On Mon, February 3, 2020 12:44 pm, Gonzalo Rojas Costa wrote:
>> > Hi:
>> >
>> >   Which plugin computes T2* mapping ?.. Because "MRI Analysis
>> Calculator
>> > v1.0" only computes T2 mapping...
>> >
>> >   Sincerely,
>> >
>> >
>> > Gonzalo Rojas Costa
>> > Chair LABMAN (OHBM)
>> >
>> > Laboratory for Advanced Medical Image Processing
>> > Department of Radiology
>> > Health Innovation Center
>> > Clínica las Condes
>> > Lo Fontecilla 441, Las Condes, Santiago, Chile.
>> > Tel: 56-2-2105170
>> > Cel: 56-9-97771785
>> > http://www.aribrain.info
>> > https://scholar.google.com/citations?user=LO7LZ3oAAAAJ
>> > https://www.researchgate.net/profile/Gonzalo_Rojas2
>> > http://www.researcherid.com/rid/B-2036-2013
>> > https://cl.linkedin.com/in/gonzalorojascosta
>> >
>> > --
>> > 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: T2* computation...

Fred Damen
In reply to this post by Gonzalo Rojas Costa
Greetings Gonzalo,

If you tell me what you are conceptually trying to accomplish, I could
better guide you.

Technically, all MR images are T2* weighted, as R2* (1/T2*) is the
observed rate at which the MR signal attenuates due to the spins
dephasing. Using a spin-echo sequence, the spins dephased by deltaB0 are
rephased during image acquisition window and thus eliminates the T2'
information from the image; thus making spin-echo the acquisition method
of choice for T2 mapping.  If using a gradient echo sequence is a
requirement, then I assume that you can acquire enough images with
properly spaced TE(s) such that you can do a bi-exponential fit to extract
both T2 and T2'.  Although note, that deltaB0 causes blurring/displacement
in addition to signal attenuation.

Enjoy,

Fred

On Mon, February 3, 2020 2:53 pm, Gonzalo Rojas Costa wrote:

> Hi Fred:
>
> For T2* mapping I mean T2 mapping for gradient echo sequence...
>
> Sincerely,
>
>
> Gonzalo Rojas Costa
>
>
> El lun., 3 de febrero de 2020 21:06, Fred Damen <[hidden email]>
> escribió:
>
>> Greetings,
>>
>> It depends on what exactly what you mean by T2* mapping?
>>
>> If you are referring to determining the time constant then the same post
>> processing plugin will work.  1/T2* = 1/T2 + 1/T2'; A spin echo pulse
>> sequence eliminates, i.e, reduces to negligible level, the T2' component
>> leaving just the T2 component.  A gradient echo sequence includes the
>> T2'
>> component.
>>
>> If you are referring to creating deltaB0 map, then you need to do a
>> linear
>> fit to the phase image, albeit with special handling of the phase wrap.
>> I
>> have a plugin for this. (I have not yet dressed the code up for release
>> though)
>>
>> If you are referring to Susceptibility Weighted Imaging, I do not know
>> of
>> a ImageJ plugin, albeit there are other tools out there.
>>
>> Enjoy,
>>
>> Fred
>>
>> On Mon, February 3, 2020 12:44 pm, Gonzalo Rojas Costa wrote:
>> > Hi:
>> >
>> >   Which plugin computes T2* mapping ?.. Because "MRI Analysis
>> Calculator
>> > v1.0" only computes T2 mapping...
>> >
>> >   Sincerely,
>> >
>> >
>> > Gonzalo Rojas Costa
>> > Chair LABMAN (OHBM)
>> >
>> > Laboratory for Advanced Medical Image Processing
>> > Department of Radiology
>> > Health Innovation Center
>> > Clínica las Condes
>> > Lo Fontecilla 441, Las Condes, Santiago, Chile.
>> > Tel: 56-2-2105170
>> > Cel: 56-9-97771785
>> > http://www.aribrain.info
>> > https://scholar.google.com/citations?user=LO7LZ3oAAAAJ
>> > https://www.researchgate.net/profile/Gonzalo_Rojas2
>> > http://www.researcherid.com/rid/B-2036-2013
>> > https://cl.linkedin.com/in/gonzalorojascosta
>> >
>> > --
>> > 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: T2* computation...

Gonzalo Rojas Costa
Hi Fred:,

Thanks you very much for your detailed answers...

I have gradient echo images for T2* mapping with 8 equally spaced different
TE values... could you please tell me which imagej plugin or other software
could I use to compute T2 mapping (T2* mapping)?

Sincerely


Gonzalo Rojas Costa


El mié., 5 de febrero de 2020 02:36, Fred Damen <[hidden email]> escribió:

> Greetings Gonzalo,
>
> If you tell me what you are conceptually trying to accomplish, I could
> better guide you.
>
> Technically, all MR images are T2* weighted, as R2* (1/T2*) is the
> observed rate at which the MR signal attenuates due to the spins
> dephasing. Using a spin-echo sequence, the spins dephased by deltaB0 are
> rephased during image acquisition window and thus eliminates the T2'
> information from the image; thus making spin-echo the acquisition method
> of choice for T2 mapping.  If using a gradient echo sequence is a
> requirement, then I assume that you can acquire enough images with
> properly spaced TE(s) such that you can do a bi-exponential fit to extract
> both T2 and T2'.  Although note, that deltaB0 causes blurring/displacement
> in addition to signal attenuation.
>
> Enjoy,
>
> Fred
>
> On Mon, February 3, 2020 2:53 pm, Gonzalo Rojas Costa wrote:
> > Hi Fred:
> >
> > For T2* mapping I mean T2 mapping for gradient echo sequence...
> >
> > Sincerely,
> >
> >
> > Gonzalo Rojas Costa
> >
> >
> > El lun., 3 de febrero de 2020 21:06, Fred Damen <[hidden email]>
> > escribió:
> >
> >> Greetings,
> >>
> >> It depends on what exactly what you mean by T2* mapping?
> >>
> >> If you are referring to determining the time constant then the same post
> >> processing plugin will work.  1/T2* = 1/T2 + 1/T2'; A spin echo pulse
> >> sequence eliminates, i.e, reduces to negligible level, the T2' component
> >> leaving just the T2 component.  A gradient echo sequence includes the
> >> T2'
> >> component.
> >>
> >> If you are referring to creating deltaB0 map, then you need to do a
> >> linear
> >> fit to the phase image, albeit with special handling of the phase wrap.
> >> I
> >> have a plugin for this. (I have not yet dressed the code up for release
> >> though)
> >>
> >> If you are referring to Susceptibility Weighted Imaging, I do not know
> >> of
> >> a ImageJ plugin, albeit there are other tools out there.
> >>
> >> Enjoy,
> >>
> >> Fred
> >>
> >> On Mon, February 3, 2020 12:44 pm, Gonzalo Rojas Costa wrote:
> >> > Hi:
> >> >
> >> >   Which plugin computes T2* mapping ?.. Because "MRI Analysis
> >> Calculator
> >> > v1.0" only computes T2 mapping...
> >> >
> >> >   Sincerely,
> >> >
> >> >
> >> > Gonzalo Rojas Costa
> >> > Chair LABMAN (OHBM)
> >> >
> >> > Laboratory for Advanced Medical Image Processing
> >> > Department of Radiology
> >> > Health Innovation Center
> >> > Clínica las Condes
> >> > Lo Fontecilla 441, Las Condes, Santiago, Chile.
> >> > Tel: 56-2-2105170
> >> > Cel: 56-9-97771785
> >> > http://www.aribrain.info
> >> > https://scholar.google.com/citations?user=LO7LZ3oAAAAJ
> >> > https://www.researchgate.net/profile/Gonzalo_Rojas2
> >> > http://www.researcherid.com/rid/B-2036-2013
> >> > https://cl.linkedin.com/in/gonzalorojascosta
> >> >
> >> > --
> >> > 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: T2* computation...

Fred Damen
In reply to this post by Gonzalo Rojas Costa
If you are looking to determine a single time constant, then I assume
either the plugin you had found or my plugins, that I selflessly plugged,
should work.  If you are looking to determine two time constants then I do
not know of any existing software specifically for this.  Osirix/Heros
might have something available; as these are DICOM / medical imaging based
kitchen sinc tools.  Writing your own will be challenging unless the time
constants are very different and you have plenty of SNR.  I have attached
a plugin that I just scribbled together that might work. I have not even
tried to compile it, but most of it is cut and pasted from existing code.
Use at your own risk. At least it is a starting point.

Curious, why use GE for this and what are you going to do wtih T2(?) once
determined?

Fred


import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.*;
import ij.plugin.frame.*;

public class T2s_fit implements PlugIn {

   public void run(String arg) {
      ImagePlus imp = IJ.getImage();

      ImagePlus mask = (new
Duplicator()).run(imp,1,1,1,imp.getNSlices(),1,1);
      IJ.run(mask, "32-bit", "");
      IJ.run(mask,"Convert to Mask", "method=Huang background=Default
calculate");
      IJ.run(mask, "Fill Holes", "stack");

      ImagePlus[] pimps = F_Project.compute(imp, new F_Project.Compute() {
           @Override
           public double[] compute(double[] x, double[] y) {
              if (x == null) return new double[4];

              int demarcation = // frame # where faster timeconstant
signal below noise
              double[][] xy = arrSubSet(x,arrln(y),new
int[]{demarcation,x.length-1});
              double mbslow = F_Project.theilsen(xy[0],xy[1]);
              double T2slow = -mbslow[0];
              double S0slow = Math.exp(mbslow[1]);
              xy = arrSubSet(x,arrDiff(y,signal(x,T2slow,S0slow)),new
int[]{0,demarcation});
              double mbfast = F_Project.theilsen(xy[0],xy[1]);
              double T2fast = -mbfast[0];
              double S0fast = Math.exp(mbfast[1]);
              return new double[]{T2slow,T2fast,S0slow,S0fast};

              }
           }, mask, new ImagePlus[0]);

      for(pimp : pimps)
         pimp.show();
      }

   public static double[] signal(double[] ts, double tau, double S0) {
      double[] S = new double[ts.length];
      for(int i=0; i<ts.length; i)
         S[i] = S0*Math.exp(-ts[i]/tau);
      return S;
      }
   public static double[][] arrSubSet(double[] x, double[] y, int[] r) {
      if (r[1]<r[0]) return new double[2][0];
      double[][] ans = new double[2][r[1]-r[0]+1];
      for(int i=0; i<ans[0].length; i++) {
         ans[0][i] = x[i+r[0]];
         ans[1][i] = y[i+r[0]];
         }
      return ans;
      }
   public static double[] arrDiff(double[] a, double[] b) {
      double[] ans = new double[a.length];
      for(int i=0; i<a.length; i++) {
         ans[i] = a[i] - b[i];
         }
      return ans;
      }
   public static double[] arrln(double[] a) {
      double[] ans = new double[a.length];
      for(int i=0; i<a.length; i++) {
         ans[i] = Math.log(a[i]);
         }
      return ans;
      }
}




On Wed, February 5, 2020 2:14 am, Gonzalo Rojas Costa wrote:
> Hi Fred:,
>
> Thanks you very much for your detailed answers...
>
> I have gradient echo images for T2* mapping with 8 equally spaced
different TE values... could you please tell me which imagej plugin or
other software could I use to compute T2 mapping (T2* mapping)?
>
> Sincerely
>
>
> Gonzalo Rojas Costa
>
>
> El mié., 5 de febrero de 2020 02:36, Fred Damen <[hidden email]>
escribió:
>
>> Greetings Gonzalo,
>>
>> If you tell me what you are conceptually trying to accomplish, I could
better guide you.
>>
>> Technically, all MR images are T2* weighted, as R2* (1/T2*) is the
observed rate at which the MR signal attenuates due to the spins
dephasing. Using a spin-echo sequence, the spins dephased by deltaB0 are
rephased during image acquisition window and thus eliminates the T2'
information from the image; thus making spin-echo the acquisition method
of choice for T2 mapping.  If using a gradient echo sequence is a
requirement, then I assume that you can acquire enough images with
properly spaced TE(s) such that you can do a bi-exponential fit to extract

>> both T2 and T2'.  Although note, that deltaB0 causes
>> blurring/displacement
>> in addition to signal attenuation.
>>
>> Enjoy,
>>
>> Fred
>>
>> On Mon, February 3, 2020 2:53 pm, Gonzalo Rojas Costa wrote:
>> > Hi Fred:
>> >
>> > For T2* mapping I mean T2 mapping for gradient echo sequence...
>> >
>> > Sincerely,
>> >
>> >
>> > Gonzalo Rojas Costa
>> >
>> >
>> > El lun., 3 de febrero de 2020 21:06, Fred Damen <[hidden email]>
escribió:
>> >
>> >> Greetings,
>> >>
>> >> It depends on what exactly what you mean by T2* mapping?
>> >>
>> >> If you are referring to determining the time constant then the same
>> post
>> >> processing plugin will work.  1/T2* = 1/T2 + 1/T2'; A spin echo
pulse sequence eliminates, i.e, reduces to negligible level, the T2'
>> component
>> >> leaving just the T2 component.  A gradient echo sequence includes
the T2'
>> >> component.
>> >>
>> >> If you are referring to creating deltaB0 map, then you need to do a
linear

>> >> fit to the phase image, albeit with special handling of the phase
>> wrap.
>> >> I
>> >> have a plugin for this. (I have not yet dressed the code up for
>> release
>> >> though)
>> >>
>> >> If you are referring to Susceptibility Weighted Imaging, I do not
>> know
>> >> of
>> >> a ImageJ plugin, albeit there are other tools out there.
>> >>
>> >> Enjoy,
>> >>
>> >> Fred
>> >>
>> >> On Mon, February 3, 2020 12:44 pm, Gonzalo Rojas Costa wrote:
>> >> > Hi:
>> >> >
>> >> >   Which plugin computes T2* mapping ?.. Because "MRI Analysis
>> >> Calculator
>> >> > v1.0" only computes T2 mapping...
>> >> >
>> >> >   Sincerely,
>> >> >
>> >> >
>> >> > Gonzalo Rojas Costa
>> >> > Chair LABMAN (OHBM)
>> >> >
>> >> > Laboratory for Advanced Medical Image Processing
>> >> > Department of Radiology
>> >> > Health Innovation Center
>> >> > Clínica las Condes
>> >> > Lo Fontecilla 441, Las Condes, Santiago, Chile.
>> >> > Tel: 56-2-2105170
>> >> > Cel: 56-9-97771785
>> >> > http://www.aribrain.info
>> >> > https://scholar.google.com/citations?user=LO7LZ3oAAAAJ
>> >> > https://www.researchgate.net/profile/Gonzalo_Rojas2
>> >> > http://www.researcherid.com/rid/B-2036-2013
>> >> > https://cl.linkedin.com/in/gonzalorojascosta
>> >> >
>> >> > --
>> >> > 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
>

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

Re: T2* computation...

Gonzalo Rojas Costa
Hi Fred:

I need to compute T2* mapping for brain images... the adquisition has 120
axial slices with 8 different TEs (GE protocol)... using your ImageJ plugin
I could process one slice, but is  very tedious to compute the 120
slices... is there any command line method (or other method) to automate
the calculation ?

Sincerely


Gonzalo Rojas Costa


El vie., 7 de febrero de 2020 05:04, Fred Damen <[hidden email]> escribió:

> If you are looking to determine a single time constant, then I assume
> either the plugin you had found or my plugins, that I selflessly plugged,
> should work.  If you are looking to determine two time constants then I do
> not know of any existing software specifically for this.  Osirix/Heros
> might have something available; as these are DICOM / medical imaging based
> kitchen sinc tools.  Writing your own will be challenging unless the time
> constants are very different and you have plenty of SNR.  I have attached
> a plugin that I just scribbled together that might work. I have not even
> tried to compile it, but most of it is cut and pasted from existing code.
> Use at your own risk. At least it is a starting point.
>
> Curious, why use GE for this and what are you going to do wtih T2(?) once
> determined?
>
> Fred
>
>
> import ij.*;
> import ij.process.*;
> import ij.gui.*;
> import java.awt.*;
> import ij.plugin.*;
> import ij.plugin.frame.*;
>
> public class T2s_fit implements PlugIn {
>
>    public void run(String arg) {
>       ImagePlus imp = IJ.getImage();
>
>       ImagePlus mask = (new
> Duplicator()).run(imp,1,1,1,imp.getNSlices(),1,1);
>       IJ.run(mask, "32-bit", "");
>       IJ.run(mask,"Convert to Mask", "method=Huang background=Default
> calculate");
>       IJ.run(mask, "Fill Holes", "stack");
>
>       ImagePlus[] pimps = F_Project.compute(imp, new F_Project.Compute() {
>            @Override
>            public double[] compute(double[] x, double[] y) {
>               if (x == null) return new double[4];
>
>               int demarcation = // frame # where faster timeconstant
> signal below noise
>               double[][] xy = arrSubSet(x,arrln(y),new
> int[]{demarcation,x.length-1});
>               double mbslow = F_Project.theilsen(xy[0],xy[1]);
>               double T2slow = -mbslow[0];
>               double S0slow = Math.exp(mbslow[1]);
>               xy = arrSubSet(x,arrDiff(y,signal(x,T2slow,S0slow)),new
> int[]{0,demarcation});
>               double mbfast = F_Project.theilsen(xy[0],xy[1]);
>               double T2fast = -mbfast[0];
>               double S0fast = Math.exp(mbfast[1]);
>               return new double[]{T2slow,T2fast,S0slow,S0fast};
>
>               }
>            }, mask, new ImagePlus[0]);
>
>       for(pimp : pimps)
>          pimp.show();
>       }
>
>    public static double[] signal(double[] ts, double tau, double S0) {
>       double[] S = new double[ts.length];
>       for(int i=0; i<ts.length; i)
>          S[i] = S0*Math.exp(-ts[i]/tau);
>       return S;
>       }
>    public static double[][] arrSubSet(double[] x, double[] y, int[] r) {
>       if (r[1]<r[0]) return new double[2][0];
>       double[][] ans = new double[2][r[1]-r[0]+1];
>       for(int i=0; i<ans[0].length; i++) {
>          ans[0][i] = x[i+r[0]];
>          ans[1][i] = y[i+r[0]];
>          }
>       return ans;
>       }
>    public static double[] arrDiff(double[] a, double[] b) {
>       double[] ans = new double[a.length];
>       for(int i=0; i<a.length; i++) {
>          ans[i] = a[i] - b[i];
>          }
>       return ans;
>       }
>    public static double[] arrln(double[] a) {
>       double[] ans = new double[a.length];
>       for(int i=0; i<a.length; i++) {
>          ans[i] = Math.log(a[i]);
>          }
>       return ans;
>       }
> }
>
>
>
>
> On Wed, February 5, 2020 2:14 am, Gonzalo Rojas Costa wrote:
> > Hi Fred:,
> >
> > Thanks you very much for your detailed answers...
> >
> > I have gradient echo images for T2* mapping with 8 equally spaced
> different TE values... could you please tell me which imagej plugin or
> other software could I use to compute T2 mapping (T2* mapping)?
> >
> > Sincerely
> >
> >
> > Gonzalo Rojas Costa
> >
> >
> > El mié., 5 de febrero de 2020 02:36, Fred Damen <[hidden email]>
> escribió:
> >
> >> Greetings Gonzalo,
> >>
> >> If you tell me what you are conceptually trying to accomplish, I could
> better guide you.
> >>
> >> Technically, all MR images are T2* weighted, as R2* (1/T2*) is the
> observed rate at which the MR signal attenuates due to the spins
> dephasing. Using a spin-echo sequence, the spins dephased by deltaB0 are
> rephased during image acquisition window and thus eliminates the T2'
> information from the image; thus making spin-echo the acquisition method
> of choice for T2 mapping.  If using a gradient echo sequence is a
> requirement, then I assume that you can acquire enough images with
> properly spaced TE(s) such that you can do a bi-exponential fit to extract
> >> both T2 and T2'.  Although note, that deltaB0 causes
> >> blurring/displacement
> >> in addition to signal attenuation.
> >>
> >> Enjoy,
> >>
> >> Fred
> >>
> >> On Mon, February 3, 2020 2:53 pm, Gonzalo Rojas Costa wrote:
> >> > Hi Fred:
> >> >
> >> > For T2* mapping I mean T2 mapping for gradient echo sequence...
> >> >
> >> > Sincerely,
> >> >
> >> >
> >> > Gonzalo Rojas Costa
> >> >
> >> >
> >> > El lun., 3 de febrero de 2020 21:06, Fred Damen <[hidden email]>
> escribió:
> >> >
> >> >> Greetings,
> >> >>
> >> >> It depends on what exactly what you mean by T2* mapping?
> >> >>
> >> >> If you are referring to determining the time constant then the same
> >> post
> >> >> processing plugin will work.  1/T2* = 1/T2 + 1/T2'; A spin echo
> pulse sequence eliminates, i.e, reduces to negligible level, the T2'
> >> component
> >> >> leaving just the T2 component.  A gradient echo sequence includes
> the T2'
> >> >> component.
> >> >>
> >> >> If you are referring to creating deltaB0 map, then you need to do a
> linear
> >> >> fit to the phase image, albeit with special handling of the phase
> >> wrap.
> >> >> I
> >> >> have a plugin for this. (I have not yet dressed the code up for
> >> release
> >> >> though)
> >> >>
> >> >> If you are referring to Susceptibility Weighted Imaging, I do not
> >> know
> >> >> of
> >> >> a ImageJ plugin, albeit there are other tools out there.
> >> >>
> >> >> Enjoy,
> >> >>
> >> >> Fred
> >> >>
> >> >> On Mon, February 3, 2020 12:44 pm, Gonzalo Rojas Costa wrote:
> >> >> > Hi:
> >> >> >
> >> >> >   Which plugin computes T2* mapping ?.. Because "MRI Analysis
> >> >> Calculator
> >> >> > v1.0" only computes T2 mapping...
> >> >> >
> >> >> >   Sincerely,
> >> >> >
> >> >> >
> >> >> > Gonzalo Rojas Costa
> >> >> > Chair LABMAN (OHBM)
> >> >> >
> >> >> > Laboratory for Advanced Medical Image Processing
> >> >> > Department of Radiology
> >> >> > Health Innovation Center
> >> >> > Clínica las Condes
> >> >> > Lo Fontecilla 441, Las Condes, Santiago, Chile.
> >> >> > Tel: 56-2-2105170
> >> >> > Cel: 56-9-97771785
> >> >> > http://www.aribrain.info
> >> >> > https://scholar.google.com/citations?user=LO7LZ3oAAAAJ
> >> >> > https://www.researchgate.net/profile/Gonzalo_Rojas2
> >> >> > http://www.researcherid.com/rid/B-2036-2013
> >> >> > https://cl.linkedin.com/in/gonzalorojascosta
> >> >> >
> >> >> > --
> >> >> > 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
> >
>
> --
> 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: T2* computation...

Fred Damen
Greetings Gonzalo,

Nope, the compute method as specified, loops over every voxel in every
slice, save those excluded by mask, and produces a separate volume
(entries in the returned ImagePlus[]) for each returned parameter. There
are other F_Project methods that allow you to select a subset of both
slices and frames, see documentation and/or code.  Also, the 'loop' over
spatial voxels is threaded.

If you are doing only one time constant, the GUI interface is all you
need, albeit, if you desire a linearized fit, you will need to take the
natural log of the dataset first. (The theilsen linear regressor is more
resilient to noise/outliers than the least squares regressors).

mea cupla: The documentation wiki for F_Project does not explicitly state
that the slice label should be 'var = val' or 'var val' on the first slice
of each volume/frame for the 'val(s)' to be used as the independent
variable values passed as 'x'.

Enjoy,

Fred

On Fri, February 7, 2020 1:51 am, Gonzalo Rojas Costa wrote:

> Hi Fred:
>
> I need to compute T2* mapping for brain images... the adquisition has 120
> axial slices with 8 different TEs (GE protocol)... using your ImageJ
> plugin
> I could process one slice, but is  very tedious to compute the 120
> slices... is there any command line method (or other method) to automate
> the calculation ?
>
> Sincerely
>
>
> Gonzalo Rojas Costa
>
>
> El vie., 7 de febrero de 2020 05:04, Fred Damen <[hidden email]>
> escribió:
>
>> If you are looking to determine a single time constant, then I assume
>> either the plugin you had found or my plugins, that I selflessly
>> plugged,
>> should work.  If you are looking to determine two time constants then I
>> do
>> not know of any existing software specifically for this.  Osirix/Heros
>> might have something available; as these are DICOM / medical imaging
>> based
>> kitchen sinc tools.  Writing your own will be challenging unless the
>> time
>> constants are very different and you have plenty of SNR.  I have
>> attached
>> a plugin that I just scribbled together that might work. I have not even
>> tried to compile it, but most of it is cut and pasted from existing
>> code.
>> Use at your own risk. At least it is a starting point.
>>
>> Curious, why use GE for this and what are you going to do wtih T2(?)
>> once
>> determined?
>>
>> Fred
>>
>>
>> import ij.*;
>> import ij.process.*;
>> import ij.gui.*;
>> import java.awt.*;
>> import ij.plugin.*;
>> import ij.plugin.frame.*;
>>
>> public class T2s_fit implements PlugIn {
>>
>>    public void run(String arg) {
>>       ImagePlus imp = IJ.getImage();
>>
>>       ImagePlus mask = (new
>> Duplicator()).run(imp,1,1,1,imp.getNSlices(),1,1);
>>       IJ.run(mask, "32-bit", "");
>>       IJ.run(mask,"Convert to Mask", "method=Huang background=Default
>> calculate");
>>       IJ.run(mask, "Fill Holes", "stack");
>>
>>       ImagePlus[] pimps = F_Project.compute(imp, new F_Project.Compute()
>> {
>>            @Override
>>            public double[] compute(double[] x, double[] y) {
>>               if (x == null) return new double[4];
>>
>>               int demarcation = // frame # where faster timeconstant
>> signal below noise
>>               double[][] xy = arrSubSet(x,arrln(y),new
>> int[]{demarcation,x.length-1});
>>               double mbslow = F_Project.theilsen(xy[0],xy[1]);
>>               double T2slow = -mbslow[0];
>>               double S0slow = Math.exp(mbslow[1]);
>>               xy = arrSubSet(x,arrDiff(y,signal(x,T2slow,S0slow)),new
>> int[]{0,demarcation});
>>               double mbfast = F_Project.theilsen(xy[0],xy[1]);
>>               double T2fast = -mbfast[0];
>>               double S0fast = Math.exp(mbfast[1]);
>>               return new double[]{T2slow,T2fast,S0slow,S0fast};
>>
>>               }
>>            }, mask, new ImagePlus[0]);
>>
>>       for(pimp : pimps)
>>          pimp.show();
>>       }
>>
>>    public static double[] signal(double[] ts, double tau, double S0) {
>>       double[] S = new double[ts.length];
>>       for(int i=0; i<ts.length; i)
>>          S[i] = S0*Math.exp(-ts[i]/tau);
>>       return S;
>>       }
>>    public static double[][] arrSubSet(double[] x, double[] y, int[] r) {
>>       if (r[1]<r[0]) return new double[2][0];
>>       double[][] ans = new double[2][r[1]-r[0]+1];
>>       for(int i=0; i<ans[0].length; i++) {
>>          ans[0][i] = x[i+r[0]];
>>          ans[1][i] = y[i+r[0]];
>>          }
>>       return ans;
>>       }
>>    public static double[] arrDiff(double[] a, double[] b) {
>>       double[] ans = new double[a.length];
>>       for(int i=0; i<a.length; i++) {
>>          ans[i] = a[i] - b[i];
>>          }
>>       return ans;
>>       }
>>    public static double[] arrln(double[] a) {
>>       double[] ans = new double[a.length];
>>       for(int i=0; i<a.length; i++) {
>>          ans[i] = Math.log(a[i]);
>>          }
>>       return ans;
>>       }
>> }
>>
>>
>>
>>
>> On Wed, February 5, 2020 2:14 am, Gonzalo Rojas Costa wrote:
>> > Hi Fred:,
>> >
>> > Thanks you very much for your detailed answers...
>> >
>> > I have gradient echo images for T2* mapping with 8 equally spaced
>> different TE values... could you please tell me which imagej plugin or
>> other software could I use to compute T2 mapping (T2* mapping)?
>> >
>> > Sincerely
>> >
>> >
>> > Gonzalo Rojas Costa
>> >
>> >
>> > El mié., 5 de febrero de 2020 02:36, Fred Damen <[hidden email]>
>> escribió:
>> >
>> >> Greetings Gonzalo,
>> >>
>> >> If you tell me what you are conceptually trying to accomplish, I
>> could
>> better guide you.
>> >>
>> >> Technically, all MR images are T2* weighted, as R2* (1/T2*) is the
>> observed rate at which the MR signal attenuates due to the spins
>> dephasing. Using a spin-echo sequence, the spins dephased by deltaB0 are
>> rephased during image acquisition window and thus eliminates the T2'
>> information from the image; thus making spin-echo the acquisition method
>> of choice for T2 mapping.  If using a gradient echo sequence is a
>> requirement, then I assume that you can acquire enough images with
>> properly spaced TE(s) such that you can do a bi-exponential fit to
>> extract
>> >> both T2 and T2'.  Although note, that deltaB0 causes
>> >> blurring/displacement
>> >> in addition to signal attenuation.
>> >>
>> >> Enjoy,
>> >>
>> >> Fred
>> >>
>> >> On Mon, February 3, 2020 2:53 pm, Gonzalo Rojas Costa wrote:
>> >> > Hi Fred:
>> >> >
>> >> > For T2* mapping I mean T2 mapping for gradient echo sequence...
>> >> >
>> >> > Sincerely,
>> >> >
>> >> >
>> >> > Gonzalo Rojas Costa
>> >> >
>> >> >
>> >> > El lun., 3 de febrero de 2020 21:06, Fred Damen <[hidden email]>
>> escribió:
>> >> >
>> >> >> Greetings,
>> >> >>
>> >> >> It depends on what exactly what you mean by T2* mapping?
>> >> >>
>> >> >> If you are referring to determining the time constant then the
>> same
>> >> post
>> >> >> processing plugin will work.  1/T2* = 1/T2 + 1/T2'; A spin echo
>> pulse sequence eliminates, i.e, reduces to negligible level, the T2'
>> >> component
>> >> >> leaving just the T2 component.  A gradient echo sequence includes
>> the T2'
>> >> >> component.
>> >> >>
>> >> >> If you are referring to creating deltaB0 map, then you need to do
>> a
>> linear
>> >> >> fit to the phase image, albeit with special handling of the phase
>> >> wrap.
>> >> >> I
>> >> >> have a plugin for this. (I have not yet dressed the code up for
>> >> release
>> >> >> though)
>> >> >>
>> >> >> If you are referring to Susceptibility Weighted Imaging, I do not
>> >> know
>> >> >> of
>> >> >> a ImageJ plugin, albeit there are other tools out there.
>> >> >>
>> >> >> Enjoy,
>> >> >>
>> >> >> Fred
>> >> >>
>> >> >> On Mon, February 3, 2020 12:44 pm, Gonzalo Rojas Costa wrote:
>> >> >> > Hi:
>> >> >> >
>> >> >> >   Which plugin computes T2* mapping ?.. Because "MRI Analysis
>> >> >> Calculator
>> >> >> > v1.0" only computes T2 mapping...
>> >> >> >
>> >> >> >   Sincerely,
>> >> >> >
>> >> >> >
>> >> >> > Gonzalo Rojas Costa
>> >> >> > Chair LABMAN (OHBM)
>> >> >> >
>> >> >> > Laboratory for Advanced Medical Image Processing
>> >> >> > Department of Radiology
>> >> >> > Health Innovation Center
>> >> >> > Clínica las Condes
>> >> >> > Lo Fontecilla 441, Las Condes, Santiago, Chile.
>> >> >> > Tel: 56-2-2105170
>> >> >> > Cel: 56-9-97771785
>> >> >> > http://www.aribrain.info
>> >> >> > https://scholar.google.com/citations?user=LO7LZ3oAAAAJ
>> >> >> > https://www.researchgate.net/profile/Gonzalo_Rojas2
>> >> >> > http://www.researcherid.com/rid/B-2036-2013
>> >> >> > https://cl.linkedin.com/in/gonzalorojascosta
>> >> >> >
>> >> >> > --
>> >> >> > 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
>> >
>>
>> --
>> 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