def __init__(self, model, target_image=None, levels_image=None, epsilon=None):
        self.model = model

        # Initialization of the target image
        if len(target_image.data.shape) == 3:
            self.target = [Slice(slice_id=i_slice, im=target_slice, reg_to_m=[]) for i_slice, target_slice in enumerate(target_image.data)]
            self.target_dim = 3
        elif len(target_image.data.shape) == 2:
            self.target = [Slice(slice_id=0, im=target_image.data, reg_to_m=[])]
            self.target_dim = 2

        if levels_image is not None and self.model.param.use_levels:
            self.load_level(levels_image)

        if self.model.param.first_reg:
            self.first_reg()

        self.target_pairwise_registration()

        sct.printv('\nProjecting the target image in the reduced common space ...', model.param.verbose, 'normal')
        # coord_projected_target is a list of all the coord of the target's projected slices
        self.coord_projected_target = model.pca.project([target_slice.im_M for target_slice in self.target])

        sct.printv('\nComputing the similarities between the target and the model slices ...', model.param.verbose, 'normal')
        if levels_image is not None and self.model.param.use_levels:
            self.beta = self.model.compute_beta(self.coord_projected_target, target_levels=np.asarray([target_slice.level for target_slice in self.target]), tau=self.model.tau)
        else:
            self.beta = self.model.compute_beta(self.coord_projected_target, tau=self.model.tau)

        sct.printv('\nSelecting the dictionary slices most similar to the target ...', model.param.verbose, 'normal')
        self.selected_k_slices = self.model.select_k_slices(self.beta)
        self.save_selected_slices(target_image.file_name[:-3])

        if self.model.param.verbose == 2:
            self.plot_projected_dic(nb_modes=3, to_highlight='all')  # , to_highlight=(6, self.selected_k_slices[6]))

        sct.printv('\nComputing the result gray matter segmentation ...', model.param.verbose, 'normal')
        if self.model.param.weight_label_fusion:
            use_beta = self.beta
        else:
            use_beta = None
        self.model.label_fusion(self.target, self.selected_k_slices, beta=use_beta, type=self.model.param.res_type)

        if self.model.param.z_regularisation:
            sct.printv('\nRegularisation of the segmentation along the Z axis ...', model.param.verbose, 'normal')
            self.z_regularisation_2d_iteration()

        sct.printv('\nRegistering the result gray matter segmentation back into the target original space...',
                   model.param.verbose, 'normal')
        self.target_pairwise_registration(inverse=True)

    # ------------------------------------------------------------------------------------------------------------------
Initializes a class that might have property definitions.
dataset/ETHPy150Open neuropoly/spinalcordtoolbox/dev/sct_segment_gray_matter_asman/2015-08-17-full_scripts_before_cleaning/sct_asman.py/TargetSegmentationPairwise.__init__--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/db/__init__.py/PropertiedClass.__init__