Dear Jeff,

if I have understood correctly you want to import a structural MRI scan for a given HCP subject into Brainstorm for creating the EEG source model.

I guess you follow a procedure similar to

http://neuroimage.usc.edu/brainstorm/Tutorials/HCP-MEG

and Brainstorm cannot find the MEG/anatomy/*_MEG_anatomy_transform.txt file.

Although I am not sure whar Brainstorm reads exactly from the transform file , I can tell you what the transorm file contains. It contains a matlab structure with some fields, which I think you could easily create for subject that have no MEG data.


First a quick word on coordinate systems:

spm: This is the MNI coordinate system. This is the coordinate system that you 0.7 mm processed structural MRI is defined.

bti: This is the coordinate system of the MEG . Of course in your case where there was no MEG recorded , this will be the same as the "spm" coordinate system of the structural MRI. If for your EEG you have digitised the location of the EEG sensors relative to the fiducials then of course you ll need to figure out the transformation matrix between the structural MRI and you EEG reference system. But if this is not the case then your "bti" coordinate system should be the same as the "spm" coordinate system. In this case the identity transformation matrices between this coordinate systems would be

spm2bti= [
  1 0 0 0
  0 1 0 0
  0 0 1 0
  0 0 0 1
];

bti2spm= spm2bti;


vox: This is the voxel coordinate system of the structural MRI . The MRI file contains in itself the transformation matrix from voxels to actual coordinates in the "spm". To get this transformation matric in matlab you can use the fieldtrip function "ft_read_mri"

Let's assume you have done so and you have found that the transformation matrix from voxel to coordinates is

vox07mm2spm= [
 0.0296775 0.00303441 -0.996087 92.0035
 -0.965804 -0.245889 -0.0309473 159.445
 0.253714 -0.970409 0.00438009 90.3328
 0 0 0 1
];


Important remark: The HCP processed structural MRI has a resolution of 0.7mm. For the MEG processing we use a lower resolution version of the structural MRI . So in the description below whenever you see the notation "vox07" refers to the 0.7mm scan and just "vox" to the lower resolution one. In your case of course these should be the same as you only have the 0.7 mm one.


The structure matlab variable is called "transform". I have put the description of the fields in form of code , so potentially you could run it and create the structure for the transform file.

Its fields are:
*%==============================================================*

*transform.vox07mm_filename *= 'T1w_acpc_dc_restore.nii.gz'; % This is the name of the HCP processed stuctural MRI with 0.7mm resolution *transform.vox_filename* = transform.vox07mm_filename ; % This is supposed to be the lower resolution version used for MEG but here you assign it also to the 0.7mm *transform.vox07mm2spm* = vox07mm2spm; %This is the transformation matrix from voxel to "spm" coordinates mentioned earlier retrieved from the 0.7mm structural MRI. *transform.spm2vox07mm* = inv(transform.vox2spm); % This is the inverse transformation of the above from "spm" coordinates to voxels.

*transform.vox2spm *=transform.vox07mm2spm; %This is the transformation matrix from voxel to "spm" coordinates mentioned earlier . As you only have the 0.7mm structural here is the same also for the lower resolution case. *transform.spm2vox* = inv(transform.vox2spm); % This is the inverse transformation of the above from "spm" coordinates to voxels.

*transform.spm2bti* = spm2bti; % This is the transformation between spm and bti coordinate systems. In this case it is assumed they are the same so it the identity matrix created earlier.
*transform.bti2spm* =  bti2spm; %Same case here

*transform.vox07mm2bti* = transform.vox07mm2spm ; % As spm and bti are identical coordinate system this is just the transformation from voxels to "spm" coordinates already created; *transform.bti2vox07mm *= transform.spm2vox07mm; % The same is true for the inverse transformation. *transform.vox2bti* = transform.vox2spm; % Same for the lower resolution case used for MEG, which of course yo dont have, as yo uonly have the 0.7 mm so this is the same as for the 0.7mm case


*transform.bti2vox *= transform.spm2vox; % Same for the inverse transform of the lower resolution case


*transform.vox2bti_registered* = transform.vox2bti; % This is an intermediate transformation from voxel to bti used only for MEG purposed but for your case should be exactly the same as the voxel to bti transformation which of course is the same as the voxel to spm transformation as these coordinate systems are the same in your case.
*%==============================================================*


Once you have created the "transform" variable you have to write it in an ascii file, which is not as strightforward as writing a numberical array in an ascii in matlab. The easiest way is to download the MEG pipeline code from ConnectomeDB and use the function from the "analysis_functions" subfolder called
"hcp_write_ascii.m"

simply as
transformfile=<subj>_MEG_anatomy_transform.txt
hcp_write_ascii (transformfile,'transform');

and
I believe that should do it.

Give it a try and let me know if it worked or not .
It might be of interest to other users too.
Have a nice day
Best
Giorgos



On 2/10/2017 10:41 PM, K Jeffrey Eriksen wrote:

Hi,

I am trying to import HCP processed data into Brainstorm, a Matlab-based package for EEG/MEG source analysis, in order to build an EEG source model. I do not work with MEG.

Unfortunately I am failing since I do not have the <subj>_MEG_anatomy_transform.txt file that is created during the HCP-MEG pipeline processing. Can someone help me figure out a way to create this transform for non-MEG HCP processed subjects? In our lab we use the WUSTL HCP pipeline with some local modifications.

Thanks,

-Jeff

_______________________________________________
HCP-Users mailing list
HCP-Users@humanconnectome.org
http://lists.humanconnectome.org/mailman/listinfo/hcp-users



_______________________________________________
HCP-Users mailing list
HCP-Users@humanconnectome.org
http://lists.humanconnectome.org/mailman/listinfo/hcp-users

Reply via email to