//---------------------------------------------------------------------------------------------
        public InterferogramDecodingResult DecodeInterferogram(RealMatrix[] interferograms, BitMask2D bitMask)
        {
            //double gamma = 2;
            //interferograms = MatricesManager.GetGammaCorrectedMatrices( gamma, interferograms );
            //interferograms = GetNormalizedMatrices( interferograms );

            //Выбранные точки изображения
            Point[]   selectedImagePoints = bitMask.GetTruePoints();
            Point3D[] points3D            =
                this.GetParallelToCoordinatePlanePoints3D(interferograms, selectedImagePoints);
            this.TrajectoryPoints = points3D;

            Point2D[] points2D = SpaceManager.GetProjectionXY(points3D);
            this.ProjectionPoints = points2D;

            EllipseDescriptor ellipseDescriptor = this.GetEllipseDescriptor(points2D);
            Point2D           ellipseCentre     = ellipseDescriptor.GetCentre();
            Point3D           pointsCentre      = new Point3D(ellipseCentre.X, ellipseCentre.Y, points3D[0].Z);

            RealVector cylinderGuidLine           = this.GetCylinderGuidLine(ellipseDescriptor);
            RealVector normalizedCylinderGuidLine = cylinderGuidLine.GetNormalizedVector();

            /*
             * this.CalculateCirclePointsDispersion( cylinderGuidLine, points3D, pointsCentre );
             * double cylinderGuidLineOptimalAngle = this.GetCylinderGuidLineOptimalAngle();
             * cylinderGuidLine = this.GetRotatedInPlaneCylinderGuidLine
             *  ( cylinderGuidLine, cylinderGuidLineOptimalAngle );
             */

            Point3D[] circlePoints = this.GetCirclePoints(points3D, normalizedCylinderGuidLine);
            this.CirclePoints = circlePoints;
            Point3D circlePointsCentre =
                this.GetCorrectedCirclePoint(pointsCentre, normalizedCylinderGuidLine);

            //Поворот точек
            RealMatrix rotationMatrix = this.GetRotationMatrix(circlePoints);

            //rotationMatrix.WriteToTextFile( @"d:\!!\RotationMatrix.txt" ); // debug

            Point3D[] rotatedCirclePoints = this.RotatePoints(circlePoints, rotationMatrix);
            this.RotatedCirclePoints = rotatedCirclePoints;

            Point3D rotatedCirclePointsCentre = PlaneManager.RotateVector
                                                    (new RealVector(circlePointsCentre), rotationMatrix).ToPoint3D();

            Point3D[] correctedPoints =
                this.DisplacePoints(rotatedCirclePoints, rotatedCirclePointsCentre);

            int sizeX = interferograms[0].ColumnCount;
            int sizeY = interferograms[0].RowCount;

            RealMatrix phaseMatrix = this.CalculatePhaseMatrixByCirclePoints
                                         (correctedPoints, selectedImagePoints, sizeX, sizeY);

            InterferogramDecodingResult decodingResult = new InterferogramDecodingResult(phaseMatrix);

            return(decodingResult);
        }