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 launch(self):
        # Execute the parents before-execution activities
        super(self.__class__, self)._pre_launch()

        # Just for our convenience, we make an alias
        # for the direction of the computations
        self.direction = self.options.direction

        self._load_images()
        self._load_coregistration_transformation()

        # Define the single component processing type All single component data
        # type will be converted to this tupe for the purpose of processing.
        # It will be converted back to its initial data type upon completion of
        # the processing.
        self._processing_type = \
            pos_itk_core.io_component_string_name_to_image_type[
            C_INTERMEDIATE_SINGLE_COMPONENT_TYPEDEF]

        # Determine the number of components in the image to be processed.
        # Single component image is easy to process. Multichannel workflow
        # is a bit more complicated
        self._numbers_of_components = \
            self._moving_image.GetNumberOfComponentsPerPixel()

        # There are different workflows depending on the number of components,
        # of the provided input image.
        if self._numbers_of_components > 1:
            processed_image = \
                self.use_multicomponent_workflow()
        else:
            processed_image = \
                self.use_single_component_workflow()

        # This is a very important line of code. It gives us the final image!
        # Yey....
        pos_itk_transforms.write_itk_image(
            processed_image, self.options.output_image)

        # Run parent's post execution activities
        super(self.__class__, self)._post_launch()