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-structuresStep 3> mri_vol2label --c $SUBJECTS_DIR/test/mri/brainstemSsLabels.v10.FSvoxelSpace.mgz --id 173 --l mdb.labelNow at matlab command lineStep 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_labelStep 7> test_vol = mri_segtd.vol*0 ; %to create a blank matrix of same size of MRI volumeStep 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));> endNow 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.Any help shall be highly appreciated.Warm Regards,SafiOn 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:
read_label.m will read in the labelExternal Email - Use Caution
Dear 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 commandmri_vol2label --c $SUBJECTS_DIR/bert/mri/brainstemSsLabels.v10.mgz --id 173
--l midbrain.labelor in voxel spacemri_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)
MRIread.m will load the volume
See this page for converting between coordinates https://surfer.nmr.mgh.harvard.edu/fswiki/CoordinateSystems👉 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.
Any help shall be highly appreciated.
Regards,
Safi
Virus-free. www.avast.com
_______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://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