def apply_transformation_workflow(moving_file, output_file, output_transform_file=None):
    """
    """
    moving_image = pos_itk_transforms.read_itk_image(moving_file)

    translation, rotation = get_random_rigid_3d_tranform_parameters(
        tmean=CONFIG['tmean'], tsigma=CONFIG['tsigma'],
        rmean=CONFIG['rmean'], rsigma=CONFIG['rsigma'])

    vol_transform = itk.Euler3DTransform.D.New()
    vol_transform.SetTranslation([0, 0, 0])
    vol_transform.SetRotation(*list(rotation))

    center = [0, 0, 0]
    center[0] = moving_image.GetLargestPossibleRegion().GetSize()[0]/2
    center[1] = moving_image.GetLargestPossibleRegion().GetSize()[1]/2
    center[2] = moving_image.GetLargestPossibleRegion().GetSize()[2]/2
    center = map(int, center) # Sometimes the indexes are returned as long ints
    phisycal_center = moving_image.TransformIndexToPhysicalPoint(center)
    vol_transform.SetCenter(phisycal_center)

    resliced_image = pos_itk_transforms.reslice_image([vol_transform],
        moving_image, default_pixel_value=CONFIG['default_pixel_value'])
    pos_itk_transforms.write_itk_image(resliced_image, output_file)

    if output_transform_file:
        write_itk_matrix_transformation_to_file(vol_transform, output_transform_file)
    def _load_single_image(self, attr_base, filename):
        """
        Load itk image and store the image itself and its type
        as a class attribute. The image is stored as
        `<prefix>_image` attribute and the type of the image
        is stored under the `<prefix> type` attribute.

        :param attr_base: The base for the class attribute name.
        :type attr_base: str

        :return: None
        :rtype: None
        """

        # Generating the attributes names based on
        # the image type.
        image_attr_name = "_" + attr_base + "_image"
        type_attr_name = "_" + attr_base + "_type"

        setattr(self, image_attr_name,
            pos_itk_transforms.read_itk_image(filename))
        setattr(self, type_attr_name,
            pos_itk_core.autodetect_file_type(filename))

        # We read and report the number of components of the image.
        numbers_of_components = \
            getattr(self, image_attr_name).GetNumberOfComponentsPerPixel()
        self._logger.info("Number of components of the image %s is: %d.",
            filename, numbers_of_components)