I tried out this grain-free cauliflower crust pizza recipe that shows how to make cauliflower pizza crust in a few simple steps. Simmer your favorite sauce, pick out your favorite toppings and get ready to try a new kind of pizza � packed with a nutritious vegetable as its base! Ingredients: The core ingredients for a basic cauliflower crust are simple � cauliflower, Parmesan cheese and... Cauliflower, pine nuts, ground golden flax, hemp seeds, garlic, basil, oregano and sun-dried tomatoes all come together to make a delicious, healthy, nutritionally packed crust. A little bit of lemon juice and optional nutritional yeast round out the flavor. You could eat this without any topping!
For the pizza: Preheat the oven to 425 degrees F. Line a rimmed baking sheet with parchment paper. Pulse the cauliflower florets in a food processor to a fine snowy �... Paleo Cauliflower Pizza Crust Recipe June 8, 2015 By Caitlin Weeks I have always wanted to make a cauliflower crust that was dairy free becasue many low carb recipes have cheese which can not be tolerated by Paleo people.
To create a vegan alternative to this cauliflower pizza base recipe, skip adding the egg and parmesan and double the amount of chia seeds to help the cauliflower pizza base recipe stay together � you can mix it up by adding some flax seeds to the mixture as well. how to move pictures from messages to gallery on android This is another delicious healthy pizza recipe for you to try! Making your pizza base with cauliflower is a great way to get some extra nutrients (especially vitamin C!) into your diet.
Cauliflower. When it comes to vegetables, cauliflower is king. One thing which I refuse to do with cauliflower is make a cauliflower crust pizza with it on a consistent basis.
Cauliflower Pizza Recipe. This cauliflower pizza recipe is the ideal alternative for people like me who try to eat healthily but find that giving up our favourite pizza is just one bridge too far.


In case your mattress lacks areas to put away your stuff, subsequently using a beautyrest silver mattress reviews may be the answer. An storage seat is essentially due to a furniture creation. This seat includes an additional function, which is an storage to store things. The benefit of the storage bench isn't just as a multifunctional furniture . however, it is also for sale in numerous shapes and decoration concepts. A queen size mattress has the ability to add a elegance to your mattress. An storage seat has lots of features which may get your lifestyle simpler. They really are now.
So, do you want different forms of beautyrest silver mattress reviews on your mattress? Very well, then, you might prefer to consider paying for the set created by Charlton house. Charlton home-made a fantastic job using its simmons beautyrest plush mattress considering that the design is great. The plan is clearly using the conventional type, yet this collection is kind of different in comparison to the previous one as Cali Panel utilizes a styling named louis-philippe design, evident with its use of wood gloss to its household furniture. Your mattress would appear better using this set and you also definitely would never regret it!
If you want to have a hint of classic or elegance on your mattress, putting in the beautyrest silver mattress reviews are possibly the perfect answer for you personally. Ashley mattress collections are all considered to own a traditional accent within their sets. The colours of this Ashley mattress collections are additionally dominated by dark shades such as black or dark brownish. These mattress places from Ashley are usually ideal for the broad mattress. Exactly enjoy any room, you will find three or more places which you have to pay for interest. The initial may be that the simmons beautyrest mattress. With dim colours and traditional design, this mattress can include the grandness to a room.


text:
<?php
/**
 * Post presenter class.
 *
 * @author    MyBB Group
 * @version   2.0.0
 * @package   mybb/core
 * @license   http://www.mybb.com/licenses/bsd3 BSD-3
 */

namespace MyBB\Core\Presenters;

use Illuminate\Contracts\Auth\Guard;
use Illuminate\Foundation\Application;
use McCool\LaravelAutoPresenter\BasePresenter;
use MyBB\Core\Database\Models\Post as PostModel;
use MyBB\Core\Database\Models\User as UserModel;
use MyBB\Core\Likes\Database\Models\Like;

class Post extends BasePresenter
{
	/** @var PostModel $wrappedObject */

	/**
	 * @var Guard $guard
	 */
	private $guard;

	/**
	 * @var Application
	 */
	private $app;

	/**
	 * @param PostModel   $resource The post being wrapped by this presenter.
	 * @param Guard       $guard
	 * @param Application $app
	 */
	public function __construct(PostModel $resource, Guard $guard, Application $app)
	{
		parent::__construct($resource);
		$this->guard = $guard;
		$this->app = $app;
	}

	/**
	 * @return User
	 */
	public function author()
	{
		if ($this->wrappedObject->user_id == null) {
			$user = new UserModel();
			$user->id = 0;
			if ($this->wrappedObject->username != null) {
				$user->name = $this->wrappedObject->username;
			} else {
				$user->name = trans('general.guest');
			}

			$decoratedUser = $this->app->make('MyBB\Core\Presenters\User', [$user]);

			return $decoratedUser;
		}

		if ($this->wrappedObject->author instanceof UserModel) {
			$this->wrappedObject->author = $this->app->make(
				'MyBB\Core\Presenters\User',
				[$this->wrappedObject->author]
			);
		}

		return $this->wrappedObject->author;
	}

	/**
	 * Check whether the current user has liked the post.
	 *
	 * @return bool Whether the post has been liked by the current user.
	 */
	public function hasLikedPost()
	{
		if ($this->guard->check()) {
			$user = $this->guard->user();

			$containsLike = $this->wrappedObject->likes->contains(function (
				$key,
				Like $like
			) use (
				&$likes,
				&$numLikesToList,
				$user
			) {
				if ($like->user->id === $user->getAuthIdentifier()) {
					return true;
				}

				return false;
			});

			return ($containsLike !== false);
		}

		return false;
	}

	/**
	 * @return Topic
	 */
	public function topic()
	{
		return $this->getWrappedObject()->topic;
	}
}

redpajama_set_name: RedPajamaGithub


text:
The Sheriff is an album by American jazz group the Modern Jazz Quartet featuring performances recorded in 1963 and released on the Atlantic label.

Reception
The AllMusic review stated: "The Sheriff features the Modern Jazz Quartet in fine swinging form. The program is not as sharply focused as on some of the earlier Atlantic releases, but it is compelling nonetheless".

Track listing
All compositions by John Lewis, except as indicated
 "The Sheriff" - 2:41
 "In a Crowd" - 3:05
 "Bachianas Brasileiras" (Heitor Villa-Lobos) - 5:44
 "Mean to Me" (Fred E. Ahlert, Roy Turk) - 4:24
 "Natural Affection" - 4:08
 "Donnie's Theme" - 4:13
 "Manhã de Carnaval" (Luiz Bonfá) - 6:06

Personnel
Milt Jackson - vibraphone
John Lewis - piano
Percy Heath - bass
Connie Kay - drums
Nesuhi Ertegun - producer
Tom Dowd - recording engineer
Stanisław Zagórski - cover art

References

1964 albums
Atlantic Records albums
Modern Jazz Quartet albums
Albums produced by Nesuhi Ertegun

redpajama_set_name: RedPajamaWikipedia


text:
"""  Classes and functions for Symmetric Diffeomorphic Registration """

from __future__ import print_function
import abc
from dipy.utils.six import with_metaclass
import numpy as np
import numpy.linalg as npl
import scipy as sp
import nibabel as nib
from dipy.align import vector_fields as vfu
from dipy.align import floating
from dipy.align import VerbosityLevels
from dipy.align import Bunch
from dipy.align.scalespace import ScaleSpace

RegistrationStages = Bunch(INIT_START=0,
                           INIT_END=1,
                           OPT_START=2,
                           OPT_END=3,
                           SCALE_START=4,
                           SCALE_END=5,
                           ITER_START=6,
                           ITER_END=7)
r"""Registration Stages

This enum defines the different stages which the Volumetric Registration
may be in. The value of the stage is passed as a parameter to the call-back
function so that it can react accordingly.

INIT_START: optimizer initialization starts
INIT_END: optimizer initialization ends
OPT_START: optimization starts
OPT_END: optimization ends
SCALE_START: optimization at a new scale space resolution starts
SCALE_END: optimization at the current scale space resolution ends
ITER_START: a new iteration starts
ITER_END: the current iteration ends

"""

def mult_aff(A, B):
    r"""Returns the matrix product A.dot(B) considering None as the identity

    Parameters
    ----------
    A : array, shape (n,k)
    B : array, shape (k,m)

    Returns
    -------
    The matrix product A.dot(B). If any of the input matrices is None, it is
    treated as the identity matrix. If both matrices are None, None is returned
    """
    if A is None:
        return B
    elif B is None:
        return A
    return A.dot(B)

def get_direction_and_spacings(affine, dim):
    r"""Extracts the rotational and spacing components from a matrix

    Extracts the rotational and spacing (voxel dimensions) components from a
    matrix. An image gradient represents the local variation of the image's
    gray values per voxel. Since we are iterating on the physical space, we
    need to compute the gradients as variation per millimeter, so we need to
    divide each gradient's component by the voxel size along the corresponding
    axis, that's what the spacings are used for. Since the image's gradients
    are oriented along the grid axes, we also need to re-orient the gradients
    to be given in physical space coordinates.

    Parameters
    ----------
    affine : array, shape (k, k), k = 3, 4
        the matrix transforming grid coordinates to physical space.

    Returns
    -------
    direction : array, shape (k-1, k-1)
        the rotational component of the input matrix
    spacings : array, shape (k-1,)
        the scaling component (voxel size) of the matrix

    """
    if affine is None:
        return np.eye(dim), np.ones(dim)
    dim = affine.shape[1]-1
    # Temporary hack: get the zooms by building a nifti image
    affine4x4 = np.eye(4)
    empty_volume = np.zeros((0, 0, 0))
    affine4x4[:dim, :dim] = affine[:dim, :dim]
    affine4x4[:dim, 3] = affine[:dim, dim-1]
    nib_nifti = nib.Nifti1Image(empty_volume, affine4x4)
    scalings = np.asarray(nib_nifti.header.get_zooms())
    scalings = np.asarray(scalings[:dim], dtype=np.float64)
    A = affine[:dim, :dim]
    return A.dot(np.diag(1.0/scalings)), scalings

class DiffeomorphicMap(object):
    def __init__(self,
                 dim,
                 disp_shape,
                 disp_grid2world=None,
                 domain_shape=None,
                 domain_grid2world=None,
                 codomain_shape=None,
                 codomain_grid2world=None,
                 prealign=None):
        r""" DiffeomorphicMap

        Implements a diffeomorphic transformation on the physical space. The
        deformation fields encoding the direct and inverse transformations
        share the same domain discretization (both the discretization grid
        shape and voxel-to-space matrix). The input coordinates (physical
        coordinates) are first aligned using prealign, and then displaced
        using the corresponding vector field interpolated at the aligned
        coordinates.

        Parameters
        ----------
        dim : int, 2 or 3
            the transformation's dimension
        disp_shape : array, shape (dim,)
            the number of slices (if 3D), rows and columns of the deformation
            field's discretization
        disp_grid2world : the voxel-to-space transform between the def. fields
            grid and space
        domain_shape : array, shape (dim,)
            the number of slices (if 3D), rows and columns of the default
            discretizatio of this map's domain
        domain_grid2world : array, shape (dim+1, dim+1)
            the default voxel-to-space transformation between this map's
            discretization and physical space
        codomain_shape : array, shape (dim,)
            the number of slices (if 3D), rows and columns of the images that
            are 'normally' warped using this transformation in the forward
            direction (this will provide default transformation parameters to
            warp images under this transformation). By default, we assume that
            the inverse transformation is 'normally' used to warp images with
            the same discretization and voxel-to-space transformation as the
            deformation field grid.
        codomain_grid2world : array, shape (dim+1, dim+1)
            the voxel-to-space transformation of images that are 'normally'
            warped using this transformation (in the forward direction).
        prealign : array, shape (dim+1, dim+1)
            the linear transformation to be applied to align input images to
            the reference space before warping under the deformation field.

        """

        self.dim = dim

        if(disp_shape is None):
            raise ValueError("Invalid displacement field discretization")

        self.disp_shape = np.asarray(disp_shape, dtype=np.int32)

        # If the discretization affine is None, we assume it's the identity
        self.disp_grid2world = disp_grid2world
        if(self.disp_grid2world is None):
            self.disp_world2grid = None
        else:
            self.disp_world2grid = npl.inv(self.disp_grid2world)

        # If domain_shape isn't provided, we use the map's discretization shape
        if(domain_shape is None):
            self.domain_shape = self.disp_shape
        else:
            self.domain_shape = np.asarray(domain_shape, dtype=np.int32)
        self.domain_grid2world = domain_grid2world
        if(domain_grid2world is None):
            self.domain_world2grid = None
        else:
            self.domain_world2grid = npl.inv(domain_grid2world)

        # If codomain shape was not provided, we assume it is an endomorphism:
        # use the same domain_shape and codomain_grid2world as the field domain
        if codomain_shape is None:
            self.codomain_shape = self.domain_shape
        else:
            self.codomain_shape = np.asarray(codomain_shape, dtype=np.int32)
        self.codomain_grid2world = codomain_grid2world
        if codomain_grid2world is None:
            self.codomain_world2grid = None
        else:
            self.codomain_world2grid = npl.inv(codomain_grid2world)

        self.prealign = prealign
        if prealign is None:
            self.prealign_inv = None
        else:
            self.prealign_inv = npl.inv(prealign)

        self.is_inverse = False
        self.forward = None
        self.backward = None

    def interpret_matrix(self, obj):
        ''' Try to interpret `obj` as a matrix

        Some operations are performed faster if we know in advance if a matrix
        is the identity (so we can skip the actual matrix-vector
        multiplication). This function returns None if the given object
        is None or the 'identity' string. It returns the same object if it is
        a numpy array. It raises an exception otherwise.

        Parameters
        ----------
        obj : object
            any object

        Returns
        ----------
        obj : object
            the same object given as argument if `obj` is None or a numpy
            array. None if `obj` is the 'identity' string.
        '''
        if (obj is None) or isinstance(obj, np.ndarray):
            return obj
        if isinstance(obj, str) and (obj == 'identity'):
            return None
        raise ValueError('Invalid matrix')

    def get_forward_field(self):
        r"""Deformation field to transform an image in the forward direction

        Returns the deformation field that must be used to warp an image under
        this transformation in the forward direction (note the 'is_inverse'
        flag).
        """
        if self.is_inverse:
            return self.backward
        else:
            return self.forward

    def get_backward_field(self):
        r"""Deformation field to transform an image in the backward direction

        Returns the deformation field that must be used to warp an image under
        this transformation in the backward direction (note the 'is_inverse'
        flag).
        """
        if self.is_inverse:
            return self.forward
        else:
            return self.backward

    def allocate(self):
        r"""Creates a zero displacement field

        Creates a zero displacement field (the identity transformation).
        """
        self.forward = np.zeros(tuple(self.disp_shape) + (self.dim,),
                                dtype=floating)
        self.backward = np.zeros(tuple(self.disp_shape) + (self.dim,),
                                 dtype=floating)

    def _get_warping_function(self, interpolation):
        r"""Appropriate warping function for the given interpolation type

        Returns the right warping function from vector_fields that must be
        called for the specified data dimension and interpolation type
        """
        if self.dim == 2:
            if interpolation == 'linear':
                return vfu.warp_2d
            else:
                return vfu.warp_2d_nn
        else:
            if interpolation == 'linear':
                return vfu.warp_3d
            else:
                return vfu.warp_3d_nn

    def _warp_forward(self, image, interpolation='linear',
                      image_world2grid=None, out_shape=None,
                      out_grid2world=None):
        r"""Warps an image in the forward direction

        Deforms the input image under this diffeomorphic map in the forward
        direction. Since the mapping is defined in the physical space, the user
        must specify the sampling grid shape and its space-to-voxel mapping.
        By default, the transformation will use the discretization information
        given at initialization.

        Parameters
        ----------
        image : array, shape (s, r, c) if dim = 3 or (r, c) if dim = 2
            the image to be warped under this transformation in the forward
            direction
        interpolation : string, either 'linear' or 'nearest'
            the type of interpolation to be used for warping, either 'linear'
            (for k-linear interpolation) or 'nearest' for nearest neighbor
        image_world2grid : array, shape (dim+1, dim+1)
            the transformation bringing world (space) coordinates to voxel
            coordinates of the image given as input
        out_shape : array, shape (dim,)
            the number of slices, rows and columns of the desired warped image
        out_grid2world : the transformation bringing voxel coordinates of the
            warped image to physical space

        Returns
        -------
        warped : array, shape = out_shape or self.codomain_shape if None
            the warped image under this transformation in the forward direction

        Notes
        -----

        A diffeomorphic map must be thought as a mapping between points
        in space. Warping an image J towards an image I means transforming
        each voxel with (discrete) coordinates i in I to (floating-point) voxel
        coordinates j in J. The transformation we consider 'forward' is
        precisely mapping coordinates i from the input image to coordinates j
        from reference image, which has the effect of warping an image with
        reference discretization (typically, the "static image") "towards" an
        image with input discretization (typically, the "moving image"). More
        precisely, the warped image is produced by the following interpolation:

        warped[i] = image[W * forward[Dinv * P * S * i] + W * P * S * i )]

        where i denotes the coordinates of a voxel in the input grid, W is
        the world-to-grid transformation of the image given as input, Dinv
        is the world-to-grid transformation of the deformation field
        discretization, P is the pre-aligning matrix (transforming input
        points to reference points), S is the voxel-to-space transformation of
        the sampling grid (see comment below) and forward is the forward
        deformation field.

        If we want to warp an image, we also must specify on what grid we
        want to sample the resulting warped image (the images are considered as
        points in space and its representation on a grid depends on its
        grid-to-space transform telling us for each grid voxel what point in
        space we need to bring via interpolation). So, S is the matrix that
        converts the sampling grid (whose shape is given as parameter
        'out_shape' ) to space coordinates.
        """
        # if no world-to-image transform is provided, we use the codomain info
        if image_world2grid is None:
            image_world2grid = self.codomain_world2grid
        # if no sampling info is provided, we use the domain info
        if out_shape is None:
            if self.domain_shape is None:
                raise ValueError('Unable to infer sampling info. '
                                 'Provide a valid out_shape.')
            out_shape = self.domain_shape
        else:
            out_shape = np.asarray(out_shape, dtype=np.int32)
        if out_grid2world is None:
            out_grid2world = self.domain_grid2world

        W = self.interpret_matrix(image_world2grid)
        Dinv = self.disp_world2grid
        P = self.prealign
        S = self.interpret_matrix(out_grid2world)

        # this is the matrix which we need to multiply the voxel coordinates
        # to interpolate on the forward displacement field ("in"side the
        # 'forward' brackets in the expression above)
        affine_idx_in = mult_aff(Dinv, mult_aff(P, S))

        # this is the matrix which we need to multiply the voxel coordinates
        # to add to the displacement ("out"side the 'forward' brackets in the
        # expression above)
        affine_idx_out = mult_aff(W, mult_aff(P, S))

        # this is the matrix which we need to multiply the displacement vector
        # prior to adding to the transformed input point
        affine_disp = W

        # Convert the data to required types to use the cythonized functions
        if interpolation == 'nearest':
            if image.dtype is np.dtype('float64') and floating is np.float32:
                image = image.astype(floating)
            elif image.dtype is np.dtype('int64'):
                image = image.astype(np.int32)
        else:
            image = np.asarray(image, dtype=floating)

        warp_f = self._get_warping_function(interpolation)

        warped = warp_f(image, self.forward, affine_idx_in, affine_idx_out,
                        affine_disp, out_shape)
        return warped

    def _warp_backward(self, image, interpolation='linear',
                       image_world2grid=None, out_shape=None,
                       out_grid2world=None):
        r"""Warps an image in the backward direction

        Deforms the input image under this diffeomorphic map in the backward
        direction. Since the mapping is defined in the physical space, the user
        must specify the sampling grid shape and its space-to-voxel mapping.
        By default, the transformation will use the discretization information
        given at initialization.

        Parameters
        ----------
        image : array, shape (s, r, c) if dim = 3 or (r, c) if dim = 2
            the image to be warped under this transformation in the backward
            direction
        interpolation : string, either 'linear' or 'nearest'
            the type of interpolation to be used for warping, either 'linear'
            (for k-linear interpolation) or 'nearest' for nearest neighbor
        image_world2grid : array, shape (dim+1, dim+1)
            the transformation bringing world (space) coordinates to voxel
            coordinates of the image given as input
        out_shape : array, shape (dim,)
            the number of slices, rows and columns of the desired warped image
        out_grid2world : the transformation bringing voxel coordinates of the
            warped image to physical space

        Returns
        -------
        warped : array, shape = out_shape or self.domain_shape if None
            the warped image under this transformation in the backward
            direction

        Notes
        -----

        A diffeomorphic map must be thought as a mapping between points
        in space. Warping an image J towards an image I means transforming
        each voxel with (discrete) coordinates i in I to (floating-point) voxel
        coordinates j in J. The transformation we consider 'backward' is
        precisely mapping coordinates i from the reference grid to coordinates
        j from the input image (that's why it's "backward"), which has the
        effect of warping the input image (moving) "towards" the reference.
        More precisely, the warped image is produced by the following
        interpolation:

        warped[i]=image[W * Pinv * backward[Dinv * S * i] + W * Pinv * S * i )]

        where i denotes the coordinates of a voxel in the input grid, W is
        the world-to-grid transformation of the image given as input, Dinv
        is the world-to-grid transformation of the deformation field
        discretization, Pinv is the pre-aligning matrix's inverse (transforming
        reference points to input points), S is the grid-to-space
        transformation of the sampling grid (see comment below) and backward is
        the backward deformation field.

        If we want to warp an image, we also must specify on what grid we
        want to sample the resulting warped image (the images are considered as
        points in space and its representation on a grid depends on its
        grid-to-space transform telling us for each grid voxel what point in
        space we need to bring via interpolation). So, S is the matrix that
        converts the sampling grid (whose shape is given as parameter
        'out_shape' ) to space coordinates.

        """
        # if no world-to-image transform is provided, we use the domain info
        if image_world2grid is None:
            image_world2grid = self.domain_world2grid

        # if no sampling info is provided, we use the codomain info
        if out_shape is None:
            if self.codomain_shape is None:
                msg = 'Unknown sampling info. Provide a valid out_shape.'
                raise ValueError(msg)
            out_shape = self.codomain_shape
        if out_grid2world is None:
            out_grid2world = self.codomain_grid2world

        W = self.interpret_matrix(image_world2grid)
        Dinv = self.disp_world2grid
        Pinv = self.prealign_inv
        S = self.interpret_matrix(out_grid2world)

        # this is the matrix which we need to multiply the voxel coordinates
        # to interpolate on the backward displacement field ("in"side the
        # 'backward' brackets in the expression above)
        affine_idx_in = mult_aff(Dinv, S)

        # this is the matrix which we need to multiply the voxel coordinates
        # to add to the displacement ("out"side the 'backward' brackets in the
        # expression above)
        affine_idx_out = mult_aff(W, mult_aff(Pinv, S))

        # this is the matrix which we need to multiply the displacement vector
        # prior to adding to the transformed input point
        affine_disp = mult_aff(W, Pinv)

        if interpolation == 'nearest':
            if image.dtype is np.dtype('float64') and floating is np.float32:
                image = image.astype(floating)
            elif image.dtype is np.dtype('int64'):
                image = image.astype(np.int32)
        else:
            image = np.asarray(image, dtype=floating)

        warp_f = self._get_warping_function(interpolation)

        warped = warp_f(image, self.backward, affine_idx_in, affine_idx_out,
                        affine_disp, out_shape)

        return warped

    def transform(self, image, interpolation='linear', image_world2grid=None,
                  out_shape=None, out_grid2world=None):
        r"""Warps an image in the forward direction

        Transforms the input image under this transformation in the forward
        direction. It uses the "is_inverse" flag to switch between "forward"
        and "backward" (if is_inverse is False, then transform(...) warps the
        image forwards, else it warps the image backwards).

        Parameters
        ----------
        image : array, shape (s, r, c) if dim = 3 or (r, c) if dim = 2
            the image to be warped under this transformation in the forward
            direction
        interpolation : string, either 'linear' or 'nearest'
            the type of interpolation to be used for warping, either 'linear'
            (for k-linear interpolation) or 'nearest' for nearest neighbor
        image_world2grid : array, shape (dim+1, dim+1)
            the transformation bringing world (space) coordinates to voxel
            coordinates of the image given as input
        out_shape : array, shape (dim,)
            the number of slices, rows and columns of the desired warped image
        out_grid2world : the transformation bringing voxel coordinates of the
            warped image to physical space

        Returns
        -------
        warped : array, shape = out_shape or self.codomain_shape if None
            the warped image under this transformation in the forward direction

        Notes
        -----
        See _warp_forward and _warp_backward documentation for further
        information.
        """
        if out_shape is not None:
            out_shape = np.asarray(out_shape, dtype=np.int32)
        if self.is_inverse:
            warped = self._warp_backward(image, interpolation,
                                         image_world2grid, out_shape,
                                         out_grid2world)
        else:
            warped = self._warp_forward(image, interpolation, image_world2grid,
                                        out_shape, out_grid2world)
        return np.asarray(warped)

    def transform_inverse(self, image, interpolation='linear',
                          image_world2grid=None, out_shape=None,
                          out_grid2world=None):
        r"""Warps an image in the backward direction

        Transforms the input image under this transformation in the backward
        direction. It uses the "is_inverse" flag to switch between "forward"
        and "backward" (if is_inverse is False, then transform_inverse(...)
        warps the image backwards, else it warps the image forwards)

        Parameters
        ----------
        image : array, shape (s, r, c) if dim = 3 or (r, c) if dim = 2
            the image to be warped under this transformation in the forward
            direction
        interpolation : string, either 'linear' or 'nearest'
            the type of interpolation to be used for warping, either 'linear'
            (for k-linear interpolation) or 'nearest' for nearest neighbor
        image_world2grid : array, shape (dim+1, dim+1)
            the transformation bringing world (space) coordinates to voxel
            coordinates of the image given as input
        out_shape : array, shape (dim,)
            the number of slices, rows and columns of the desired warped image
        out_grid2world : the transformation bringing voxel coordinates of the
            warped image to physical space

        Returns
        -------
        warped : array, shape = out_shape or self.codomain_shape if None
            warped image under this transformation in the backward direction

        Notes
        -----
        See _warp_forward and _warp_backward documentation for further
        information.
        """
        if self.is_inverse:
            warped = self._warp_forward(image, interpolation, image_world2grid,
                                        out_shape, out_grid2world)
        else:
            warped = self._warp_backward(image, interpolation,
                                         image_world2grid, out_shape,
                                         out_grid2world)
        return np.asarray(warped)

    def inverse(self):
        r"""Inverse of this DiffeomorphicMap instance

        Returns a diffeomorphic map object representing the inverse of this
        transformation. The internal arrays are not copied but just referenced.

        Returns
        -------
        inv : DiffeomorphicMap object
            the inverse of this diffeomorphic map.

        """
        inv = DiffeomorphicMap(self.dim,
                               self.disp_shape,
                               self.disp_grid2world,
                               self.domain_shape,
                               self.domain_grid2world,
                               self.codomain_shape,
                               self.codomain_grid2world,
                               self.prealign)
        inv.forward = self.forward
        inv.backward = self.backward
        inv.is_inverse = True
        return inv

    def expand_fields(self, expand_factors, new_shape):
        r"""Expands the displacement fields from current shape to new_shape

        Up-samples the discretization of the displacement fields to be of
        new_shape shape.

        Parameters
        ----------
        expand_factors : array, shape (dim,)
            the factors scaling current spacings (voxel sizes) to spacings in
            the expanded discretization.
        new_shape : array, shape (dim,)
            the shape of the arrays holding the up-sampled discretization

        """
        if self.dim == 2:
            expand_f = vfu.resample_displacement_field_2d
        else:
            expand_f = vfu.resample_displacement_field_3d

        expanded_forward = expand_f(self.forward, expand_factors, new_shape)
        expanded_backward = expand_f(self.backward, expand_factors, new_shape)

        expand_factors = np.append(expand_factors, [1])
        expanded_grid2world = mult_aff(self.disp_grid2world,
                                       np.diag(expand_factors))
        expanded_world2grid = npl.inv(expanded_grid2world)
        self.forward = expanded_forward
        self.backward = expanded_backward
        self.disp_shape = new_shape
        self.disp_grid2world = expanded_grid2world
        self.disp_world2grid = expanded_world2grid

    def compute_inversion_error(self):
        r"""Inversion error of the displacement fields

        Estimates the inversion error of the displacement fields by computing
        statistics of the residual vectors obtained after composing the forward
        and backward displacement fields.

        Returns
        -------
        residual : array, shape (R, C) or (S, R, C)
            the displacement field resulting from composing the forward and
            backward displacement fields of this transformation (the residual
            should be zero for a perfect diffeomorphism)
        stats : array, shape (3,)
            statistics from the norms of the vectors of the residual
            displacement field: maximum, mean and standard deviation

        Notes
        -----
        Since the forward and backward displacement fields have the same
        discretization, the final composition is given by

        comp[i] = forward[ i + Dinv * backward[i]]

        where Dinv is the space-to-grid transformation of the displacement
        fields

        """
        Dinv = self.disp_world2grid
        if self.dim == 2:
            compose_f = vfu.compose_vector_fields_2d
        else:
            compose_f = vfu.compose_vector_fields_3d

        residual, stats = compose_f(self.backward, self.forward,
                                    None, Dinv, 1.0, None)

        return np.asarray(residual), np.asarray(stats)

    def shallow_copy(self):
        r"""Shallow copy of this DiffeomorphicMap instance

        Creates a shallow copy of this diffeomorphic map (the arrays are not
        copied but just referenced)

        Returns
        -------
        new_map : DiffeomorphicMap object
            the shallow copy of this diffeomorphic map

        """
        new_map = DiffeomorphicMap(self.dim,
                                   self.disp_shape,
                                   self.disp_grid2world,
                                   self.domain_shape,
                                   self.domain_grid2world,
                                   self.codomain_shape,
                                   self.codomain_grid2world,
                                   self.prealign)
        new_map.forward = self.forward
        new_map.backward = self.backward
        new_map.is_inverse = self.is_inverse
        return new_map

    def warp_endomorphism(self, phi):
        r"""Composition of this DiffeomorphicMap with a given endomorphism

        Creates a new DiffeomorphicMap C with the same properties as self and
        composes its displacement fields with phi's corresponding fields.
        The resulting diffeomorphism is of the form C(x) = phi(self(x)) with
        inverse C^{-1}(y) = self^{-1}(phi^{-1}(y)). We assume that phi is an
        endomorphism with the same discretization and domain affine as self
        to ensure that the composition inherits self's properties (we also
        assume that the pre-aligning matrix of phi is None or identity).

        Parameters
        ----------
        phi : DiffeomorphicMap object
            the endomorphism to be warped by this diffeomorphic map

        Returns
        -------
        composition : the composition of this diffeomorphic map with the
            endomorphism given as input

        Notes
        -----
        The problem with our current representation of a DiffeomorphicMap is
        that the set of Diffeomorphism that can be represented this way (a
        pre-aligning matrix followed by a non-linear endomorphism given as a
        displacement field) is not closed under the composition operation.

        Supporting a general DiffeomorphicMap class, closed under composition,
        may be extremely costly computationally, and the kind of
        transformations we actually need for Avants' mid-point algorithm (SyN)
        are much simpler.

        """
        # Compose the forward deformation fields
        d1 = self.get_forward_field()
        d2 = phi.get_forward_field()
        d1_inv = self.get_backward_field()
        d2_inv = phi.get_backward_field()

        premult_disp = self.disp_world2grid

        if self.dim == 2:
            compose_f = vfu.compose_vector_fields_2d
        else:
            compose_f = vfu.compose_vector_fields_3d

        forward, stats = compose_f(d1, d2, None, premult_disp, 1.0, None)
        backward, stats, = compose_f(d2_inv, d1_inv, None, premult_disp, 1.0,
                                     None)

        composition = self.shallow_copy()
        composition.forward = forward
        composition.backward = backward
        return composition

    def get_simplified_transform(self):
        r""" Constructs a simplified version of this Diffeomorhic Map

        The simplified version incorporates the pre-align transform, as well as
        the domain and codomain affine transforms into the displacement field.
        The resulting transformation may be regarded as operating on the
        image spaces given by the domain and codomain discretization. As a
        result, self.prealign, self.disp_grid2world, self.domain_grid2world and
        self.codomain affine will be None (denoting Identity) in the resulting
        diffeomorphic map.
        """
        if self.dim == 2:
            simplify_f = vfu.simplify_warp_function_2d
        else:
            simplify_f = vfu.simplify_warp_function_3d
        # Simplify the forward transform
        D = self.domain_grid2world
        P = self.prealign
        Rinv = self.disp_world2grid
        Cinv = self.codomain_world2grid

        # this is the matrix which we need to multiply the voxel coordinates
        # to interpolate on the forward displacement field ("in"side the
        # 'forward' brackets in the expression above)
        affine_idx_in = mult_aff(Rinv, mult_aff(P, D))

        # this is the matrix which we need to multiply the voxel coordinates
        # to add to the displacement ("out"side the 'forward' brackets in the
        # expression above)
        affine_idx_out = mult_aff(Cinv, mult_aff(P, D))

        # this is the matrix which we need to multiply the displacement vector
        # prior to adding to the transformed input point
        affine_disp = Cinv

        new_forward = simplify_f(self.forward, affine_idx_in,
                                 affine_idx_out, affine_disp,
                                 self.domain_shape)

        # Simplify the backward transform
        C = self.codomain_world2grid
        Pinv = self.prealign_inv
        Dinv = self.domain_world2grid

        affine_idx_in = mult_aff(Rinv, C)
        affine_idx_out = mult_aff(Dinv, mult_aff(Pinv, C))
        affine_disp = mult_aff(Dinv, Pinv)
        new_backward = simplify_f(self.backward, affine_idx_in,
                                  affine_idx_out, affine_disp,
                                  self.codomain_shape)
        simplified = DiffeomorphicMap(self.dim,
                                      self.disp_shape,
                                      None,
                                      self.domain_shape,
                                      None,
                                      self.codomain_shape,
                                      None,
                                      None)
        simplified.forward = new_forward
        simplified.backward = new_backward
        return simplified

class DiffeomorphicRegistration(with_metaclass(abc.ABCMeta, object)):
    def __init__(self, metric=None):
        r""" Diffeomorphic Registration

        This abstract class defines the interface to be implemented by any
        optimization algorithm for diffeomorphic registration.

        Parameters
        ----------
        metric : SimilarityMetric object
            the object measuring the similarity of the two images. The
            registration algorithm will minimize (or maximize) the provided
            similarity.
        """
        if metric is None:
            raise ValueError('The metric cannot be None')
        self.metric = metric
        self.dim = metric.dim

    def set_level_iters(self, level_iters):
        r"""Sets the number of iterations at each pyramid level

        Establishes the maximum number of iterations to be performed at each
        level of the Gaussian pyramid, similar to ANTS.

        Parameters
        ----------
        level_iters : list
            the number of iterations at each level of the Gaussian pyramid.
            level_iters[0] corresponds to the finest level, level_iters[n-1]
            the coarsest, where n is the length of the list
        """
        self.levels = len(level_iters) if level_iters else 0
        self.level_iters = level_iters

    @abc.abstractmethod
    def optimize(self):
        r"""Starts the metric optimization

        This is the main function each specialized class derived from this must
        implement. Upon completion, the deformation field must be available
        from the forward transformation model.
        """

    @abc.abstractmethod
    def get_map(self):
        r"""
        Returns the resulting diffeomorphic map after optimization
        """

class SymmetricDiffeomorphicRegistration(DiffeomorphicRegistration):
    def __init__(self,
                 metric,
                 level_iters=None,
                 step_length=0.25,
                 ss_sigma_factor=0.2,
                 opt_tol=1e-5,
                 inv_iter=20,
                 inv_tol=1e-3,
                 callback=None):
        r""" Symmetric Diffeomorphic Registration (SyN) Algorithm

        Performs the multi-resolution optimization algorithm for non-linear
        registration using a given similarity metric.

        Parameters
        ----------
        metric : SimilarityMetric object
            the metric to be optimized
        level_iters : list of int
            the number of iterations at each level of the Gaussian Pyramid (the
            length of the list defines the number of pyramid levels to be
            used)
        opt_tol : float
            the optimization will stop when the estimated derivative of the
            energy profile w.r.t. time falls below this threshold
        inv_iter : int
            the number of iterations to be performed by the displacement field
            inversion algorithm
        step_length : float
            the length of the maximum displacement vector of the update
            displacement field at each iteration
        ss_sigma_factor : float
            parameter of the scale-space smoothing kernel. For example, the
            std. dev. of the kernel will be factor*(2^i) in the isotropic case
            where i = 0, 1, ..., n_scales is the scale
        inv_tol : float
            the displacement field inversion algorithm will stop iterating
            when the inversion error falls below this threshold
        callback : function(SymmetricDiffeomorphicRegistration)
            a function receiving a SymmetricDiffeomorphicRegistration object
            to be called after each iteration (this optimizer will call this
            function passing self as parameter)
        """
        super(SymmetricDiffeomorphicRegistration, self).__init__(metric)
        if level_iters is None:
            level_iters = [100, 100, 25]

        if len(level_iters) == 0:
            raise ValueError('The iterations list cannot be empty')

        self.set_level_iters(level_iters)
        self.step_length = step_length
        self.ss_sigma_factor = ss_sigma_factor
        self.opt_tol = opt_tol
        self.inv_tol = inv_tol
        self.inv_iter = inv_iter
        self.energy_window = 12
        self.energy_list = []
        self.full_energy_profile = []
        self.verbosity = VerbosityLevels.STATUS
        self.callback = callback
        self.moving_ss = None
        self.static_ss = None
        self.static_direction = None
        self.moving_direction = None
        self.mask0 = metric.mask0

    def update(self, current_displacement, new_displacement,
               disp_world2grid, time_scaling):
        r"""Composition of the current displacement field with the given field

        Interpolates new displacement at the locations defined by
        current_displacement. Equivalently, computes the composition C of the
        given displacement fields as C(x) = B(A(x)), where A is
        current_displacement and B is new_displacement. This function is
        intended to be used with deformation fields of the same sampling
        (e.g. to be called by a registration algorithm).

        Parameters
        ----------
        current_displacement : array, shape (R', C', 2) or (S', R', C', 3)
            the displacement field defining where to interpolate
            new_displacement
        new_displacement : array, shape (R, C, 2) or (S, R, C, 3)
            the displacement field to be warped by current_displacement
        disp_world2grid : array, shape (dim+1, dim+1)
            the space-to-grid transform associated with the displacements'
            grid (we assume that both displacements are discretized over the
            same grid)
        time_scaling : float
            scaling factor applied to d2. The effect may be interpreted as
            moving d1 displacements along a factor (`time_scaling`) of d2.

        Returns
        -------
        updated : array, shape (the same as new_displacement)
            the warped displacement field
        mean_norm : the mean norm of all vectors in current_displacement
        """
        sq_field = np.sum((np.array(current_displacement) ** 2), -1)
        mean_norm = np.sqrt(sq_field).mean()
        # We assume that both displacement fields have the same
        # grid2world transform, which implies premult_index=Identity
        # and premult_disp is the world2grid transform associated with
        # the displacements' grid
        self.compose(current_displacement, new_displacement, None,
                     disp_world2grid, time_scaling, current_displacement)

        return np.array(current_displacement), np.array(mean_norm)

    def get_map(self):
        r"""Returns the resulting diffeomorphic map
        Returns the DiffeomorphicMap registering the moving image towards
        the static image.
        """
        return self.static_to_ref

    def _connect_functions(self):
        r"""Assign the methods to be called according to the image dimension

        Assigns the appropriate functions to be called for displacement field
        inversion, Gaussian pyramid, and affine / dense deformation composition
        according to the dimension of the input images e.g. 2D or 3D.
        """
        if self.dim == 2:
            self.invert_vector_field = vfu.invert_vector_field_fixed_point_2d
            self.compose = vfu.compose_vector_fields_2d
        else:
            self.invert_vector_field = vfu.invert_vector_field_fixed_point_3d
            self.compose = vfu.compose_vector_fields_3d

    def _init_optimizer(self, static, moving,
                        static_grid2world, moving_grid2world, prealign):
        r"""Initializes the registration optimizer

        Initializes the optimizer by computing the scale space of the input
        images and allocating the required memory for the transformation models
        at the coarsest scale.

        Parameters
        ----------
        static : array, shape (S, R, C) or (R, C)
            the image to be used as reference during optimization. The
            displacement fields will have the same discretization as the static
            image.
        moving : array, shape (S, R, C) or (R, C)
            the image to be used as "moving" during optimization. Since the
            deformation fields' discretization is the same as the static image,
            it is necessary to pre-align the moving image to ensure its domain
            lies inside the domain of the deformation fields. This is assumed
            to be accomplished by "pre-aligning" the moving image towards the
            static using an affine transformation given by the 'prealign'
            matrix
        static_grid2world : array, shape (dim+1, dim+1)
            the voxel-to-space transformation associated to the static image
        moving_grid2world : array, shape (dim+1, dim+1)
            the voxel-to-space transformation associated to the moving image
        prealign : array, shape (dim+1, dim+1)
            the affine transformation (operating on the physical space)
            pre-aligning the moving image towards the static

        """
        self._connect_functions()
        # Extract information from affine matrices to create the scale space
        static_direction, static_spacing = \
            get_direction_and_spacings(static_grid2world, self.dim)
        moving_direction, moving_spacing = \
            get_direction_and_spacings(moving_grid2world, self.dim)

        # the images' directions don't change with scale
        self.static_direction = np.eye(self.dim + 1)
        self.moving_direction = np.eye(self.dim + 1)
        self.static_direction[:self.dim, :self.dim] = static_direction
        self.moving_direction[:self.dim, :self.dim] = moving_direction

        # Build the scale space of the input images
        if self.verbosity >= VerbosityLevels.DIAGNOSE:
            print('Applying zero mask: ' + str(self.mask0))

        if self.verbosity >= VerbosityLevels.STATUS:
            print('Creating scale space from the moving image. Levels: %d. '
                  'Sigma factor: %f.' % (self.levels, self.ss_sigma_factor))

        self.moving_ss = ScaleSpace(moving, self.levels, moving_grid2world,
                                    moving_spacing, self.ss_sigma_factor,
                                    self.mask0)

        if self.verbosity >= VerbosityLevels.STATUS:
            print('Creating scale space from the static image. Levels: %d. '
                  'Sigma factor: %f.' % (self.levels, self.ss_sigma_factor))

        self.static_ss = ScaleSpace(static, self.levels, static_grid2world,
                                    static_spacing, self.ss_sigma_factor,
                                    self.mask0)

        if self.verbosity >= VerbosityLevels.DEBUG:
            print('Moving scale space:')
            for level in range(self.levels):
                self.moving_ss.print_level(level)

            print('Static scale space:')
            for level in range(self.levels):
                self.static_ss.print_level(level)

        # Get the properties of the coarsest level from the static image. These
        # properties will be taken as the reference discretization.
        disp_shape = self.static_ss.get_domain_shape(self.levels-1)
        disp_grid2world = self.static_ss.get_affine(self.levels-1)

        # The codomain discretization of both diffeomorphic maps is
        # precisely the discretization of the static image
        codomain_shape = static.shape
        codomain_grid2world = static_grid2world

        # The forward model transforms points from the static image
        # to points on the reference (which is the static as well). So the
        # domain properties are taken from the static image. Since its the same
        # as the reference, we don't need to pre-align.
        domain_shape = static.shape
        domain_grid2world = static_grid2world
        self.static_to_ref = DiffeomorphicMap(self.dim,
                                              disp_shape,
                                              disp_grid2world,
                                              domain_shape,
                                              domain_grid2world,
                                              codomain_shape,
                                              codomain_grid2world,
                                              None)
        self.static_to_ref.allocate()

        # The backward model transforms points from the moving image
        # to points on the reference (which is the static). So the input
        # properties are taken from the moving image, and we need to pre-align
        # points on the moving physical space to the reference physical space
        # by applying the inverse of pre-align. This is done this way to make
        # it clear for the user: the pre-align matrix is usually obtained by
        # doing affine registration of the moving image towards the static
        # image, which results in a matrix transforming points in the static
        # physical space to points in the moving physical space
        prealign_inv = None if prealign is None else npl.inv(prealign)
        domain_shape = moving.shape
        domain_grid2world = moving_grid2world
        self.moving_to_ref = DiffeomorphicMap(self.dim,
                                              disp_shape,
                                              disp_grid2world,
                                              domain_shape,
                                              domain_grid2world,
                                              codomain_shape,
                                              codomain_grid2world,
                                              prealign_inv)
        self.moving_to_ref.allocate()

    def _end_optimizer(self):
        r"""Frees the resources allocated during initialization
        """
        del self.moving_ss
        del self.static_ss

    def _iterate(self):
        r"""Performs one symmetric iteration

        Performs one iteration of the SyN algorithm:
            1.Compute forward
            2.Compute backward
            3.Update forward
            4.Update backward
            5.Compute inverses
            6.Invert the inverses

        Returns
        -------
        der : float
            the derivative of the energy profile, computed by fitting a
            quadratic function to the energy values at the latest T iterations,
            where T = self.energy_window. If the current iteration is less than
            T then np.inf is returned instead.
        """
        # Acquire current resolution information from scale spaces
        current_moving = self.moving_ss.get_image(self.current_level)
        current_static = self.static_ss.get_image(self.current_level)

        current_disp_shape = \
            self.static_ss.get_domain_shape(self.current_level)
        current_disp_grid2world = \
            self.static_ss.get_affine(self.current_level)
        current_disp_world2grid = \
            self.static_ss.get_affine_inv(self.current_level)
        current_disp_spacing = \
            self.static_ss.get_spacing(self.current_level)

        # Warp the input images (smoothed to the current scale) to the common
        # (reference) space at the current resolution
        wstatic = self.static_to_ref.transform_inverse(current_static,
                                                       'linear',
                                                       None,
                                                       current_disp_shape,
                                                       current_disp_grid2world)
        wmoving = self.moving_to_ref.transform_inverse(current_moving,
                                                       'linear',
                                                       None,
                                                       current_disp_shape,
                                                       current_disp_grid2world)
        # Pass both images to the metric. Now both images are sampled on the
        # reference grid (equal to the static image's grid) and the direction
        # doesn't change across scales
        self.metric.set_moving_image(wmoving, current_disp_grid2world,
                                     current_disp_spacing,
                                     self.static_direction)
        self.metric.use_moving_image_dynamics(
            current_moving, self.moving_to_ref.inverse())

        self.metric.set_static_image(wstatic, current_disp_grid2world,
                                     current_disp_spacing,
                                     self.static_direction)
        self.metric.use_static_image_dynamics(
            current_static, self.static_to_ref.inverse())

        # Initialize the metric for a new iteration
        self.metric.initialize_iteration()
        if self.callback is not None:
            self.callback(self, RegistrationStages.ITER_START)

        # Compute the forward step (to be used to update the forward transform)
        fw_step = np.array(self.metric.compute_forward())

        # set zero displacements at the boundary
        fw_step = self.__set_no_boundary_displacement(fw_step)

        # Normalize the forward step
        nrm = np.sqrt(np.sum((fw_step/current_disp_spacing)**2, -1)).max()
        if nrm > 0:
            fw_step /= nrm

        # Add to current total field
        self.static_to_ref.forward, md_forward = self.update(
            self.static_to_ref.forward, fw_step,
            current_disp_world2grid, self.step_length)
        del fw_step

        # Keep track of the forward energy
        fw_energy = self.metric.get_energy()

        # Compose backward step (to be used to update the backward transform)
        bw_step = np.array(self.metric.compute_backward())

        # set zero displacements at the boundary
        bw_step = self.__set_no_boundary_displacement(bw_step)

        # Normalize the backward step
        nrm = np.sqrt(np.sum((bw_step/current_disp_spacing) ** 2, -1)).max()
        if nrm > 0:
            bw_step /= nrm

        # Add to current total field
        self.moving_to_ref.forward, md_backward = self.update(
            self.moving_to_ref.forward, bw_step,
            current_disp_world2grid, self.step_length)
        del bw_step

        # Keep track of the energy
        bw_energy = self.metric.get_energy()
        der = np.inf
        n_iter = len(self.energy_list)
        if len(self.energy_list) >= self.energy_window:
            der = self._get_energy_derivative()

        if self.verbosity >= VerbosityLevels.DIAGNOSE:
            ch = '-' if np.isnan(der) else der
            print('%d:\t%0.6f\t%0.6f\t%0.6f\t%s' %
                  (n_iter, fw_energy, bw_energy, fw_energy + bw_energy, ch))

        self.energy_list.append(fw_energy + bw_energy)

        self.__invert_models(current_disp_world2grid, current_disp_spacing)

        # Free resources no longer needed to compute the forward and backward
        # steps
        if self.callback is not None:
            self.callback(self, RegistrationStages.ITER_END)
        self.metric.free_iteration()

        return der

    def __set_no_boundary_displacement(self, step):
        """ set zero displacements at the boundary

        Parameters
        ----------
        step : array, ndim 2 or 3
            displacements field

        Returns
        -------
        step : array, ndim 2 or 3
            displacements field
        """
        step[0, ...] = 0
        step[:, 0, ...] = 0
        step[-1, ...] = 0
        step[:, -1, ...] = 0
        if self.dim == 3:
            step[:, :, 0, ...] = 0
            step[:, :, -1, ...] = 0
        return step

    def __invert_models(self, current_disp_world2grid, current_disp_spacing):
        """Converting static - moving models in both direction.

        Parameters
        ----------
        current_disp_world2grid : array, shape (3, 3) or  (4, 4)
            the space-to-grid transformation associated to the displacement field
            d (transforming physical space coordinates to voxel coordinates of the
            displacement field grid)
        current_disp_spacing :array, shape (2,) or  (3,)
            the spacing between voxels (voxel size along each axis)
        """

        # Invert the forward model's forward field
        self.static_to_ref.backward = np.array(
            self.invert_vector_field(self.static_to_ref.forward,
                                     current_disp_world2grid,
                                     current_disp_spacing,
                                     self.inv_iter, self.inv_tol,
                                     self.static_to_ref.backward))

        # Invert the backward model's forward field
        self.moving_to_ref.backward = np.array(
            self.invert_vector_field(self.moving_to_ref.forward,
                                     current_disp_world2grid,
                                     current_disp_spacing,
                                     self.inv_iter, self.inv_tol,
                                     self.moving_to_ref.backward))

        # Invert the forward model's backward field
        self.static_to_ref.forward = np.array(
            self.invert_vector_field(self.static_to_ref.backward,
                                     current_disp_world2grid,
                                     current_disp_spacing,
                                     self.inv_iter, self.inv_tol,
                                     self.static_to_ref.forward))

        # Invert the backward model's backward field
        self.moving_to_ref.forward = np.array(
            self.invert_vector_field(self.moving_to_ref.backward,
                                     current_disp_world2grid,
                                     current_disp_spacing,
                                     self.inv_iter, self.inv_tol,
                                     self.moving_to_ref.forward))

    def _approximate_derivative_direct(self, x, y):
        r"""Derivative of the degree-2 polynomial fit of the given x, y pairs

        Directly computes the derivative of the least-squares-fit quadratic
        function estimated from (x[...],y[...]) pairs.

        Parameters
        ----------
        x : array, shape (n,)
            increasing array representing the x-coordinates of the points to
            be fit
        y : array, shape (n,)
            array representing the y-coordinates of the points to be fit

        Returns
        -------
        y0 : float
            the estimated derivative at x0 = 0.5*len(x)
        """
        x = np.asarray(x)
        y = np.asarray(y)
        X = np.row_stack((x**2, x, np.ones_like(x)))
        XX = (X).dot(X.T)
        b = X.dot(y)
        beta = npl.solve(XX, b)
        x0 = 0.5 * len(x)
        y0 = 2.0 * beta[0] * (x0) + beta[1]
        return y0

    def _get_energy_derivative(self):
        r"""Approximate derivative of the energy profile

        Returns the derivative of the estimated energy as a function of "time"
        (iterations) at the last iteration
        """
        n_iter = len(self.energy_list)
        if n_iter < self.energy_window:
            raise ValueError('Not enough data to fit the energy profile')
        x = range(self.energy_window)
        y = self.energy_list[(n_iter - self.energy_window):n_iter]
        ss = sum(y)
        if(ss > 0):
            ss *= -1
        y = [v / ss for v in y]
        der = self._approximate_derivative_direct(x, y)
        return der

    def _optimize(self):
        r"""Starts the optimization

        The main multi-scale symmetric optimization algorithm
        """
        self.full_energy_profile = []
        if self.callback is not None:
            self.callback(self, RegistrationStages.OPT_START)
        for level in range(self.levels - 1, -1, -1):
            if self.verbosity >= VerbosityLevels.STATUS:
                print('Optimizing level %d' % level)

            self.current_level = level

            self.metric.set_levels_below(self.levels - level)
            self.metric.set_levels_above(level)

            if level < self.levels - 1:
                expand_factors = \
                    self.static_ss.get_expand_factors(level+1, level)
                new_shape = self.static_ss.get_domain_shape(level)
                self.static_to_ref.expand_fields(expand_factors, new_shape)
                self.moving_to_ref.expand_fields(expand_factors, new_shape)

            self.niter = 0
            self.energy_list = []
            derivative = np.inf

            if self.callback is not None:
                self.callback(self, RegistrationStages.SCALE_START)

            while ((self.niter < self.level_iters[self.levels - 1 - level]) and
                   (self.opt_tol < derivative)):
                derivative = self._iterate()
                self.niter += 1

            self.full_energy_profile.extend(self.energy_list)

            if self.callback is not None:
                self.callback(self, RegistrationStages.SCALE_END)

        # Reporting mean and std in stats[1] and stats[2]
        residual, stats = self.static_to_ref.compute_inversion_error()

        if self.verbosity >= VerbosityLevels.DIAGNOSE:
            print('Static-Reference Residual error: %0.6f (%0.6f)'
                  % (stats[1], stats[2]))

        residual, stats = self.moving_to_ref.compute_inversion_error()

        if self.verbosity >= VerbosityLevels.DIAGNOSE:
            print('Moving-Reference Residual error :%0.6f (%0.6f)'
                  % (stats[1], stats[2]))

        # Compose the two partial transformations
        self.static_to_ref = self.moving_to_ref.warp_endomorphism(
            self.static_to_ref.inverse()).inverse()

        # Report mean and std for the composed deformation field
        residual, stats = self.static_to_ref.compute_inversion_error()
        if self.verbosity >= VerbosityLevels.DIAGNOSE:
            print('Final residual error: %0.6f (%0.6f)' % (stats[1], stats[2]))
        if self.callback is not None:
            self.callback(self, RegistrationStages.OPT_END)

    def optimize(self, static, moving, static_grid2world=None,
                 moving_grid2world=None, prealign=None):
        r"""
        Starts the optimization

        Parameters
        ----------
        static : array, shape (S, R, C) or (R, C)
            the image to be used as reference during optimization. The
            displacement fields will have the same discretization as the static
            image.
        moving : array, shape (S, R, C) or (R, C)
            the image to be used as "moving" during optimization. Since the
            deformation fields' discretization is the same as the static image,
            it is necessary to pre-align the moving image to ensure its domain
            lies inside the domain of the deformation fields. This is assumed
            to be accomplished by "pre-aligning" the moving image towards the
            static using an affine transformation given by the 'prealign'
            matrix
        static_grid2world : array, shape (dim+1, dim+1)
            the voxel-to-space transformation associated to the static image
        moving_grid2world : array, shape (dim+1, dim+1)
            the voxel-to-space transformation associated to the moving image
        prealign : array, shape (dim+1, dim+1)
            the affine transformation (operating on the physical space)
            pre-aligning the moving image towards the static

        Returns
        -------
        static_to_ref : DiffeomorphicMap object
            the diffeomorphic map that brings the moving image towards the
            static one in the forward direction (i.e. by calling
            static_to_ref.transform) and the static image towards the
            moving one in the backward direction (i.e. by calling
            static_to_ref.transform_inverse).

        """
        if self.verbosity >= VerbosityLevels.DEBUG:
            print("Pre-align:", prealign)

        self._init_optimizer(static.astype(floating), moving.astype(floating),
                             static_grid2world, moving_grid2world, prealign)
        self._optimize()
        self._end_optimizer()
        self.static_to_ref.forward = np.array(self.static_to_ref.forward)
        self.static_to_ref.backward = np.array(self.static_to_ref.backward)
        return self.static_to_ref


text:
Pelosi says George Floyd was 'murdered on TV'
by Mike Lillis - 05/28/20 2:32 PM ET
Speaker Nancy Pelosi (D-Calif.) said Thursday George Floyd, the African American man who died following a violent arrest in Minnesota, was "murdered" at the hands of the Minneapolis Police Department.
"We saw it on TV — him being murdered on TV," Pelosi told reporters in the Capitol.
Pelosi stopped short of calling for the arresting officers to be charged with murder, advocating for the various investigations into Floyd's death to run their course. But she strongly suggested the officers should be held criminally accountable.
"Let's take our lead from them in terms of how these things are sequenced," Pelosi said. "But we did see a murder on TV. And it wasn't self-defense."
Appearing on CNN a short time later, she was even more blunt, calling Floyd's death "an execution."
"We saw it, so we can't deny it or qualify it," she told the network. "So justice has to be done."
Floyd, a 46-year-old Houston native living in the Minneapolis suburbs, died Monday, shortly after his arrest by city law enforcers. A video taken by a passerby shows Floyd lying on the street with his face pressed into the pavement and the knee of one of the officers on his neck.
Several spectators are heard protesting the treatment, and so is Floyd.
"I cannot breathe," he says. "It'll kill me, I can't breathe."
Minutes later, still pinned to the ground, Floyd appears unresponsive. A medical team called to the scene found him without a pulse, according to local reports. Doctors pronounced him dead at an area hospital a short time later.
Floyd's death, along with similar incidents involving the killing of unarmed black men, has ignited waves of outrage across the country, raising new questions about police tactics and training, racial disparities in the criminal justice system and the use of excessive force by law enforcers, particularly when the target is black.
Violent protests erupted Tuesday and Wednesday night in Minneapolis, leaving cars ablaze and shops looted — a scene reminiscent of the Rodney King riots in Los Angeles in 1992. Wednesday evening, similar protests flared up in L.A.
The four Minneapolis officers involved in Floyd's arrest were quickly fired, and several investigations are ongoing, including a civil rights probe being conducted by the FBI. On Thursday, the Justice Department vowed to make the case a "top priority."
But a growing list of congressional lawmakers say that's hardly enough.
House Democrats are eyeing a variety of responses, including the adoption of more stringent federal policing standards and a pressure campaign on the Justice Department to get more aggressive in tackling the issue.
"There are all kinds of expressions of concern," Pelosi said. "But not just expressions of concern, plans to take action so that this stops."
Pelosi is pointing specifically to legislation, sponsored by Rep. Frederica Wilson (D-Fla.), to create a new federal commission that would evaluate the status of African American men around the country, with designs to improve it.
But she emphasized that the Wilson bill is just one facet of a much broader House response, which will be spearheaded by leaders of the Congressional Black Caucus. At least one lawmaker, Minnesota Rep. Ilhan Omar (D), is working on a criminal justice reform package designed to address the racial inequities in law enforcement. And leaders of the House Judiciary Committee are weighing separate actions, focused on the Justice Department.
In the meantime, Pelosi said Democrats are eager for "justice" following the Floyd death.
"We saw a murder take place before our very eyes," she said. "And so the fact that the police officers were fired, that's one thing. But there has to be some justice in all of this."
Tags Frederica Wilson George Floyd Ilhan Omar Minnesota Nancy Pelosi
More House News
by Mychael Schnell 2 hours ago
House / 2 hours ago
Missouri rep trolls Bengals players, Cincinnati mayor after Chiefs win
McCarthy to meet with King Abdullah II of Jordan on Tuesday
by Mychael Schnell 10 hours ago
House / 10 hours ago

redpajama_set_name: RedPajamaCommonCrawl


Wholesome living starts proper now. Alayna Hutchinson first encountered the Well being & Life Sciences Advising Center early in her career at IUPUI, the place she began out as a Pre-Nursing Major. She stated that she always cherished science and serving to individuals, so she had at all times considered healthcare." Alayna did eventually apply to the IU School of Nursing however was unsuccessful in her first try. It was then that she turned to HLS for assist. Alayna met with both a student success advisor and a career guide to go over her completely different options. Proceed reading Alayna's story.
Moreover, screening and therapy for eye illness in all type 2 diabetes patients would result in an estimated internet savings of over $472.1 million – in 1994 dollars (Javitt et al. 1994, Preventive Eye Care in People With Diabetes is Price-Saving to the Federal Government).
With this Special Health Report, Dwelling Better, Dwelling Longer, you'll be taught the protective steps docs suggest for holding your mind and physique match for an active and rewarding life. You'll get suggestions for weight loss plan and exercise, preventive screenings, lowering the danger of coronary illness, strengthening bones, lessening joint aches, and assuring that your sight, listening to, and memory all stay sharp. Plus, you will get authoritative guidance to help you stretch your well being care greenback, choose a well being plan that meets your wants, prepare a well being care proxy, and extra.
Preterm beginning is a significant public well being issue. Worldwide obesity has nearly tripled since 1975 in keeping with the World Health Organisation. As governments look to limit or tax foods high in sugar, fats and energy, and foods and drinks producers look to reformulate their merchandise to make them more healthy.
The Life & Well being Stay & OnDemand two-day class features live online exam prep with full access to our expert instructors. This interactive webcast offers the construction and format of classroom instruction with the comfort of on-line research. Specializing in each Life & Health Insurance, you possibly can put together with a scheduled dwell on-line class, and then entry the recorded video to review at your convenience.
The Life Insurance coverage Dwell & OnDemand one-day class features live on-line examination prep with full entry to our expert instructors. This interactive webcast offers the structure and format of classroom instruction with the comfort of online examine. Focusing on Life Insurance coverage, you possibly can prepare with a scheduled stay on-line class, and then access the recorded video to evaluation at your convenience.
Ben Greenfield is a coach, author, speaker, ex-bodybuilder, and Ironman triathlete. His science-primarily based strategy to discovering a potent stability between well being and efficiency has revolutionized the way 1000's of athletes and train fanatics around the world live, train, and eat. Ben now works with athletes, CEOs, and soccer mothers alike, serving to them achieve amazing feats of bodily endurance without destroying their our bodies in the course of.


text:
Commentary on Economics, Information and Human Action
About Lynne Kiesling
About Michael Giberson
What the Fpl 2009 3q Earnings Call Transcript Says About the Texas Retail Market
Posted on November 5, 2009 November 26, 2020 by Michael Giberson
Michael Giberson
Seeking Alpha has begun publishing transcripts of quarterly corporate earnings calls. Typically these calls are discussions presented by the CEO and other corporate officers followed by Q&A with financial analysts. The calls offer a more "inside look" at company operations than you get from reading newspaper or magazine stories or even trade press. What's more, the calls provide insight into the markets that the company participates in. The FPL Group Inc. 3Q 2009 call provides several insights into the electric business in Texas, where FPL participates in both the wholesale and retail markets.
FPL, through its NextEra Energy Resources subsidiary, owns both fossil-fueled and wind power plants in Texas and several other places. Currently the company is the second-largest operator of wind power plants in the world behind Iberdrola. FPL owns Gexa Energy, a energy retailer in Texas serving about 172,000 customers (according to Wikipedia).
The earnings call spanned the range of FPL Group activities and interests. There is much here of interest in Texas: FPL has recently completed a 200-mile self-funded transmission line linking four of its wind power plants in ERCOT's west region directly to the higher-priced ERCOT south region, they've added both wind power and natural gas generation in Texas, and they are constantly trying to balance their risk exposures for their wholesale and retail obligations in the state.
I thought the call was particularly interesting for what it implied about retail market profit margins during the current low-wholesale power prices in Texas (and most other places). Earnings from their merchant generator fleet are down:
Although we were pleased with the $0.11 year-over-year improvement in NextEra Energy Resources' quarterly earnings per share contributions, the financial performance did not meet our internal expectations. Two factors primarily drive this: the Texas merchant gas fleet and the wind resource. Let me explain a bit further.
On the former, contributions from the Texas gas fleet were approximately $24 million or $0.06 per share below our quarterly expectations. Both spark spreads and ancillary revenues were much lower than we expected.
As for the latter, as I mentioned a moment ago, the wind resource in the third quarter was well below normal or roughly $0.06 per share below our expectations. … For the year, the poor wind resource has reduced per share results by nearly $0.13.
Elsewhere in the call:
Meanwhile, our retail business in Texas … added about $0.04 per share incrementally given favorable margins. The remaining contributions from the existing merchant fleet amounted to negative $0.02 per share, but there is nothing notable in any one category worth calling out.
Later in the call:
Just one last comment: As I've said before, we're certainly not happy that ancillary revenue is down at our gas plants in Texas, but one of the reasons that [inaudible] retail business is up $0.04 quarter-over-quarter is because they didn't have to pay the ancillary cost to our gas assets and other gas assets.
A couple of comments:
First, the ownership of both wholesale and retail assets in the Texas competitive market provides a sort of natural hedge against fuel price movements. When wholesale power revenue or ancillary service revenues are low, as currently, the wholesale business suffers but the retail side benefits. (See related discussion on wholesale-retail combination in Texas, and earlier here.)
Second, while retail prices have fallen in Texas, they haven't fallen as far and as fast as wholesale prices, so retail margins are higher for FPL. The call doesn't fully clarify the reasons here. The most straightforward explanation is that FPL likely has many customers on one- or two-year fixed price contracts, with prices that relatively high now (but presumably competitive one or two years ago.) Also, as noted in the call, costs for ancillary services were unexpectedly low, which reduced expenses for the retail side.
But margins may be higher, too, if retail prices are slow to adjust to dropping wholesale prices. I wonder whether there is an asymmetric price adjustment phenomenon in competitive retail electricity? Do consumers shop around more and switch companies more when prices are going up as compared to when prices are falling? Probably, and that should be enough of a force to produce a "rockets and feathers" effect on prices.
Finally, and I don't think the call made this connection, but I wonder whether there is a link between the lower-than-expected wind resource and the low revenues/costs associated with ancillary services. To some degree, variable wind power output increases the demand for energy balancing and other ancillary services required by the transmission system for reliable operations. Possibly with less wind power coming on the system, fewer ancillary services were required. Of course low natural gas prices and on-average slightly lower electric power demand would also reduce the cost of ancillary services, so the explanation may not be wind-output related.
NOTE: FPL's 200-mile self-funded transmission line, dubbed the "Texas Clean Energy Express," raises a host of interesting issues worthy of examination. One of these days…
ALSO: Of course FPL Group Inc. isn't the only company with an interest in the Texas electric power market. Search "Texas AND electric" at Seeking Alpha's Transcript Center for much much more. If you find anything interesting, let me know.
Posted in Electricity, Energy marketsTagged retail competition, Texas, Wind
The (soon to Be Revised) History of Electric Competition in Lubbock
Local TV News Coverage of the Proposed End of 90+ Years of Electric Competition in Lubbock
One thought on "What the Fpl 2009 3q Earnings Call Transcript Says About the Texas Retail Market"
Tom Konrad says:
The "Clean Energy Express" is especially interesting, since it is funded by a purely profit-motivated player, who is unlikely to be able to capture all the benefits of the line.
If one player, in this case FPL, can profitably build a 200 mile line between ERCOT west and south, how many lines could be funded if all the benefits could actually accrue to the builder of the transmission?
Subscribe to RSS Links
Follow KP on Twitter
Please search here if your web search told you "file not found" -- the archived posts are all here from 2002 onward, but the names changed in the WP migration several years ago.
Are N95 Masks Essential Goods Covered by State Price Gouging Laws?
Consumer Complaints in Massachusetts Fell in the First Quarter of 2020
Against Anti-anti-anti-price Gouging
Adam Smith and the Digital Economy: Connectedness and Gains From Trade
Job Change, and a Blogging Renaissance
Complexity (44)
Economic history (89)
Electricity (1,149)
Energy markets (1,058)
Environmental policy (502)
How cool is this? (63)
Miscellany (209)
Professional sports (102)
Regulation (419)
Shoes! (9)
Archives Select Month May 2020 (3) July 2019 (2) September 2018 (1) August 2018 (3) July 2018 (4) June 2018 (2) May 2018 (1) March 2018 (2) February 2018 (3) January 2018 (3) December 2017 (2) November 2017 (3) October 2017 (3) September 2017 (5) August 2017 (7) July 2017 (2) June 2017 (1) November 2016 (2) October 2016 (6) September 2016 (3) August 2016 (6) July 2016 (1) June 2016 (4) May 2016 (5) April 2016 (5) March 2016 (1) November 2015 (1) October 2015 (1) August 2015 (3) July 2015 (6) June 2015 (6) March 2015 (6) January 2015 (6) November 2014 (2) October 2014 (4) September 2014 (3) August 2014 (3) July 2014 (4) June 2014 (3) May 2014 (10) April 2014 (4) March 2014 (9) February 2014 (1) January 2014 (1) December 2013 (5) November 2013 (3) October 2013 (11) September 2013 (10) August 2013 (15) July 2013 (15) June 2013 (17) May 2013 (14) April 2013 (6) March 2013 (13) February 2013 (8) January 2013 (13) December 2012 (10) November 2012 (19) October 2012 (16) September 2012 (17) August 2012 (29) July 2012 (32) June 2012 (19) May 2012 (12) April 2012 (33) March 2012 (22) February 2012 (27) January 2012 (29) December 2011 (17) November 2011 (21) October 2011 (27) September 2011 (25) August 2011 (37) July 2011 (19) June 2011 (36) May 2011 (43) April 2011 (39) March 2011 (45) February 2011 (42) January 2011 (39) December 2010 (18) November 2010 (29) October 2010 (24) September 2010 (32) August 2010 (27) July 2010 (4) June 2010 (14) May 2010 (26) April 2010 (31) March 2010 (33) February 2010 (41) January 2010 (47) December 2009 (39) November 2009 (50) October 2009 (57) September 2009 (57) August 2009 (54) July 2009 (65) June 2009 (36) May 2009 (52) April 2009 (48) March 2009 (46) February 2009 (35) January 2009 (39) December 2008 (49) November 2008 (31) October 2008 (33) September 2008 (32) August 2008 (38) July 2008 (31) June 2008 (28) May 2008 (28) April 2008 (25) March 2008 (34) February 2008 (21) January 2008 (35) December 2007 (27) November 2007 (34) October 2007 (37) September 2007 (30) August 2007 (39) July 2007 (42) June 2007 (34) May 2007 (36) April 2007 (31) March 2007 (24) February 2007 (28) January 2007 (29) December 2006 (21) November 2006 (26) October 2006 (33) September 2006 (28) August 2006 (30) July 2006 (33) June 2006 (48) May 2006 (36) April 2006 (28) March 2006 (27) February 2006 (32) January 2006 (33) December 2005 (13) November 2005 (7) October 2005 (26) September 2005 (29) August 2005 (42) July 2005 (41) June 2005 (32) May 2005 (43) April 2005 (41) March 2005 (54) February 2005 (34) January 2005 (44) December 2004 (43) November 2004 (32) October 2004 (31) September 2004 (37) August 2004 (41) July 2004 (14) June 2004 (19) May 2004 (32) April 2004 (49) March 2004 (39) February 2004 (37) January 2004 (42) December 2003 (30) November 2003 (35) October 2003 (38) September 2003 (22) August 2003 (90) July 2003 (46) June 2003 (62) May 2003 (116) April 2003 (83) March 2003 (69) February 2003 (42) January 2003 (28) December 2002 (31) November 2002 (9) October 2002 (31) September 2002 (27) August 2002 (36) July 2002 (49) June 2002 (31)


The retail IT solutions that retailers love to use.
How can Vend retail IT solutions empower your store to grow?
Vend gives you all the information you need to know about what's happening in your store at your fingertips. Reports update in real time, so you're empowered to make smart, data-driven decisions in the moment.
Vend retail IT solutions make it easy to manage multiple stores in one place. You can quickly add registers and locations as you grow. Vend will automatically scale to match your growth. Need more functionality as you expand? Just use a tool from our extensive list of add-ons and tech partners!
Increase productivity and save time.
Vend is easy to set up and a breeze to use. It's a cloud-based solution, so you can use it on any device with a web browser. Quickly add or sell all types of products from anywhere in the world or track inventory in as many stores as you need all in one place. You can even reward your best customers with a built-in loyalty system.
With a mixture of retail and hospitality sales, we needed something that could offer flexibility while still remaining easy for everyone to use. Vend was it.
There are many retail IT solutions options out there. So why do retailers the world over choose Vend?
Vend retail IT solutions work great on any device with a web browser.
Find out what thousands of Vend customers worldwide have to say about our retail IT solutions.
We've saved a good 10-20 hours a month, and spend more time focused on the things that move us forward.
Vend has the world's leading retail IT solutions.
Try out our retail IT solutions for 14 days — free.


The WeatherFlow Wind Meter - it's an anemometer that fits in your pocket. Download one of our free apps for iOS or Android and plug in your wind meter - it's really that easy. Hold it up high facing into the wind. Your phone does the rest by recording the wind speed (average, lull and gust), wind direction and location. The Wind Meter is designed to be better than any other handheld anemometer on the market. It's operating range extends from the smallest puff to well over hurricane force winds. Calibrated at the University of Florida's Aerospace Engineering Department, our Wind Meter is so accurate that even if you don't hold it directly into the wind, you'll still get very accurate wind speed information.
The Wind Meter device will work on most Apple and many Android devices. See the FAQ document WINDmeter Supported Devices for a listing of currently supported devices.


text:
BELOVED TRANSITION
Dad was a cherished father, husband, grandfather, uncle and landlord. My brother described him as the mortar that holds the bricks of our family. My pater adored his wife and family, opera, Sarah Brightman, Marilyn Monroe, Luciano Pavarotti, the United States Marines, good food, chocolate, peanut butter on a spoon, clams on the half shell, art, dancing, stained-glass making and roulette.
My 95-year-old patriarch had quite a sense of daring, risking taking and humor. Let me share.
In the military, he shaved his head on a dare.
On the way home from the South Pacific in 1945, he gambled and won $1,500; he brought two exotic birds home to my twenty-year-old mother.
At three years of age, I had a high fever and wouldn't take my medicine. Dad disguised himself to persuade me to take the horrible-tasting liquid, borrowed my uncle's fedora hat and trench coat. With a pair of Groucho Marx eyeglasses, replete with eyebrows and a mustache, calling himself Dr. Botchagaloop, he grabbed my mother in a sweeping embrace. He kissed her on the mouth and said: "Don't tell your father." I took my prescription.
At five-years of age, my tooth was loose. I moaned. He teased me by saying: "Let's tie a string around the tooth and connect it to the door knob. We'll close the door and the tooth will be pulled out. I stopped complaining.
In the sixties, he passionately believed in nutrition. We'd listen to Carlton Fredericks, the nutritionist, on WOR-AM radio. I can still remember CF's voice! We ate very green lettuce, had no soda and wheat germ was mixed in with our Italian meatballs, and everything my parents baked.
One Halloween, when I was about sixteen, he picked me up by car dressed like a woman – with lipstick, false breasts and a kerchief on his head. I remember being so embarrassed.
Later in life, he took to telling jokes, both PG and R rated. He kept the punch lines to these jokes in his wallet, and remembered his stories so well.
On the Friday after Thanksgiving, he was having difficulty breathing and was taken to the emergency room, admitted to hospital, and then placed in ICU. On Monday, December 1, while holding a family member's hand, he said: "Turn off the TV and the lights. I'm going to sleep now. Goodnight everybody." His eyes were open. A few moments later, he closed them: his spirit left his body at 6:38 p.m. All the monitoring equipment went flat, immediately.
I am at peace with his passing, as I know he missed my mother terribly. He periodically talked about joining her. (She passed on January 15th this year.) We will forever miss him (and his belly laugh) and he will always be in our hearts.
I will speak to you on December 22nd.


text:
PR Distribution: Online Visibility Will Make or Break Your E-Commerce Company
LAS VEGAS, NV - 07/10/2019 — How do you grab onto and hold onto critical traffic as an e-commerce company? E-Commerce has become incredibly powerful and competitive for new and established businesses, alike. An estimated 80% of Americans have made purchases online and e-commerce sales are expected to grow over 15% in 2019. The number of competitors, already sitting at over 100,000, according to Alexa, continues to climb every year. Whatever product category your business is selling likely already has many competitors of various sizes.
Marketing teams with experience in digital promotion have made extremely successful use of leading press release companies like PR Distribution to quickly give their companies visibility online. Press release distribution in 2019 works by using new technological solutions to leverage connections to media networks. This has proven to be far more effective and far-reaching than old methods of individually cultivating business relations.
Affordably priced solutions like the Premium Pro package provide incredible return within a very quick turnaround window. Companies looking to build permanent branding will take advantage of monthly or annual subscriptions to stay in the eyes of readers.
PR Distribution has worked with a large number of e-commerce companies in a variety of different categories.The experience from servigin these online campaigns has been used to create a set of freely available press release templates and a general resource center. Their experienced industry writers are also available to help create original content that will be relevant to news outlets and their readership.
PR Distribution's network includes hundreds of established, high-authority, and highly-trafficked media outlets. These include outlets such as ABC, NBC, CBS, FOX, CW, and their affiliates, as well as Google, Yahoo, and Bing News.
The sample articles and resources below can be used as a reference for press release writing in e-commerce.
Visit the PR Distribution resource center for e-commerce related articles:
https://www.prdistribution.com/resources/
General guidelines for e-commerce press release writing:
https://www.prdistribution.com/ecommerce-press-release/
Three sample press releases for e-commerce brands and businesses:
B2X Report, E-Commerce Industry Report from E-Commerce Agency:
https://www.prdistribution.com/news/new-report-assesses-the-current-landscape-of-mid-market-b2b-e-commerce-software/648261
Coinnup, Blockchain-based E-Commerce and Fintech Company Press Release:
https://www.prdistribution.com/news/coinnup-ventures-into-the-field-of-blockchain-powered-fintech-and-e-commerce/3244858
Saleor, E-Commerce Sales Platform Press Release:
https://www.prdistribution.com/news/saleor-20-e-commerce-for-the-pwa-era/3782330
PRDistribution.com


Designed and engineered for chamfering and trimming inner and outter end angles on circular pipe or bar stock at one time, providing efficient and precise performance.
Delicate clamping vise and cutter head ensure high concentricity of results.
Specially designed cutter head and standardized cutter make cutter adjustment easy.
Motion cycle includes automatic material infeed through a channel (automatic feeder is optional). Automatic cutting feeding/retracting and automatic workpiece outfeed. Continuous motion cycles provide high machining speed, high accuracy, reduced labor requirement while greatly upgrading productivity.


Five decades soon after Martin Full was killed, messages quiet expression Thursday. The worked out from his of Atl Memphis, factors beyond, which little girl, was arranged reasonable an honours service part of his honour. The events are slated competitors.
Rev Sharpton label David Atl events culminate a gong-ringing wreath-putting his crypt tag minute he Martin Luther King was recorded deck old Lorraine hotel 4 Apr 1968.
Thursday scars fifty years because Martin Luther Full, Jr. was killed. Occasions all around Deborah. H. and around the world are remembering his recollection and continuing his legacy of music. The A. H. To to get rid of Bigotry Rallybegan at 7 a. michael. with the hr-prolonged quiet march through the Martin Luther Full, Jr. Funeral for the Countrywide Mall, followed by an interfaith services. Then, from 9 a. michael. to a few s. michael. , a rally and get in touch with to dedication for the Mall featured speakers including Danny Glover, DeRay Mckesson, ticketswashington.org Louis Gossett, Jr. , Yolanda Adams plus much more. Deborah. H. Gran Muriel Bowser set a wreath at the MLK Funeral at 11 a. michael. Deborah. H. In. Eleanor Holmes Norton also went to. 18 Historical Photographs From the Time of MLK The Initiative to see the fiftieth House warming of Generate. Martin Luther Full Jr. Is Assassination started at 3 s. michael. at Shepherd Playground at the 4 way stop of Martin Luther Full Jr. Avenue and Malcolm By Path Opleve. Sound system should include Parkland High School heir Demitri Hoth, community rifle abuse naturalist Zion Kelly, Deborah.
The House Honesty Mount Washington Valley Panel mentioned that it will always whether Rep. David Duncan Jr. ) misspent a lot than Dollara hundred, which products, membership subscriptions events including marriage meals child bathrooms. Duncan could DC Events Honor have Your laws federal if he abused governmental a completely independent values Rep. Duncan's board authority PAC funds that were not to bona fide governmental reasons.
specifications the OCE mentioned. The label, symbolized his Knoxville-area district '88. Attorneys through the firm Webster, who symbolized Duncan.