image
原来的情况是:
<class 'nibabel.nifti1.Nifti1Image'>
data shape (134, 35, 152)
affine:
[[ 0.390625 0. 0. -45.4126606 ]
[ 0. 1.99999988 0. -35.06213651]
[ 0. 0. 0.390625 -34.27560146]
[ 0. 0. 0. 1. ]]
metadata:
<class 'nibabel.nifti1.Nifti1Header'> object, endian='<'
sizeof_hdr : 348
data_type : b''
db_name : b''
extents : 0
session_error : 0
regular : b''
dim_info : 0
dim : [ 3 134 35 152 1 1 1 1]
intent_p1 : 0.0
intent_p2 : 0.0
intent_p3 : 0.0
intent_code : none
datatype : float32
bitpix : 32
slice_start : 0
pixdim : [1. 0.390625 1.9999999 0.390625 1. 1. 1.
1. ]
vox_offset : 0.0
scl_slope : nan
scl_inter : nan
slice_end : 0
slice_code : unknown
xyzt_units : 0
cal_max : 0.0
cal_min : 0.0
slice_duration : 0.0
toffset : 0.0
glmax : 0
glmin : 0
descrip : b''
aux_file : b''
qform_code : unknown
sform_code : aligned
quatern_b : 0.0
quatern_c : 0.0
quatern_d : 0.0
qoffset_x : -45.412663
qoffset_y : -35.062138
qoffset_z : -34.2756
srow_x : [ 0.390625 0. 0. -45.412663]
srow_y : [ 0. 1.9999999 0. -35.062138 ]
srow_z : [ 0. 0. 0.390625 -34.2756 ]
intent_name : b''
magic : b'n+1'
经过reorder_img
之后变成了:
<class 'nibabel.nifti1.Nifti1Image'>
data shape (134, 35, 152)
affine:
[[ 0.390625 0. 0. -45.4126606 ]
[ 0. 1.99999988 0. -35.06213651]
[ 0. 0. 0.390625 -34.27560146]
[ 0. 0. 0. 1. ]]
metadata:
<class 'nibabel.nifti1.Nifti1Header'> object, endian='<'
sizeof_hdr : 348
data_type : b''
db_name : b''
extents : 0
session_error : 0
regular : b''
dim_info : 0
dim : [ 3 134 35 152 1 1 1 1]
intent_p1 : 0.0
intent_p2 : 0.0
intent_p3 : 0.0
intent_code : none
datatype : float32
bitpix : 32
slice_start : 0
pixdim : [1. 0.390625 1.9999999 0.390625 1. 1. 1.
1. ]
vox_offset : 0.0
scl_slope : nan
scl_inter : nan
slice_end : 0
slice_code : unknown
xyzt_units : 0
cal_max : 0.0
cal_min : 0.0
slice_duration : 0.0
toffset : 0.0
glmax : 0
glmin : 0
descrip : b''
aux_file : b''
qform_code : unknown
sform_code : aligned
quatern_b : 0.0
quatern_c : 0.0
quatern_d : 0.0
qoffset_x : -45.412663
qoffset_y : -35.062138
qoffset_z : -34.2756
srow_x : [ 0.390625 0. 0. -45.412663]
srow_y : [ 0. 1.9999999 0. -35.062138 ]
srow_z : [ 0. 0. 0.390625 -34.2756 ]
intent_name : b''
magic : b'n+1'
看起来好像没有什么变化,reorder_img
源码中的注释为:
Returns an image with the affine diagonal (by permuting axes).
The orientation of the new image will be RAS (Right, Anterior, Superior).
If it is impossible to get xyz ordering by permuting the axes, a
‘ValueError’ is raised.
返回带有放射对角线的图片,是不是给图片加了这个所谓的“放射对角线”这个属性呢?
暂且认为是吧,这个是3D-CNN-UNET
代码中用来缩放图片时候用到的,望有志之士给予解答。