Inheritance: System.Windows.Window, System.Windows.Markup.IComponentConnector
        private ProcessorModeFormat processor_mode_ = ProcessorModeFormat.Michael; // set the mode for processor here

        public Manager(MainWindow parent)  // Construct function
        {
            if (processor_mode_ == ProcessorModeFormat.Michael)
                datafeed = new DataFeed(DataFeed.DataSource.Kinect, DataFeed.RangeModeFormat.Near);
            else
                datafeed = new DataFeed(DataFeed.DataSource.Kinect, DataFeed.RangeModeFormat.Default);
            
            #region Create one processor
            // the processor is passed by the current object and the main window controller
            // Note about the new design: there is only one processor which do all the processing, and pass the processed image to a
            // corresponding image control element
            processor = new Processor(processor_mode_, parent);
            processor.lower = 100;
            processor.upper = 1000;
            setDensity(0.91);
            setRadius(10);
            //    Image image = processors[i].getImage();
            //    parent.mainContainer.Children.Add(image);
            #endregion

            #region Processor configurations
            if (processor_mode_ == ProcessorModeFormat.Michael)
            {
                // Whic pipelines to show is decided by the processor.
                processor.setFeatureExtraction(Processor.ShowExtractedFeatureFormat.PredictAllPixelsGPU); 
                
                /*
                processors[0].updatePipeline(
                    // Show the rgb image
                                            Filter.Step.CopyColor
                    // Show the depth image                                         
                    // Filter.Step.Depth    

                    // Show the Color Labelling                                         
                    // Filter.Step.PaintWhite,
                    // Filter.Step.MatchColors
                    );

                //processors[0].updatePipeline(Filter.Step.ColorMatch);
                //processors[1].SetTestModule(Processor.ShowExtractedFeatureFormat.PredictOnePixelCPU | Processor.ShowExtractedFeatureFormat.ShowTransformedForOnePixel); // 
                // one should call SetTestModule to active the FeatureExtractionLib
                processors[1].setFeatureExtraction(Processor.ShowExtractedFeatureFormat.PredictAllPixelsGPU); 
                processors[1].updatePipeline(
                    // Show the rgb image
                    // Filter.Step.CopyColor
                    // Show the depth image                                         
                                            Filter.Step.CopyDepth,
                                            Filter.Step.EnablePredict,
                                            Filter.Step.PerPixelClassificationOnEnable,
                                            Filter.Step.PoolingOnPerPixelClassification,
                                            Filter.Step.ShowOverlay
                    // Show Mapped Depth Using RGB
                    // Filter.Step.PaintWhite,
                    // Filter.Step.MappedDepth
                    // Show the Color Labelling
                    // Filter.Step.PaintWhite,
                    // Filter.Step.MatchColors
                    // Denoise
                    //                        Filter.Step.Denoise
                );
                 */ 
            }
            else if (processor_mode_ == ProcessorModeFormat.Arun) {
                /*
                processors[0].setFeatureExtraction(Processor.ShowExtractedFeatureFormat.ShowTransformedForOnePixel); 
                processors[0].updatePipeline(
                    Filter.Step.PaintWhite,
                    Filter.Step.Crop,
                    Filter.Step.PaintGreen,
                    //Filter.Step.CopyColor,
                    //Filter.Step.MatchColors,
                    //Filter.Step.FeatureExtractOnEnable,
                    Filter.Step.ShowOverlay
                );


                processors[1].setFeatureExtraction(Processor.ShowExtractedFeatureFormat.PredictAllPixelsGPU);
                processors[1].updatePipeline(
                    //Filter.Step.PaintGreen,
                    //Filter.Step.Crop,
                    Filter.Step.CopyDepth,
                    Filter.Step.EnablePredict,
                    Filter.Step.PerPixelClassificationOnEnable,
                    Filter.Step.PoolingOnPerPixelClassification,
                    Filter.Step.ShowOverlay);
                
                */ 
                /*processors[1].SetTestModule(Processor.ShowExtractedFeatureFormat.ShowTransformedForOnePixel);
                processors[1].updatePipeline(
                   Processor.Step.PaintGreen,
                   Processor.Step.Depth,
                   Processor.Step.OverlayOffset
                );*/
                
            }
            #endregion

            // why using a new thread? (Michael)
            poller = new Thread(new ThreadStart(this.poll));
        }
        public ProcessorModeFormat ProcessorMode = ProcessorModeFormat.Michael; // set the mode for processor here


        public Manager(MainWindow parent)  // Construct function
        {
            if (ProcessorMode == ProcessorModeFormat.Michael)
                datafeed = new DataFeed(DataFeed.DataSource.Kinect, DataFeed.RangeModeFormat.Near);
            else
                datafeed = new DataFeed(DataFeed.DataSource.Kinect, DataFeed.RangeModeFormat.Default);
            
            #region Create and arrange Images
            int total_processors = 2;
            processors = new Processor[total_processors];
            for (int i = 0; i < total_processors; i++)
            {
                processors[i] = new Processor(this);
                processors[i].lower = 100;
                processors[i].upper = 1000;
                Image image = processors[i].getImage();
                parent.mainContainer.Children.Add(image);
            }
            #endregion

            #region Processor configurations
			
            
            if (ProcessorMode == ProcessorModeFormat.Michael)
            {
                processors[0].updatePipeline(
                    // Show the rgb image
                                            Filter.Step.CopyColor
                    // Show the depth image                                         
                    // Filter.Step.Depth    

                    // Show the Color Labelling                                         
                    // Filter.Step.PaintWhite,
                    // Filter.Step.MatchColors
                    );

                //processors[0].updatePipeline(Filter.Step.ColorMatch);
                //processors[1].SetTestModule(Processor.ShowExtractedFeatureFormat.PredictOnePixelCPU | Processor.ShowExtractedFeatureFormat.ShowTransformedForOnePixel); // 
                // one should call SetTestModule to active the FeatureExtractionLib

                //processors[1].SetTestModule(Processor.ShowExtractedFeatureFormat.PredictAllPixelsGPU); 
                processors[1].setFeatureExtraction(Processor.ShowExtractedFeatureFormat.ShowTransformedForOnePixel); 
                processors[1].updatePipeline(
                    // Show the rgb image
                    // Filter.Step.CopyColor
                    // Show the depth image 
                    Filter.Step.PaintWhite,
                 //   Filter.Step.Crop,
                    Filter.Step.PaintGreen,
                    Filter.Step.CopyDepth,
                //    Filter.Step.MatchColors,
                //    Filter.Step.FeatureExtractOnEnable,
                    Filter.Step.ShowOverlay


                    // Show Mapped Depth Using RGB
                    // Filter.Step.PaintWhite,
                    // Filter.Step.MappedDepth
                    // Show the Color Labelling
                    // Filter.Step.PaintWhite,
                    // Filter.Step.MatchColors
                    // Denoise
                    //                        Filter.Step.Denoise
                );
            }
            else if (ProcessorMode == ProcessorModeFormat.Arun) {
                processors[0].setFeatureExtraction(Processor.ShowExtractedFeatureFormat.ShowTransformedForOnePixel); 
                processors[0].updatePipeline(
                    Filter.Step.PaintWhite,
                    Filter.Step.Crop,
                    Filter.Step.PaintGreen,
                    //Filter.Step.CopyColor,
                    Filter.Step.MatchColors,
                    Filter.Step.FeatureExtractOnEnable,
                    Filter.Step.ShowOverlay
                );


                processors[1].setFeatureExtraction(Processor.ShowExtractedFeatureFormat.PredictAllPixelsGPU);
                processors[1].updatePipeline(
                    Filter.Step.PaintGreen,
                    Filter.Step.Crop,
                    Filter.Step.CopyDepth,
                    //Filter.Step.EnablePredict,
                    //Filter.Step.PredictOnEnable,
                    Filter.Step.ShowOverlay);
                
                 
                /*processors[1].SetTestModule(Processor.ShowExtractedFeatureFormat.ShowTransformedForOnePixel);
                processors[1].updatePipeline(
                   Processor.Step.PaintGreen,
                   Processor.Step.Depth,
                   Processor.Step.OverlayOffset
                );*/
                
            }
            #endregion

            poller = new Thread(new ThreadStart(this.poll));
        }
 public static void SetMainWindowControler(MainWindow main_window){
     main_window_ = main_window; 
 }