Friday, 20 July 2012
Saturday, 14 July 2012
Transferring MRI data
1) Transferring from the scanner
On the scanner console, when all images in an exam have been collected and you are removing the participant from the scanner, make sure you press the "End Exam" button. This guarantees that all the images you require have been finally written to the internal GE database. Then, from a terminal window in the console, type; copydicom The copydicom script will get run overnight by the scanner, but it is good practice to transfer the data as soon as the exam is finished.The script will identify any MRI exams that have not previously been transferred to the CUBRIC cluster file-system (such as the one you have just collected). Note that the exam must be finished before you press this button. Otherwise, additional copies of the exam will end up in the database - which can cause confusion (but will only lead to duplication, rather than a loss of data).
When the command has finished, your images have been packaged up and transferred to the CUBRIC cluster file-system. Note: A typical fMRI experiment may consist of several tens of thousands of images. In the standard DICOM database, each of these images are stored in a separate file. This can be very inefficient, both in terms of file transfers and load on the linux file-system. So, we have taken the decision to package up all the images from an Exam in a single archive file, which is also compressed. In CUBRIC parlance, this is known as a dicball/tarball.
2) Unpacking Scanner DICOM data
(Note, steps 2 and 3 can be done using the Studies database https://studies.cubric.cf.ac.uk).Log in to your normal user account on the CUBRIC system. All dicballs are transferred to the same location, namely: /cubric/mri/direct_transfer/YYYY
where YYYY represents the year of the scan. Dicballs have fairly obscure names, which contain the name and time that the exam started. If you type the following command you will see all the dicballs currently in the database, sorted so that the last file listed is the last one to be transferred. ls -lrt /cubric/mri/direct_transfer/2012
Here is a typical listing from our database:
2012-07-19-16-35-54-e2357712.tgz
2012-07-19-18-21-53-e2390174.tgz
2012-07-20-08-02-36-e2404155.tgz
2012-07-20-08-08-30-e2404166.tgz
2012-07-20-09-04-34-e2404178.tgz
2012-07-20-10-02-49-e2404274.tgz
e.g.
sapje1@daws15:/cubric/users/sapje1$ seriesinfo 9319
------------------------------------------------------------------
REL Study ID//9319 (Exam No)
DICOM Data Tarball//2013-07-22-08-13-44-e4568456.tgz
PAT Patient Name//dailyqa
PAT Patient Birthdate//
ID Acquisition Date//20130722
ID Acquisition Time//075619
ACQ Protocol Name//dailyQA_2012b/1
1 // fgre // loc
2 // fgre // ASSET cal
3 // epiRT // EPI TR=3 64x64, 360FOV,no ASSET, no FATSAT
4 // epiRT // EPI QA 10min
------------------------------------------------------------------
This lists the tarball name, time, date and participant ID, and limited information about the series run during the acquisition (pulse sequence name and series description).
3) Unpacking a dicball
2_fgre
3_efgre3d
403_epi2cje032
4_epi2cje032
4) Converting Dicom data to NIFTI/Analyze format
5) Converting Structural (FSPGR) data for MEG or FreeSurfer
Labels:
analysis
Monday, 25 June 2012
EPI Unwarping with Fieldmaps
Using fieldmap acquisitions, one can improve the registration of EPI (functional) data to the subject's structural scan.
Preparing Fieldmap Data
The script fmap, which processes the fieldmap data to produce the appropriate files required by FEAT. The fieldmap acquisition on the CUBRIC scanner comprises of two SPGR scans with different echo times (7ms and 9ms). The syntax for fmap is;fmap
From these SPGR scans fmap produces a fieldmap directory containing the following files;
abs_image_brain_mask.nii.gz:
abs_image_brain.nii.gz: Required by FEAT
fieldmap_rad_s.nii.gz: Required by FEAT
fieldmap_uT.nii.gz
phasediff_brain.nii.gz
phasediff.nii.gz
Check the fieldmap_rad_s image using fslview. It should appear something similar to the images below, with values typically in the range -2000 to +2000.
Unwarping EPI data within FEAT
On the Pre-stats tab select B0 unwarping with the following parameters;
Fieldmap: the appropriate fieldmap_rad_s.nii.gz file.
Fieldmap map: the appropriate abs_image_brain.nii.gz file.
EPI echo spacing (ms): 0.32
EPI TE (ms): 35
Unwarp direction: +y
% Signal loss threshold: 10
When unwarping is complete, additional data appear in the Pre-stats section of the FEAT report. Check the quality of the unwarping by looking at the original and unwarped EPI, and the magnitude image of the fielmap data (a low resolotion structural scan). These are all in the whatever.feat/unwarp directory
EF_D_example_func.nii.gz: Original ("distorted") EPI volume
EF_UD_example_func.nii.gz: Unwarped (or "undistorted") EPI image
EF_UD_fmap_mag_brain.nii.gz: Structural image (from fieldmap).
The unwarped image (EF_UD_example_func.nii.gz) should be a better match to the structural image than the original (EF_D_example_func.nii.gz). Look for artefacts in the unwarping, which may be caused by head motion during the fieldmap, or in between the fieldmap and the epi acquisition.
Fieldmap: the appropriate fieldmap_rad_s.nii.gz file.
Fieldmap map: the appropriate abs_image_brain.nii.gz file.
EPI echo spacing (ms): 0.32
EPI TE (ms): 35
Unwarp direction: +y
% Signal loss threshold: 10
When unwarping is complete, additional data appear in the Pre-stats section of the FEAT report. Check the quality of the unwarping by looking at the original and unwarped EPI, and the magnitude image of the fielmap data (a low resolotion structural scan). These are all in the whatever.feat/unwarp directory
EF_D_example_func.nii.gz: Original ("distorted") EPI volume
EF_UD_example_func.nii.gz: Unwarped (or "undistorted") EPI image
EF_UD_fmap_mag_brain.nii.gz: Structural image (from fieldmap).
The unwarped image (EF_UD_example_func.nii.gz) should be a better match to the structural image than the original (EF_D_example_func.nii.gz). Look for artefacts in the unwarping, which may be caused by head motion during the fieldmap, or in between the fieldmap and the epi acquisition.
Images (right) show the typical effect of unwarping on EPI data. Original (red) and unwarped (blue) EPI images are overlaid on top of the fieldmap structural image. Original EPI shows stretching of data in the anterior direction near the frontal pole (A, B), and a movement of the cerebellum and spinal cord in the posterior direction (C). These are corrected in the unwarped version (blue)
Sunday, 24 June 2012
Summary Parameters of Standard Scans
MEG FSPGR - Suitable for MEG/fMRI/Retinotopic/mri3dX
3D FSPGR Oblique-Axial
resolution: 1mm isotropic matrix 256x256x176,
field of view 256x256x176
TR/TE=7.9/3.0 ms
TI=450ms
Flip angle=20deg
1 NEX (acq time ~ 10min)
Quick FSPGR - Suitable for MEG/fMRI/Retinotopic/mri3dX
3D FSPGR Oblique-Axial
resolution: 1mm isotropic matrix 256x192x176 (zero-padded to 256x256x176),
field of view 256x192x176mm
TR/TE=7.9/3.0 ms
TI=450ms
Flip angle=20deg
1 NEX (acq time ~ 7min)
High-Resolution FSPGR - NOT suitable for mri3dX/MEG/Retinotopic
3D FSPGR Oblique-Axial
resolution: 0.8mm isotropic matrix 320x320x194 (zero padded to 512x512x194)
field of view 256x256x155mm
TR/TE=7.9/3.0 ms
TI=450ms
Flip angle=20deg
1 NEX (acq time ~ 10min)
30 direction DTI Oblique-Axial.
(ACPC)
TR/TE=Cardiac Gated/87ms (effective)
FOV: 23cm
Acquisition matrix: 96x96
Slice Thickness: 2.4mm 60 slices
30 directions, 3B0.
Parallel acceleration (ASSET) factor=2
(acq time~13mins)
60 direction DTI Oblique-Axial. (ACPC)
TR/TE=Cardiac Gated/87ms (effective)
FOV: 23cm Acquisition matrix: 96x96
Slice Thickness: 2.4mm
60 slices 60 directions, 6B0.
Parallel acceleration (ASSET) factor=2
(acq time~25mins)
3.4mm Isotropic GRE-EPI (for fMRI) An fMRI data set was acquired using Gradient Echo-EPI with the following parameters; TR/TE=3000/35 ms, flip angle=90deg, acquisition matrix=64x64, field-of -view=22cm. 53 slices of thickness 3.4mm were acquired, orientated parallel with each subject's ACPC line (oblique-axial). A parallel acceleration (ASSET) factor of 2 was used.
3D FSPGR Oblique-Axial
resolution: 1mm isotropic matrix 256x256x176,
field of view 256x256x176
TR/TE=7.9/3.0 ms
TI=450ms
Flip angle=20deg
1 NEX (acq time ~ 10min)
Quick FSPGR - Suitable for MEG/fMRI/Retinotopic/mri3dX
3D FSPGR Oblique-Axial
resolution: 1mm isotropic matrix 256x192x176 (zero-padded to 256x256x176),
field of view 256x192x176mm
TR/TE=7.9/3.0 ms
TI=450ms
Flip angle=20deg
1 NEX (acq time ~ 7min)
High-Resolution FSPGR - NOT suitable for mri3dX/MEG/Retinotopic
3D FSPGR Oblique-Axial
resolution: 0.8mm isotropic matrix 320x320x194 (zero padded to 512x512x194)
field of view 256x256x155mm
TR/TE=7.9/3.0 ms
TI=450ms
Flip angle=20deg
1 NEX (acq time ~ 10min)
30 direction DTI Oblique-Axial.
(ACPC)
TR/TE=Cardiac Gated/87ms (effective)
FOV: 23cm
Acquisition matrix: 96x96
Slice Thickness: 2.4mm 60 slices
30 directions, 3B0.
Parallel acceleration (ASSET) factor=2
(acq time~13mins)
60 direction DTI Oblique-Axial. (ACPC)
TR/TE=Cardiac Gated/87ms (effective)
FOV: 23cm Acquisition matrix: 96x96
Slice Thickness: 2.4mm
60 slices 60 directions, 6B0.
Parallel acceleration (ASSET) factor=2
(acq time~25mins)
3.4mm Isotropic GRE-EPI (for fMRI) An fMRI data set was acquired using Gradient Echo-EPI with the following parameters; TR/TE=3000/35 ms, flip angle=90deg, acquisition matrix=64x64, field-of -view=22cm. 53 slices of thickness 3.4mm were acquired, orientated parallel with each subject's ACPC line (oblique-axial). A parallel acceleration (ASSET) factor of 2 was used.
Labels:
acquisition
Wednesday, 16 May 2012
Gannet Analysis Pipeline Summary for CUBRIC
CJE 16 May 2012, but based very heavily on;
NP;
March 2011; revised for new pipeline August 2011
Getting your data from the scanner
With MRS data; there are two
different “types” of data you need: The p-files, which contain the spectra, and
the dicom data which contain the imaging data. These are saved separately.
P-files
can be found in gpfs/mri/direct_transfer/spectro/
and then cd into the folder with your exam number in it (so for exam number 4236
go into the folder 4000). P-files are named examno_seriesno_pfileno.7
and to copy all the p-files from a session (in case of multiple scans) just
type
cp –r examno* $path
Imaging data (for segmentation) can be
found in the normal MRI folder;
/cubric/mri/direct_transfer/YEAR.
They can be unpacked using the sortdicomball command. Make sure you give it the full path.
/cubric/mri/direct_transfer/YEAR.
They can be unpacked using the sortdicomball command. Make sure you give it the full path.
Organising pfiles
This
is very simple and there are very clear functions to use. The easiest thing is
to have a document listing your p-files and commenting on their origin. How you
do this is up to you but for an example for an .m file with your pfiles in it:
pfile_occ
= {
‘2999_08_P00002.7’
%Subject 1, occipital
‘3000_07_P00003.7’
%Subject 2, occipital
‘3001_08_P00006.7’
%Subject 3, occipital
};
pfile_sensorimotor
= {
‘2999_07_P00001.7’
%Subject 1, sensorimotor
‘3000_08_P00004.7’
%Subject 2, sensorimotor
‘3001_07_P00005.7’
%Subject 3, sensorimotor
};
Running the analysis
Add the following directories to your matlab path (with subdirectories);
/cubric/software/matlab.versions/2012b/toolbox/stats
/cubric/software/matlab.versions/2012b/toolbox/matlab/optimfun
Set the p-files (just run the file you made above) and then load the p-files using the command GannetLoad (just type help GannetLoad if needed). e.g.
/cubric/software/matlab.versions/2012b/toolbox/stats
/cubric/software/matlab.versions/2012b/toolbox/matlab/optimfun
Set the p-files (just run the file you made above) and then load the p-files using the command GannetLoad (just type help GannetLoad if needed). e.g.
[MRS_STRUCT]
= GannetLoad(pfile_occ)
GannetLoad will load the pfiles and will
give a whole range of output variables. Images will pop up for each pfile.
These .pdf files are automatically saved in the folder MRSload_output.
-
The top left plot shows the GABA spectrum before
(green line) and after (blue line) frequency realignment. Generally these are
very similar.
-
The top right plot shows the drift in water
frequency which can be an pseudo-indicator of motion. Any scan that are more
than 2 standard deviations from the mean will be discarded (red circle)
-
The lower left plot shows the centre frequency
of the Creatine peak before (top) and after realignment. Blue bard indicate
scans that were rejected (same as the red circle).
Next you will want to fit the data by
using GannetFit. This fits the GABA peak (with a Gaussian) and the Water peak
(with a Voight lineshape) using Matlab's nonlinfit.
[MRS_STRUCT]
= GannetFit(MRS_STRUCT)
Where the MRS_STRUCT behind brackets is
the output from GannetLoad. For
each p-file separately it will plot: the full edited spectrum, GABA-peak and
Water peak + their fit. This will spit out an .pdf file for each pfile as well
(saved in MRSfit_date_timestamp in the folder you ran it from).
-
The top left plot shows the GABA peak (blue) and
the fit (red) and the residuals.
-
The lower left plot shows the Water peak (blue)
and fit (red) and its residuals.
When you look at MRS_STRUCT, you can see
a whole range of different parameters.
-
MRS_STRUCT.gabaiu are your GABA concentration
values in institutional units in the order you ran the pfiles in.
-
MRS_STRUCT.GABAIU_Error or .GABAFitError are the
error of the GABA fit. .WaterFitError does the same for water.
Always inspect the outputs of GannetLoad and GannetFit for artefacts and spectral quality.
Note that for analysing phantom data, use the equivalent commands GannetLoadPhantom and GannetFitPhantom.
Sunday, 29 April 2012
Gannet Version - CUBRIC
I've updated the MRS analysis code on the CUBRIC fileserver to the latest version of Gannet. For those of you who will be using Gannet for the first time, the syntax is almost identical to the old MRSLoadPfiles and MRSGABAfit, albeit with a change in the function names (i.e. they now start with Gannet...). There are instructions on the Gannet website;http://gabamrs.blogspot.co.uk/
The files are located in /cubric/software/Gannet, so put this at the top of your matlab path (add with subdirectories). There are several old versions on the server (e.g. in /cubric/scratch), I have left these in place for the moment, but will eventually place these in a Gannet_history folder.
The version we have is a 'CUBRIC special'. Not particularly special, really, but it has a scaling factor to get our 'institutional units' to be consistent with previously acquired data. So, if you download the version from the Gannetwebsite, all values will be different by a constant scaling factor.
For those of you who have been using Gannet already, there is a slight change in the fitting range and changes to the way the code handles Siemens data, so no need to reanalyse. For those who have used the December 2011 version of MRSload & MRSfit (with alignment on), again the changes are minor. Attached are the correlations of the current Gannetversion with the first Gannet release (Feb) and the Dec 2011 version of MRSanalysis, based on 106 datasets over 3 voxels (occ, SM, DLPFC). Overall the correlations are high R2>0.9, with differences being attributable to changes in the fitting limits and initial conditions of the fit (i.e. we are in the noise of the data, so different versions will result in slightly different results).
Subscribe to:
Posts (Atom)



