External Email - Use Caution        

Dear FreeSurfer Community,

Has anyone had any success with solving the below problem:

I am dealing with brain lesions which may present on the left or right hemisphere of the brain.

  1. I wish to 'FLIP' RIGHT sided hemispheres (which contain lesions) to the LEFT side, so I ultimately can collate all my data and analyse brain hemispheres that are IPSILATERAL or CONTRALATERAL to the side of the brain lesion.
  2. When I use the Flip function below, the matrix generated seems to be correct, HOWEVER the subsequent IMAGE generated from the matrix, appears incorrect (it is not at all a mirror image of the original image).
  3. NOTE: My matrices include a Lesion Mask and a Medial Wall Mask (I am interested in examining Cortical Thickness values of all the cortex EXCEPT the lesion and medial wall (tentorium and ventricles etc).
Here are the commands used, for eg. 'subject 1':

%% 4b. Load the binary Lesion masks RIGHT 


right_lesion_filelist    = strcat(P, '/Oedema_masks_bin/', Imaging_Code, '_rh_fsaverage5_bin.mgh');


% load RIGHT lesion masks into a matrix

right_lesions       = SurfStatReadData([right_lesion_filelist]);
right_lesions = ~right_lesions;

% create a left hemisphere matrix filled with 1s
left_hemisphere = ones(17,10242)

% concatenate horizontally lesions masks (L) with right hemisphere matrix
fullbrain_with_right_lesions = horzcat(left_hemisphere, right_lesions)

% create medial wall mask for all subjects 
r_whole_mask = repmat(mask, 17, 1)

% add the medial wall mask on the lesion masks

fullbrain_lesion_medialwall = fullbrain_with_right_lesions.*r_whole_mask

% apply matrix with lesion & medial wall to the thickness values
T_right = fullbrain_lesion_medialwall .* T_rightlesion

%% Flip the Right sided images to the left

% reverse the element in each row
subject1 = T_right(1,:)

SurfStatView(subject1, SP)   


SP = SurfStatAvSurf({[P '/fsaverage5/surf/rh.pial'],[P '/fsaverage5/surf/lh.pial']})
subject1_flipped = fliplr(subject1)
SurfStatView(subject1_flipped, SP)   

mirror_image = fliplr(T_right)

SurfStatView(mirror_image(1,:), SP) 



Any thoughts would be very much appreciated!
Kind regards
Anam


Miss Anam Anzak MBBS PhD MRCS PGCCE
NIHR Clinical Lecturer (Neurosurgery)
Specialty Registrar in Neurosurgery, London deanery