2323from ..openers import ImageOpener
2424from ..onetime import setattr_on_read as one_time
2525from ..pydicom_compat import tag_for_keyword , Sequence
26+ from ..deprecated import deprecate_with_version
2627
2728
2829class WrapperError (Exception ):
@@ -95,7 +96,7 @@ class Wrapper(object):
9596
9697 Methods:
9798
98- * get_affine()
99+ * get_affine() (deprecated, use affine property instead)
99100 * get_data()
100101 * get_pixel_array()
101102 * is_same_series(other)
@@ -104,6 +105,7 @@ class Wrapper(object):
104105
105106 Attributes and things that look like attributes:
106107
108+ * affine : (4, 4) array
107109 * dcm_data : object
108110 * image_shape : tuple
109111 * image_orient_patient : (3,2) array
@@ -286,18 +288,19 @@ def get(self, key, default=None):
286288 """ Get values from underlying dicom data """
287289 return self .dcm_data .get (key , default )
288290
291+ @deprecate_with_version ('get_affine method is deprecated.\n '
292+ 'Please use the ``img.affine`` property '
293+ 'instead.' ,
294+ '2.5.1' , '4.0' )
289295 def get_affine (self ):
290- """ Return mapping between voxel and DICOM coordinate system
296+ return self . affine
291297
292- Parameters
293- ----------
294- None
298+ @ property
299+ def affine ( self ):
300+ """ Mapping between voxel and DICOM coordinate system
295301
296- Returns
297- -------
298- aff : (4,4) affine
299- Affine giving transformation between voxels in data array and
300- mm in the DICOM patient coordinate system.
302+ (4, 4) affine matrix giving transformation between voxels in data array
303+ and mm in the DICOM patient coordinate system.
301304 """
302305 # rotation matrix already accounts for the ij transpose in the
303306 # DICOM image orientation patient transform. So. column 0 is
0 commit comments