class_docstr: Class to wrap general DICOM files
  
  Methods:
  
  * get_data()
  * get_pixel_array()
  * is_same_series(other)
  * __getitem__ : return attributes from `dcm_data`
  * get(key[, default]) - as usual given __getitem__ above
  
  Attributes and things that look like attributes:
  
  * affine : (4, 4) array
  * dcm_data : object
  * image_shape : tuple
  * image_orient_patient : (3,2) array
  * slice_normal : (3,) array
  * rotation_matrix : (3,3) array
  * voxel_sizes : tuple length 3
  * image_position : sequence length 3
  * slice_indicator : float
  * series_signature : tuple
docstr: Return rotation matrix between array indices and mm
  
  Note that we swap the two columns of the 'ImageOrientPatient'
  when we create the rotation matrix.  This is takes into account
  the slightly odd ij transpose construction of the DICOM
  orientation fields - see doc/theory/dicom_orientaiton.rst.
docstr_tok: ["Return","rotation","matrix","between","array","indices","and","mm","Note","that","we","swap","the","two","columns","of","the","'ImageOrientPatient'","when","we","create","the","rotation","matrix",".","This","is","takes","into","account","the","slightly","odd","ij","transpose","construction","of","the","DICOM","orientation","fields","-","see","doc\/theory\/dicom_orientaiton.rst","."]
code: def rotation_matrix(self):
      """Return rotation matrix between array indices and mm
  
      Note that we swap the two columns of the 'ImageOrientPatient'
      when we create the rotation matrix.  This is takes into account
      the slightly odd ij transpose construction of the DICOM
      orientation fields - see doc/theory/dicom_orientaiton.rst.
      """
      iop = self.image_orient_patient
      s_norm = self.slice_normal
      if iop is None or s_norm is None:
          return None
      R = np.eye(3)
      # np.fliplr(iop) gives matrix F in
      # doc/theory/dicom_orientation.rst The fliplr accounts for the
      # fact that the first column in ``iop`` refers to changes in
      # column index, and the second to changes in row index.
      R[:, :2] = np.fliplr(iop)
      R[:, 2] = s_norm
      # check this is in fact a rotation matrix. Error comes from compromise
      # motivated in ``doc/source/notebooks/ata_error.ipynb``, and from
      # discussion at https://github.com/nipy/nibabel/pull/156
      if not np.allclose(np.eye(3), np.dot(R, R.T), atol=5e-5):
          raise WrapperPrecisionError(
              "Rotation matrix not nearly orthogonal"
          )
      return R
  
imports: import operator
  import warnings
  import numpy
  from nibabel.optpkg import optional_package
  from ..onetime import auto_attr
  from ..openers import ImageOpener
  from .None import csareader
  from .dwiparams import B2q, nearest_pos_semi_def, q2bg
label_desc: Use image node_id 5 for calling the Wrapper obj's underlying member method code with example usage: obj.rotation_matrix() and returns: R, None