AFNI Message Board

Dear AFNI users-

We are very pleased to announce that the new AFNI Message Board framework is up! Please join us at:

https://discuss.afni.nimh.nih.gov

Existing user accounts have been migrated, so returning users can login by requesting a password reset. New users can create accounts, as well, through a standard account creation process. Please note that these setup emails might initially go to spam folders (esp. for NIH users!), so please check those locations in the beginning.

The current Message Board discussion threads have been migrated to the new framework. The current Message Board will remain visible, but read-only, for a little while.

Sincerely, AFNI HQ

History of AFNI updates  

|
nic
May 11, 2017 12:26PM
Dear AFNIers,

I would like to use a WM lesion map, derived from a FLAIR image with the Lesion Segmentation Toolbox (LST) in SPM, as a mask to extract values of interest from a functional scan. However, I'm having troubles getting the images aligned properly. The FLAIR has AIL orientation and the functional scan RAI orientation. The LST output is in TLRC space (but seems aligned to a MNI template).

I've searched the message board and used 3dresample, 3dWarp, and 3dAllineate. The latter seems to work best but the output is not quite a match although the orientation differences seem to be corrected. This may be due to template differences? Below, you find tons of information on the orientation and geometry of the images as well as some example commands and unsuccessful approaches.

An aside question: the scans are built with dcm2nii - could this cause potential issues with left-right flip? It doesn't seem so.

I'd be really grateful for any tips and suggestions!

Thanks so much in advance,

Nic




############################ SCAN INFORMATION ############################

###
### FLAIR
###

# T2SPACEFLAIRvb17bw651subj.nii
Template Space: ORIG
Data Axes Tilt: Oblique (10.911 deg. from plumb)
Data Axes Approximate Orientation:
first (x) = Anterior-to-Posterior
second (y) = Inferior-to-Superior
third (z) = Left-to-Right [-orient AIL]
R-to-L extent: -73.036 [R] -to- 101.965 [L] -step- 1.000 mm [176 voxels]
A-to-P extent: -168.287 [A] -to- 86.713 [P] -step- 1.000 mm [256 voxels]
I-to-S extent: -174.799 -to- 80.201 [S] -step- 1.000 mm [256 voxels]
R-to-L center: 14.464 [L]
A-to-P center: -40.787 [A]
I-to-S center: -47.299

###
### FUNCTIONAL SCAN
###

# pb00.subj.r01.tcat+orig.
Template Space: ORIG
Data Axes Tilt: Oblique (10.912 deg. from plumb)
Data Axes Approximate Orientation:
first (x) = Right-to-Left
second (y) = Posterior-to-Anterior
third (z) = Inferior-to-Superior [-orient RPI]
R-to-L extent: -95.113 [R] -to- 93.887 [L] -step- 3.000 mm [ 64 voxels]
A-to-P extent: -119.949 [A] -to- 69.051 [P] -step- 3.000 mm [ 64 voxels]
I-to-S extent: -112.225 -to- 4.025 [S] -step- 3.750 mm [ 32 voxels]
R-to-L center: -0.613 [R]
A-to-P center: -25.449 [A]
I-to-S center: -54.100


# pb02.subj.r01.volreg+tlrc
Template Space: TT_N27
Data Axes Tilt: Plumb
Data Axes Orientation:
first (x) = Right-to-Left
second (y) = Anterior-to-Posterior
third (z) = Inferior-to-Superior [-orient RAI]
R-to-L extent: -79.500 [R] -to- 79.500 [L] -step- 3.000 mm [ 54 voxels]
A-to-P extent: -79.500 [A] -to- 109.500 [P] -step- 3.000 mm [ 64 voxels]
I-to-S extent: -63.500 -to- 83.500 [S] -step- 3.000 mm [ 50 voxels]
R-to-L center: 0.000
A-to-P center: 15.000 [P]
I-to-S center: 10.000 [S]


###
### LST OUTPUT
###

# ples_lpa_mrT2SPACEFLAIRvb17bw651subj.nii
Template Space: TLRC
Data Axes Tilt: Oblique (11.275 deg. from plumb)
Data Axes Approximate Orientation:
first (x) = Anterior-to-Posterior
second (y) = Inferior-to-Superior
third (z) = Left-to-Right [-orient AIL]
R-to-L extent: -78.326 [R] -to- 96.674 [L] -step- 1.000 mm [176 voxels]
A-to-P extent: -164.654 [A] -to- 90.346 [P] -step- 1.000 mm [256 voxels]
I-to-S extent: -178.495 -to- 76.505 [S] -step- 1.000 mm [256 voxels]
R-to-L center: 9.174 [L]
A-to-P center: -37.154 [A]
I-to-S center: -50.995



############################ EXAMPLE COMMANDS ############################

###
### ALIGN LST OUTPUT TO FUNCTIONAL SCAN
###
# The _al output seems to mostly align with the functional scan but is tilted to the left in the AFNI viewer. The LST output is in AIL and functional scan in RAI -> using 3dresample but the probability map is totally off then.

3dAllineate -base pb02.subj.r01.volreg+tlrc -input ples_lpa_mrT2SPACEFLAIRvb17bw651subj.nii -1Dmatrix_save al_matrix_1mm -mast_dxyz 1 -prefix lesion_map_al_1mm

3dresample -master pb02.subj.r01.volreg+tlrc -input ples_lpa_mrT2SPACEFLAIRvb17bw651subj.nii -prefix ples_lpa_mrT2SPACEFLAIRvb17bw651subj_reoriented_3mm

# lesion_map_al_1mm+tlrc
Template Space: TT_N27
Data Axes Tilt: Plumb
Data Axes Orientation:
first (x) = Right-to-Left
second (y) = Anterior-to-Posterior
third (z) = Inferior-to-Superior [-orient RAI]
R-to-L extent: -80.500 [R] -to- 80.500 [L] -step- 1.000 mm [162 voxels]
A-to-P extent: -80.500 [A] -to- 110.500 [P] -step- 1.000 mm [192 voxels]
I-to-S extent: -64.500 -to- 84.500 [S] -step- 1.000 mm [150 voxels]
R-to-L center: 0.000
A-to-P center: 15.000 [P]
I-to-S center: 10.000 [S]

# ples_lpa_mrT2SPACEFLAIRvb17bw651subj_reoriented_3mm+tlrc.
Template Space: TLRC
Data Axes Tilt: Plumb
Data Axes Orientation:
first (x) = Right-to-Left
second (y) = Anterior-to-Posterior
third (z) = Inferior-to-Superior [-orient RAI]
R-to-L extent: -79.500 [R] -to- 79.500 [L] -step- 3.000 mm [ 54 voxels]
A-to-P extent: -79.500 [A] -to- 109.500 [P] -step- 3.000 mm [ 64 voxels]
I-to-S extent: -63.500 -to- 83.500 [S] -step- 3.000 mm [ 50 voxels]
R-to-L center: 0.000
A-to-P center: 15.000 [P]
I-to-S center: 10.000 [S]


###
### REORIENTING FROM AIL TO RAI BEFORE ALIGNMENT OF LST OUTPUT TO FUNCTIONAL SCAN
###
#Again, the reoriented_pre_al output seems to mostly align with the functional scan but is tilted to the left in the AFNI viewer.

3dresample -master pb02.subj.r01.volreg+tlrc -dxyz 1.0 1.0 1.0 -input ples_lpa_mrT2SPACEFLAIRvb17bw651subj.nii -prefix ples_lpa_mrT2SPACEFLAIRvb17bw651subj_reoriented

3dAllineate -base pb02.subj.r01.volreg+tlrc -input ples_lpa_mrT2SPACEFLAIRvb17bw651subj_reoriented+tlrc. -1Dmatrix_save al_matrix_1mm_reoriented -mast_dxyz 1 -prefix lesion_map_al_1mm_reoriented_pre_al

# ples_lpa_mrT2SPACEFLAIRvb17bw651subj_reoriented
Template Space: TLRC
Data Axes Tilt: Plumb
Data Axes Orientation:
first (x) = Right-to-Left
second (y) = Anterior-to-Posterior
third (z) = Inferior-to-Superior [-orient RAI]
R-to-L extent: -80.500 [R] -to- 80.500 [L] -step- 1.000 mm [162 voxels]
A-to-P extent: -80.500 [A] -to- 110.500 [P] -step- 1.000 mm [192 voxels]
I-to-S extent: -64.500 -to- 84.500 [S] -step- 1.000 mm [150 voxels]
R-to-L center: 0.000
A-to-P center: 15.000 [P]
I-to-S center: 10.000 [S]

# lesion_map_al_1mm_reoriented_pre_al+tlrc
Template Space: TT_N27
Data Axes Tilt: Plumb
Data Axes Orientation:
first (x) = Right-to-Left
second (y) = Anterior-to-Posterior
third (z) = Inferior-to-Superior [-orient RAI]
R-to-L extent: -80.500 [R] -to- 80.500 [L] -step- 1.000 mm [162 voxels]
A-to-P extent: -80.500 [A] -to- 110.500 [P] -step- 1.000 mm [192 voxels]
I-to-S extent: -64.500 -to- 84.500 [S] -step- 1.000 mm [150 voxels]
R-to-L center: 0.000
A-to-P center: 15.000 [P]
I-to-S center: 10.000 [S]


############################ OTHER UNSUCCESSFUL APPROACHES ############################

# Resampling FLAIR to functional scan before LST and then resample output to functional scan to address differences in orientation
# Resampling the FLAIR LST image from which the lesion map was created bc perhaps the issue is that this is a ROI mask, not the "full" image
# Resample functional scan to probability map instead
# Use 3dresample -orient AIL -input dset -prefix output instead of -master dset -dxyz
# Deoblique FLAIR before anything else (3dWarp -oblique2card -prefix T2SPACEFLAIRvb17bw651subj_card.nii T2SPACEFLAIRvb17bw651651subj.nii)
# Aligning LST output to anat_w_skull_warped+tlrc
# Putting LST output into TLRC space (@auto_tlrc -apar anat_w_skull_warped+tlrc -input ples_lpa_mrT2SPACEFLAIRvb17bw651subj.nii -suffix ples2tlrc)
# ...and some more headache
Subject Author Posted

Align ROI mask to functional scan (AIL vs RAI)

nic May 11, 2017 12:26PM

Re: Align ROI mask to functional scan (AIL vs RAI)

Daniel Glen May 11, 2017 02:50PM