External Email - Use Caution
Thank you Doug, I tried all the transformation matrices (although as per case 1 of the referred link, i need only inv(tkrvox2ras) which is present in the MRI struct). but no one is able to map to the desired label location. Let me explain my scenario little more, may be i am missing something. *My Task:* I want to find out the coordinates of a certain tissue, let say midbrain, which can be used in matlab to read/process the tissue voxel values. *My Pipeline:* *Step 1*> recon-all -all -i $SUBJECTS_DIR/PPMI_3817_MR_T1-anatomical_Br_20140129144055847_S184115_I410987.nii -s test -brainstem-structures % PPMI_3817_MR_T1-anatomical_Br_20140129144055847_S184115_I410987.nii is the volume, downloaded from PPMI. As I am interested in midbrain only, so using the -brainstem-substructure flag. *Step 2*> recon-all -s test -brainstem-structures *Step 3*> mri_vol2label --c $SUBJECTS_DIR/test/mri/brainstemSsLabels.v10.FSvoxelSpace.mgz --id 173 --l mdb.label Now at matlab command line *Step 4*> mri_segtd = MRIread('path/to/test/mri/brainstemSsLabels.v10.FSvoxelSpace.mgz'); % mri_segtd is a matlab struct containing transformation matrices and volumetric data e.t.c. *Step 5*> mdb_label = read_label(path/to/mdb.label); *Step 6*> mdb_label(:,4) = 1 ; % to make the label file ready for transformation (following the instructions of the referred link)
Now if I want to copy the voxels data from brainstemSsLabels.v10.FSvoxelSpace.mgz into a test matrix as per the coordinates given in label matrix mdb_label *Step 7*> test_vol = mri_segtd.vol*0 ; %to create a blank matrix of same size of MRI volume *Step 8*> Now transforming mdb_label using tkrvox2ras transformation matrix
mdb_label_inv = int8(inv(mri_segtd.tkrvox2ras)*mdb_label');
*Step 9*> Now copying the voxel data from mri_segtd to test_vol
for i = 1:length( mdb_label ) k = mdb_label_inv(i,:,:,:); test_vol(k(1),k(2),k(3)) = mri_segtd(k(1),k(2),k(3)); end
Now when I view the resultant test_vol and the original segmented vol mri_segtd using imshow or imshow3d ( https://www.mathworks.com/matlabcentral/fileexchange/47463-imshow3dfull) both are not same, which meant the coordinates in the mdb_label_inv are incorrect. even when I tried test_vol(k(1),k(2),k(3)) = 1; to check whether the mdb_label_inv matrix carry the midbrain shape or not, that was even not correct. please look at the attached images. I also tried other transformation matrices given in the struct. but no success.
[image: image.png] Any help shall be highly appreciated.
Warm Regards,
Safi
On Thu, Apr 16, 2020 at 1:04 AM Douglas N. Greve dgreve@mgh.harvard.edu wrote:
On 4/15/2020 11:17 AM, Safi Ullah . wrote:
External Email - Use CautionDear Freesurfers,
I recently started working on an brain sMRI related project. I have a minor (may be a major) issue. when I generate label files for a tissue e.g midbrain by using the command mri_vol2label --c $SUBJECTS_DIR/bert/mri/brainstemSsLabels.v10.mgz --id 173 --l midbrain.label or in voxel space mri_vol2label --c $SUBJECTS_DIR/bert/mri/brainstemSsLabels.v10.FSvoxelSpace.mgz --id 173 --l midbrain1.label 👉Now I want to lad the label file and the MRI volume, brainstemSsLabels.v10 , in Matlab (I can do this by using MRIread function given in FSmatlab directory. the function read mri in a matlab struct, which along with other info also contain a 'vol' 3D data matrix)
read_label.m will read in the label MRIread.m will load the volume
👉 Using the coordinates given in label file, how to extract a specific slice, row, column from a matlab matrix? as the label file need some transformation, I dont know this part.
See this page for converting between coordinates https://surfer.nmr.mgh.harvard.edu/fswiki/CoordinateSystems
Any help shall be highly appreciated.
Regards,
Safi
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link
Freesurfer mailing listFreesurfer@nmr.mgh.harvard.eduhttps://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer