Skip to content

Commit

Permalink
[bug patch] #10 Position correction apply for PV5 only
Browse files Browse the repository at this point in the history
  • Loading branch information
dvm-shlee committed Jun 5, 2020
1 parent 8838269 commit b86afb7
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 22 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ GNU General Public License v3.0
Lee, Sung-Ho, Ban, Woomi, & Shih, Yen-Yu Ian. (2020, June 4). BrkRaw/bruker: BrkRaw v0.3.3 (Version 0.3.3).
Zenodo. http://doi.org/10.5281/zenodo.3877179


**BibTeX**
```
@software{lee_sung_ho_2020_3877179,
Expand Down
2 changes: 1 addition & 1 deletion brkraw/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .lib import *

__version__ = '0.3.3'
__version__ = '0.3.4b0'
__all__ = ['BrukerLoader', '__version__']


Expand Down
6 changes: 5 additions & 1 deletion brkraw/lib/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,11 @@ def _get_affine(self, visu_pars, method):
orient_info = self._get_orient_info(visu_pars, method)
slice_orient_map = {0: 'sagital', 1: 'coronal', 2: 'axial'}
num_slice_packs = slice_info['num_slice_packs']
subj_pose = orient_info['subject_position']
version = get_value(visu_pars, 'VisuVersion')
if version == 1: # PV 5.1 required the position correction
subj_pose = orient_info['subject_position']
else: # PV 6.01 does not
subj_pose = None
subj_type = orient_info['subject_type']

if num_slice_packs > 1:
Expand Down
40 changes: 20 additions & 20 deletions brkraw/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,26 @@ def build_affine_from_orient_info(resol, rmat, pose,

# convert space from image to subject
# below positions are all reflext human-based position
# if subj_pose == 'Head_Supine':
# affine = apply_rotate(affine, rad_z=np.pi)
# elif subj_pose == 'Head_Prone':
# pass
# # From here, not urgent, extra work to determine correction matrix needed.
# elif subj_pose == 'Head_Left':
# affine = apply_rotate(affine, rad_z=np.pi/2)
# elif subj_pose == 'Head_Right':
# affine = apply_rotate(affine, rad_z=-np.pi/2)
# elif subj_pose in ['Foot_Supine', 'Tail_Supine']:
# affine = apply_rotate(affine, rad_x=np.pi)
# elif subj_pose in ['Foot_Prone', 'Tail_Prone']:
# pass
# # affine = apply_rotate(affine, rad_y=np.pi)
# elif subj_pose in ['Foot_Left', 'Tail_Left']:
# affine = apply_rotate(affine, rad_z=np.pi/2)
# elif subj_pose in ['Foot_Right', 'Tail_Right']:
# affine = apply_rotate(affine, rad_z=-np.pi/2)
# else: # in case Bruker put additional value for this header
# raise Exception(ERROR_MESSAGES['NotIntegrated'])
if subj_pose:
if subj_pose == 'Head_Supine':
affine = apply_rotate(affine, rad_z=np.pi)
elif subj_pose == 'Head_Prone':
pass
# From here, not urgent, extra work to determine correction matrix needed.
elif subj_pose == 'Head_Left':
affine = apply_rotate(affine, rad_z=np.pi/2)
elif subj_pose == 'Head_Right':
affine = apply_rotate(affine, rad_z=-np.pi/2)
elif subj_pose in ['Foot_Supine', 'Tail_Supine']:
affine = apply_rotate(affine, rad_x=np.pi)
elif subj_pose in ['Foot_Prone', 'Tail_Prone']:
affine = apply_rotate(affine, rad_y=np.pi)
elif subj_pose in ['Foot_Left', 'Tail_Left']:
affine = apply_rotate(affine, rad_z=np.pi/2)
elif subj_pose in ['Foot_Right', 'Tail_Right']:
affine = apply_rotate(affine, rad_z=-np.pi/2)
else: # in case Bruker put additional value for this header
raise Exception(ERROR_MESSAGES['NotIntegrated'])

if subj_type != 'Biped':
# correct subject space if not biped (human or non-human primates)
Expand Down

0 comments on commit b86afb7

Please sign in to comment.