public void In_ReceiveMessage(IEBCMessage ebcMessage)
        {
            this.LastReceivedEBCMessage = ebcMessage;

            if (this.CanReceiveMessages)
            {
                this.InnerReceiveMessage(ebcMessage);
            }
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            this.EBCMessageData = new EBCMessageData(ebcMessage.EBCMessageData);
            this.EBCMessageData.ImageType = ImageTypes.Minuend;

            IEBCMessageData newEBCMessageData = new EBCMessageData(ebcMessage.EBCMessageData);
            newEBCMessageData.ImageType = ImageTypes.Subtrahend;

            this.Erodation.In_ReceiveMessage(new EBCMessage(newEBCMessageData));
        }
        private void OperationFinished(IEBCMessage ebcMessage)
        {
            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.IncreaseContrast,
                ebcMessage.EBCMessageData.Image, ebcMessage.EBCMessageData.ImageType);

            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, ebcMessage.EBCMessageData.Image);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        void BotteExtractionComplete(IEBCMessage ebcMessage)
        {
            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.BottleCheck,
                ebcMessage.EBCMessageData.Image, ebcMessage.EBCMessageData.ImageType);

            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, ebcMessage.EBCMessageData.Image);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            this.EBCMessageData = ebcMessage.EBCMessageData;

            if (this.EllipseScanCoordinatesMessage == null)
            {
                this.Out_GetEllipseScanCoordinates(this.EBCMessageData.Image);
            }

            this.ProcessScan();
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            this.EBCMessageData = ebcMessage.EBCMessageData;

            if (this.ThresholdData == null)
            {
                this.Out_SelectThresholds();
            }

            this.ApplyThresholds();
        }
        private void OpeningFinished(IEBCMessage ebcMessage)
        {
            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.Closing,
                ebcMessage.EBCMessageData.Image, ebcMessage.EBCMessageData.ImageType);

            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, ebcMessage.EBCMessageData.Image);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            // Send the message over the communication channel.
            this.TransferMessageClient.TransferMessage(new TransferMessage(ebcMessage.EBCMessageData));

            // Send the debug data with the resulting image containing the ellipse.
            IDebugData debugData = new DebugData(ebcMessage.EBCMessageData.DataResultType, ebcMessage.EBCMessageData.Image);
            
            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(ebcMessage);
        }
 private void InnerReceiveMessage(IEBCMessage ebcMessage)
 {
     // Catch all exceptions and send them to the environment and the connected shape.
     try
     {
         this.MessageReceived(ebcMessage);
     }
     catch (Exception exception)
     {
         this.OnOut_WorkException(new WorkException(exception));
     }
 }
        private void Subtraction_Out_SendMessage(IEBCMessage ebcMessage)
        {
            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.GradientIn,
                ebcMessage.EBCMessageData.Image, ebcMessage.EBCMessageData.ImageType);

            // Send the debug data with the resulting image containing the ellipse.
            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, ebcMessage.EBCMessageData.Image);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            if (ebcMessage.EBCMessageData.ImageType == ImageTypes.FirstSummand)
            {
                this.FirstSummand = ebcMessage.EBCMessageData.Image;
            }
            else if (ebcMessage.EBCMessageData.ImageType == ImageTypes.SecondSummand)
            {
                this.SecondSummand = ebcMessage.EBCMessageData.Image;
            }

            this.AddImages();
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            if (ebcMessage.EBCMessageData.ImageType == ImageTypes.Subtrahend)
            {
                this.SubtrahendImage = ebcMessage.EBCMessageData.Image;
            }
            else if (ebcMessage.EBCMessageData.ImageType == ImageTypes.Minuend)
            {
                this.MinuendImage = ebcMessage.EBCMessageData.Image;
            }

            this.SubstractImages();
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            if (this.FileName != null)
            {
                this.StartProcess();
            }
            else
            {
                this.Out_GetFileName();

                this.StartProcess();
            }
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            IEBCMessageData lastEBCMessageData = ebcMessage.EBCMessageData;

            int[] lookUpTable = lastEBCMessageData.Data as int[];
            Bitmap resultingImage = Histograms.CreateHistogramEqualizedImage(lookUpTable, lastEBCMessageData.Image);

            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.HistogramEqualiziation, resultingImage, lastEBCMessageData.ImageType);

            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, lastEBCMessageData.Image);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            this.LastEBCMessageData = ebcMessage.EBCMessageData;

            if (!String.IsNullOrEmpty(this.FileName))
            {
                this.SaveImage();
            }
            else
            {
                this.Out_GetFileName();

                this.SaveImage();
            }
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            IEBCMessageData lastEBCMessageData = ebcMessage.EBCMessageData;

            int[] grayValueHistogram = Histograms.CreateGrayValueHistogram(lastEBCMessageData.Image);

            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.GrayValueHistogram,
                lastEBCMessageData.Image, grayValueHistogram);

            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, lastEBCMessageData.Image, grayValueHistogram);
            debugData.AddSourceImage(lastEBCMessageData.Image);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            IEBCMessageData lastEBCMessageData = ebcMessage.EBCMessageData;

            int[] cumulativeHistogram = lastEBCMessageData.Data as int[];
            int[] lookUpTable = LookUpTables.CreateLookUpTable(cumulativeHistogram);

            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.LookUpTable,
                lastEBCMessageData.Image, lookUpTable);

            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, lastEBCMessageData.Image, lookUpTable);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            IEBCMessageData lastEBCMessageData = ebcMessage.EBCMessageData;

            int[] grayValueHistogram = lastEBCMessageData.Data as int[];
            int[] cumulativeHistogram = Histograms.CreateCumulativeHistogram(grayValueHistogram);

            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.CumulativeHistogram,
                lastEBCMessageData.Image, cumulativeHistogram);

            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, lastEBCMessageData.Image, cumulativeHistogram);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            for (int i = 0; i < this.RepeatCount; i++)
            {
                // The real data. Both images are equal!
                IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.ImageRepeater,
                    ebcMessage.EBCMessageData.Image, ebcMessage.EBCMessageData.ImageType);

                // Send the debug data with the resulting image containing the ellipse.
                IDebugData debugData = new DebugData(ebcMessageData.DataResultType, ebcMessage.EBCMessageData.Image);
                debugData.AddSourceImage(ebcMessage.EBCMessageData.Image);

                this.OnOut_ShapeDebugMessage(debugData);

                this.OnOut_SendResult(new EBCMessage(ebcMessageData));
            }
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            IEBCMessageData lastEBCMessageData = ebcMessage.EBCMessageData;

            Bitmap resultingImage = FloodFills.FloodFill(lastEBCMessageData.Image, FloodFillModes.FourNeighbour, 
                new Point(150, 250), 0, 255);

            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.FloodFill,
                resultingImage, lastEBCMessageData.ImageType);

            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, resultingImage);
            debugData.AddSourceImage(lastEBCMessageData.Image);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        protected void OnOut_SendResult(IEBCMessage ebcMessage)
        {
            this.LastSendEBCMessage = ebcMessage;

            if (this.ImageType != ImageTypes.Default)
            {
                this.LastSendEBCMessage.EBCMessageData.ImageType = this.ImageType;
            }

            if (this.CanSendMessages && this.Out_SendMessage != null)
            {
                this.Out_SendMessage(ebcMessage);
            }

            // We assume that there was no error, if the result can be send.
            this.OnOut_ExceptionInfo(null);
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            int[,] matrix = new int[,] { { 1, 1, 1 }, { 1, -8, 1 }, { 1, 1, 1 } };

            Bitmap resultingImage = RankingOperations.ApplyLaplace(ebcMessage.EBCMessageData.Image, matrix);

            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.Laplace,
                resultingImage, ebcMessage.EBCMessageData.ImageType);

            // Send the debug data with the resulting image containing the ellipse.
            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, resultingImage);
            debugData.AddSourceImage(ebcMessage.EBCMessageData.Image);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            Bitmap sourceImage = ebcMessage.EBCMessageData.Image;

            Point center = new Point(sourceImage.Width / 2, sourceImage.Height / 2);
            int height = sourceImage.Height - center.Y;

            Bitmap resultingImage = RegionOfInterests.CreateROI(sourceImage, 0, 0, sourceImage.Width, height);

            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.ROICenter, resultingImage, this.ImageType);

            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, resultingImage);
            debugData.AddSourceImage(ebcMessage.EBCMessageData.Image);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
 public void In_MessageTransfered(IEBCMessage ebcMessage)
 {
     // If a message was received, send it through ne normal EBC communication channel.
     this.OnOut_SendResult(new EBCMessage(ebcMessage.EBCMessageData));
 }
 public override void MessageReceived(IEBCMessage ebcMessage)
 {
     // This is not allowed here! The EBC sends messages only over the WCF communication channel!
     throw new InvalidOperationException("The EBC '" + this.Name + "' can't send data through the normal EBC communication channel!");
 }
 public EBCMessage(IEBCMessage ebcMessage, ImageTypes imageTypes)
 {
     this.EBCMessageData = ebcMessage.EBCMessageData;
     this.EBCMessageData.ImageType = imageTypes;
 }
 public override void MessageReceived(IEBCMessage ebcMessage)
 {
     this.Dilatation.In_ReceiveMessage(ebcMessage);
 }
 public override void MessageReceived(IEBCMessage ebcMessage)
 {
     this.Threshold.In_ReceiveMessage(ebcMessage);
 }
 public override void MessageReceived(IEBCMessage ebcMessage)
 {
     this.GrayValueHistogram.In_ReceiveMessage(ebcMessage);
 }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            this.OnOut_ShapeDebugMessage(new DebugData(DataResultTypes.CachedImage, ebcMessage.EBCMessageData.Image));

            this.Out_CachedImage(new CachedImageMessage(ebcMessage.EBCMessageData.Image));
        }