def load(filename):
        """Load a RigidTransform from a file.

        The file format is:
        from_frame
        to_frame
        translation (space separated)
        rotation_row_0 (space separated)
        rotation_row_1 (space separated)
        rotation_row_2 (space separated)

        Parameters
        ----------
        filename : :obj:`str`
            The file to load the transform from.

        Returns
        -------
        :obj:`RigidTransform`
            The RigidTransform read from the file.

        Raises
        ------
        ValueError
            If filename's extension isn't .tf.
        """
        file_root, file_ext = os.path.splitext(filename)
        if file_ext.lower() != TF_EXTENSION:
            raise ValueError('Extension %s not supported for RigidTransform. Can only load extension %s' %(file_ext, TF_EXTENSION))

        f = open(filename, 'r')
        lines = list(f)
        from_frame = lines[0][:-1]
        to_frame = lines[1][:-1]

        t = np.zeros(3)
        t_tokens = lines[2][:-1].split()
        t[0] = float(t_tokens[0])
        t[1] = float(t_tokens[1])
        t[2] = float(t_tokens[2])

        R = np.zeros([3,3])
        r_tokens = lines[3][:-1].split()
        R[0, 0] = float(r_tokens[0])
        R[0, 1] = float(r_tokens[1])
        R[0, 2] = float(r_tokens[2])

        r_tokens = lines[4][:-1].split()
        R[1, 0] = float(r_tokens[0])
        R[1, 1] = float(r_tokens[1])
        R[1, 2] = float(r_tokens[2])

        r_tokens = lines[5][:-1].split()
        R[2, 0] = float(r_tokens[0])
        R[2, 1] = float(r_tokens[1])
        R[2, 2] = float(r_tokens[2])
        f.close()
        return RigidTransform(rotation=R, translation=t,
                              from_frame=from_frame,
                              to_frame=to_frame)
def load ( filename ) : file_root , file_ext = os . path . splitext ( filename ) if file_ext . lower ( ) != TF_EXTENSION : raise ValueError ( 'Extension %s not supported for RigidTransform. Can only load extension %s' % ( file_ext , TF_EXTENSION ) ) f = open ( filename , 'r' ) lines = list ( f ) from_frame = lines [ 0 ] [ : - 1 ] to_frame = lines [ 1 ] [ : - 1 ] t = np . zeros ( 3 ) t_tokens = lines [ 2 ] [ : - 1 ] . split ( ) t [ 0 ] = float ( t_tokens [ 0 ] ) t [ 1 ] = float ( t_tokens [ 1 ] ) t [ 2 ] = float ( t_tokens [ 2 ] ) R = np . zeros ( [ 3 , 3 ] ) r_tokens = lines [ 3 ] [ : - 1 ] . split ( ) R [ 0 , 0 ] = float ( r_tokens [ 0 ] ) R [ 0 , 1 ] = float ( r_tokens [ 1 ] ) R [ 0 , 2 ] = float ( r_tokens [ 2 ] ) r_tokens = lines [ 4 ] [ : - 1 ] . split ( ) R [ 1 , 0 ] = float ( r_tokens [ 0 ] ) R [ 1 , 1 ] = float ( r_tokens [ 1 ] ) R [ 1 , 2 ] = float ( r_tokens [ 2 ] ) r_tokens = lines [ 5 ] [ : - 1 ] . split ( ) R [ 2 , 0 ] = float ( r_tokens [ 0 ] ) R [ 2 , 1 ] = float ( r_tokens [ 1 ] ) R [ 2 , 2 ] = float ( r_tokens [ 2 ] ) f . close ( ) return RigidTransform ( rotation = R , translation = t , from_frame = from_frame , to_frame = to_frame )
Load a RigidTransform from a file.

        The file format is:
        from_frame
        to_frame
        translation (space separated)
        rotation_row_0 (space separated)
        rotation_row_1 (space separated)
        rotation_row_2 (space separated)

        Parameters
        ----------
        filename : :obj:`str`
            The file to load the transform from.

        Returns
        -------
        :obj:`RigidTransform`
            The RigidTransform read from the file.

        Raises
        ------
        ValueError
            If filename's extension isn't .tf.