def __init__(self, space, data, forward=None):
        self.space = space
        self.image_space = self.space[0]
        self.affine_space = self.space[1]
        self.rest_space = self.space[2]
        self.deformation_space = ProductSpace(self.affine_space,
                                              self.rest_space)
        self.data = data
        if forward is None:
            self.forward = IdentityOperator(self.image_space)
        else:
            self.forward = forward

        self.datafit = 0.5 * L2NormSquared(self.image_space).translated(
            self.data)
        self.embedding_affine_rest = ops.Embedding_Affine_Rest(
            self.deformation_space, self.image_space.tangent_bundle)
        self.embedding_affine = ops.Embedding_Affine(
            self.affine_space, self.image_space.tangent_bundle)

        super(DataFitL2DispAffRest, self).__init__(space=space,
                                                   linear=False,
                                                   grad_lipschitz=np.nan)
    def __init__(self, space, datafit, forward=None):
        self.space = space
        self.image_space = self.space[0]
        self.affine_space = self.space[1]

        if forward is None:
            self.forward = IdentityOperator(self.image_space)
        else:
            self.forward = forward

        self.datafit = datafit

        if isinstance(self.image_space, odl.ProductSpace):
            tangent_bundle = self.image_space[0].tangent_bundle
        else:
            tangent_bundle = self.image_space.tangent_bundle

        self.embedding = ops.Embedding_Affine(self.affine_space,
                                              tangent_bundle)

        super(DataFitDisp, self).__init__(space=space,
                                          linear=False,
                                          grad_lipschitz=np.nan)
                                  niter=None,
                                  callback=cb,
                                  L=[1e2, 1e4],
                                  tol=tol)

                niter_diff = [niter[0]] + list(np.diff(niter))

                clim = [0, 1]
                proj = odl.solvers.IndicatorBox(X_res,
                                                lower=clim[0],
                                                upper=clim[1]).proximal(1)

                for ni, nid in zip(niter, niter_diff):
                    recon.run(nid)

                    vf = ops.Embedding_Affine(Yaff, V_plot)(recon.x[1])
                    plt.quiver(x, y, vf[0], vf[1], color='red'),
                    plt.axis('equal'),
                    plt.axis([-1.3, 1.3, -1.3, 1.3]),
                    #                        plt.axis('off'),
                    plt.gca().set_aspect('equal', adjustable='box'),
                    if save2Disk is True:
                        file_out_ni = '{}_{:04d}'.format(file_out, ni)
                        file_out_def_ni = '{}_def_{:04d}'.format(file_out, ni)
                        plt.savefig(folder_out + '/' + file_out_def_ni +
                                    '.png',
                                    bbox_inches='tight',
                                    pad_inches=0,
                                    transparent=True,
                                    dpi=600,
                                    format='png')