JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for FSL Archives


FSL Archives

FSL Archives


FSL@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

FSL Home

FSL Home

FSL  December 2013

FSL December 2013

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: Fieldmap estimation without phase/mag images

From:

Mark Jenkinson <[log in to unmask]>

Reply-To:

FSL - FMRIB's Software Library <[log in to unmask]>

Date:

Sun, 8 Dec 2013 23:10:57 +0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (226 lines)

Hi,

I'm afraid my suggested matrix had an incorrect translation.
This is why you see things moving off the screen.
The most general way to fix this is to decide on a point that you want to remain in the same location (e.g. voxel coordinate 32, 32, 21) and then calculate the following (in matlab/octave/etc):
  mmcoord= ( [32 32 21 1].*[3.4375  3.4375  3.74 1] )'
  fmat = cmat*qmat
  offset = mmcoord - fmat*mmcoord
  fmat(1:3,4) = fmat(1:3,4) + offset(1:3)

This will then fix the translation.

All the best,
	Mark


On 4 Dec 2013, at 11:23, Louis Shue <[log in to unmask]> wrote:

> Hi Mark
> 
> Thanks for the instructions. 
> 
> To keep the following discussion specific I have uploaded a fMRI file, single volume: https://db.tt/0ayfflFt
> 
> The parameters were obtained using "fslhd grot0001.nii.gz":
> 
> dim1           64
> dim2           64
> dim3           42
> dim4           1
> 
> pixdim1        3.437500
> pixdim2        3.437500
> pixdim3        3.739998
> pixdim4        3.012500
> 
> qform_code     1
> qto_xyz:1      -3.435528  -0.094762  0.073590  115.876595
> qto_xyz:2      -0.097738  3.432601  -0.168921  -75.939384
> qto_xyz:3      0.063261  0.157092  3.735456  -79.043907
> qto_xyz:4      0.000000  0.000000  0.000000  1.000000
> 
> So, based on your advice 
> 
> qmat = [
> -3.435528  -0.094762  0.073590  115.876595
> -0.097738  3.432601  -0.168921  -75.939384
> 0.063261  0.157092  3.735456  -79.043907
> 0.000000  0.000000  0.000000  1.000000]
> 
> cmat = [
> -1/3.4375  0  0  3.4375*64/2
> 0  1/3.4375  0 3.4375*64/2  
> 0  0  1/3.739998  3.739998*42/2
> 0  0  0  1] 
> 
> Next I carried out the rotation using "flirt -in grot0001 -ref grot0001 -applyxfm -init fmat.mat -out rot_grot0001" and "flirt -in grot0001 -ref grot0001 -applyxfm -init ifmat.mat -out rot_grot0001" where fmat=cmat*qmat and ifmat.mat=inv(fmat.mat). I must admit I am not aware of any other alternatives in FSL other than flirt so hopefully this is the correct way? 
> 
> Now, although I am not able to view the resulting rot_grot0001 properly using FSLVIEW (assume because of the change in isocentre?) the fact that
> 1/ the means and standard deviations of rot_grot0001 are sufficiently different from the grot0001, and 
> 2/ the qform matrix of rot_grot0001 (using both fmat.mat and ifmat.mat) is also not diagonal.
> has me worried that I have done something wrong here.
> 
> Perhaps you can shed some insight?
> 
> Thanks again!
> 
> Regards,
> Louis.
> 
> On Mon, 2 Dec 2013 09:28:05 +0000, Mark Jenkinson <[log in to unmask]> wrote:
> 
>> Hi,
>> 
>> You are right that the qform contains the information about the orientation (it is converted from the DICOM, and we don't deal with the details of DICOM to NIFTI conversion, so I can't tell you more than that).  The convention used in this matrix is not the same as that used by FLIRT.  However, you can derive an effective FLIRT matrix by doing the following (in matlab, or other software, or even by hand):
>> 
>> Fmat = [-1/dx 0 0 dx*Nx/2 ; 0 1/dy 0 dy*Ny/2 ; 0 0 1/dz dz*Nz/2 ; 0 0 0 1] * Qmat
>> 
>> where Fmat is a flirt matrix, Qmat is the qform matrix, (dx,dy,dz) are the voxel sizes in mm, and (Nx,Ny,Nz) are the number of voxels, in each dimension.  Make sure you put in the minus sign in the first row.
>> 
>> Note that this will shift the scanner isocentre to be the centre of the image.  If you don't want that then change the entries in the fourth column to shift the image around.
>> 
>> If you use either flirt with -applyxfm or the applywarp tool with the Fmat result then you should get an appropriately transformed image.  You can check this too by seeing if the new qform (or sform) is diagonal.  If not, try the inverse of the above matrix.
>> 
>> All the best,
>> 	Mark
>> 
>> 
>> 
>> 
>> On 29 Nov 2013, at 10:52, Louis Shue <[log in to unmask]> wrote:
>> 
>>> Dear Mark
>>> 
>>> I am afraid that I am still stuck at trying to reorienting my T1 volumes. I have located in the NIFTI header (for example) the following mapping between image space and scanner coordinates:
>>> 
>>> qform_code     1
>>> qto_xyz:1      -3.435528  -0.094762  0.073590  115.876595
>>> qto_xyz:2      -0.097738  3.432601  -0.168921  -75.939384
>>> qto_xyz:3      0.063261  0.157092  3.735456  -79.043907
>>> qto_xyz:4      0.000000  0.000000  0.000000  1.000000
>>> 
>>> Now since I am only interested in aligning the z-axis in my image to the scanner's z-axis I take it the transformation matrix is just
>>> 
>>> -3.435528  -0.094762  0.073590  0.0
>>> -0.097738  3.432601  -0.168921  0.0
>>> 0.063261  0.157092  3.735456  0.0
>>> 0.000000  0.000000  0.000000  1.00000
>>> 
>>> However after this stage I am yet to find any tools in FSL which can rotate the volume. I have already tried using FLIRT with the matrix above as the transform but it has not worked out. Perhaps some of the FSL experts on this list can suggest ways to do this?
>>> 
>>> By the way, as a related question, from the corresponding DICOM file there is the following tag 
>>> 
>>> (0020, 0037) Image Orientation (Patient)         DS: ['0.99942614398104', '0.02845082135956', '0.01838296741973', '-0.0275830506379', '0.99856748960402', '-0.0458491441952']
>>> 
>>> May I know what is the relationship of this tag with NIFTI's qform?
>>> 
>>> Thanks very much in advance for your suggestions!
>>> 
>>> Regards,
>>> Louis.
>>> 
>>> On Tue, 26 Nov 2013 00:39:00 +0000, Mark Jenkinson <[log in to unmask]> wrote:
>>> 
>>>> Hi,
>>>> 
>>>> The orientation issue is really about whether the axes for the image acquisition was aligned with the axis of the scanner bore (the "true" z-axis) or not.  It is common that scanner operators tilt the image acquisition to fit in the anatomy better.  This information (the relationship between the voxel axes and the scanner axes) is contained in the DICOM header information.
>>>> 
>>>> All the best,
>>>> 	Mark
>>>> 
>>>> 
>>>> On 21 Nov 2013, at 11:05, Louis Shue <[log in to unmask]> wrote:
>>>> 
>>>>> Hi Mark,
>>>>> 
>>>>> Can you please be a bit more detailed in your remark about orientation? As I recall, the program b0calc assumes that B0 is in the z-direction. Are you suggesting that I apply a linear transform to the T1 volume??
>>>>> 
>>>>> For completeness here are the initial segmentation results for Step 1.
>>>>> 
>>>>> https://db.tt/AJFSrOOw
>>>>> https://db.tt/aoTtQad6 (binarised)
>>>>> 
>>>>> Regards,
>>>>> Louis.
>>>>> 
>>>>> On Wed, 20 Nov 2013 17:09:54 +0000, Mark Jenkinson <[log in to unmask]> wrote:
>>>>> 
>>>>>> Dear Louis,
>>>>>> 
>>>>>> I agree with Matt in general, although the extreme superior and inferior portions of your fieldmap do not look that usual.  In my experience incorporating other tissue susceptibilities (point 3) is not worth it, as these values are so poorly characterised (especially in bone where the structure of the bone matrix can be significant).  Plus, the main departures for you are broad scale, so unlikely to be local tissue.  Therefore I suspect the problem is either (i) orientation (and if you reorient your original segmentation input, maybe using information from the DICOM); (ii) shimming, where the only thing you can do is to try adding gradient fields and second-order spherical harmonic field to see if that helps; or (iii) structure beyond the FOV of your segmented image (in particular, the torso and lungs).
>>>>>> 
>>>>>> I don't have specific details on how to solve these problems, as it depends on what information you have, but hopefully this is enough to help you take the next step.
>>>>>> 
>>>>>> All the best,
>>>>>> 	Mark
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> On 19 Nov 2013, at 19:07, Louis Shue <[log in to unmask]> wrote:
>>>>>> 
>>>>>>> Hi Matt
>>>>>>> 
>>>>>>> Thanks for the encouragement.
>>>>>>> 
>>>>>>> My main concern at the moment is that the light/dark areas of the two fieldmaps are not quite consistent which I suspect is related to point 2 you listed. Do you have any suggestions on how I can make use of the orientation to improve the results? I do have access to the original DICOM data.
>>>>>>> 
>>>>>>> Regards,
>>>>>>> Louis.
>>>>>>> 
>>>>>>> On Tue, 19 Nov 2013 10:37:06 -0600, Matt Glasser <[log in to unmask]> wrote:
>>>>>>> 
>>>>>>>> I agree those files look impressively similar.  Some other things that
>>>>>>>> will influence field maps:
>>>>>>>> 
>>>>>>>> 1) b0 shimming
>>>>>>>> 2) Orientation of the head in the b0 field
>>>>>>>> 3) b0 inhomogeneities due to tissue differences other than air/non-air
>>>>>>>> 
>>>>>>>> Have you compared your EPI to T1w registrations with and without your
>>>>>>>> synthetic field maps yet?  Perhaps you are already a lot closer than you
>>>>>>>> were initially.  I wouldn't let a desire for perfection get in the way of
>>>>>>>> a major improvement.  I would imagine a lot of people have data for which
>>>>>>>> they neglected to acquire field maps but wish to register them more
>>>>>>>> accurately to their structurals and would be interested in your progress
>>>>>>>> with this.
>>>>>>>> 
>>>>>>>> Peace,
>>>>>>>> 
>>>>>>>> Matt.
>>>>>>>> 
>>>>>>>> On 11/19/13 5:26 AM, "Louis Shue" <[log in to unmask]> wrote:
>>>>>>>> 
>>>>>>>>> Dear all,
>>>>>>>>> 
>>>>>>>>> A few months ago, I started looking at the problem of fieldmap-based
>>>>>>>>> unwarping of EPI when the usual fieldmap sequences (phase-difference
>>>>>>>>> volumes) were not available. With lots of help from Mark I was able to
>>>>>>>>> eventually come up with what seemed sensible-looking fieldmaps.
>>>>>>>>> Essentially the steps I used was
>>>>>>>>> 
>>>>>>>>> - Extract from T1 a mask to differentiate between air and "everything
>>>>>>>>> else", i.e. skull+brain+CSF
>>>>>>>>> - Use b0calc to estiamte the magnetic field variations
>>>>>>>>> - Scale by 2*pi* gyromanetic ratio
>>>>>>>>> - Remove spherical harmonics from the resulting volume
>>>>>>>>> 
>>>>>>>>> Unfortunate after comparing fieldmap determined from this approach with
>>>>>>>>> fieldmap computed using conventional methods (we were able to acquire
>>>>>>>>> newer data), there are noticeable differences between the fieldmaps as
>>>>>>>>> seen in the two files linked below.
>>>>>>>>> 
>>>>>>>>> Fieldmap computed from phasemap https://db.tt/57Lb8HzM
>>>>>>>>> Fieldmap computed from T1 volume https://db.tt/Ygte0Zh2
>>>>>>>>> 
>>>>>>>>> Since we still have substantial data that we would like to process as
>>>>>>>>> much as reasonably possible, hopefully we can still get something using
>>>>>>>>> the T1-b0calc approach? I'd really appreciate it if someone can suggest
>>>>>>>>> where I might be able to improve or where problems might have occurred in
>>>>>>>>> the above description?
>>>>>>>>> 
>>>>>>>>> Thanks very much!
>>>>>>>>> 
>>>>>>>>> Regards,
>>>>>>>>> Louis.

Top of Message | Previous Page | Permalink

JiscMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

April 2024
March 2024
February 2024
January 2024
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
2006
2005
2004
2003
2002
2001


JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice

For help and support help@jisc.ac.uk

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager