Esempio n. 1
0
        public void Init()
        {
            m_range = new RangeClass();

            // setup default color model
            m_colorModel = new ColorModel("Default");
            m_colorModel.InsertColorStop(0, 0, 0, 0);
            m_colorModel.InsertColorStop(1023, 255, 255, 255);
            m_colorModel.m_controlPts[1].m_value      = 0;
            m_colorModel.m_controlPts[1].m_colorIndex = 0;
            m_colorModel.m_controlPts[2].m_value      = 100;
            m_colorModel.m_controlPts[2].m_colorIndex = 1023;
            m_colorModel.BuildColorGradient();
            m_colorModel.BuildColorMap();

            RangeSlider.DataContext = m_range;
            m_range.RangeMin        = 0;
            m_range.RangeMax        = 100;


            // create default image
            int width  = 1024;
            int height = 1024;

            int numbytes = width * height;

            ushort[] defaultImage = new ushort[numbytes];
            for (int i = 0; i < numbytes; i++)
            {
                defaultImage[i] = 0;                                 // black image
            }
            SetImage(defaultImage, width, height);

            SetImageSize(width, height);
        }
Esempio n. 2
0
        public RunImager()
        {
            InitializeComponent();

            m_imager = null;

            VM = new VM_RunImager("Ready");

            this.DataContext = VM;

            m_range = new RangeClass();

            wgDB = new WaveguideDB();

            m_histogram = new Histogram();

            bool success = wgDB.GetDefaultColorModel(out m_colorModel, GlobalVars.MaxPixelValue, 1024);

            if (!success)
            {
                // setup default color model
                m_colorModel = new ColorModel("Default");
                m_colorModel.InsertColorStop(0, 0, 0, 0);
                m_colorModel.InsertColorStop(1023, 255, 255, 255);
            }

            // make sure that control points 1 and 2 match up with the thumb controls
            // on the slider
            m_colorModel.m_controlPts[1].m_value      = 0;
            m_colorModel.m_controlPts[1].m_colorIndex = 0;
            m_colorModel.m_controlPts[2].m_value      = GlobalVars.MaxPixelValue;
            m_colorModel.m_controlPts[2].m_colorIndex = 1023;

            m_colorModel.BuildColorGradient();
            m_colorModel.BuildColorMap();


            RangeSlider.DataContext = m_range;
            m_range.RangeMin        = 0;
            m_range.RangeMax        = 100;

            HistogramImage.Source = m_histogram.GetHistogramBitmap();
        }
Esempio n. 3
0
        public void Init()
        {
            wgDB    = new WaveguideDB();
            m_range = new RangeClass();

            // setup default color model
            m_colorModel = new ColorModel("Default");
            m_colorModel.InsertColorStop(0, 0, 0, 0);
            m_colorModel.InsertColorStop(1023, 255, 255, 255);
            m_colorModel.m_controlPts[1].m_value      = 0;
            m_colorModel.m_controlPts[1].m_colorIndex = 0;
            m_colorModel.m_controlPts[2].m_value      = 100;
            m_colorModel.m_controlPts[2].m_colorIndex = 1023;
            m_colorModel.BuildColorGradient();
            m_colorModel.BuildColorMap();

            RangeSlider.DataContext = m_range;
            m_range.RangeMin        = 0;
            m_range.RangeMax        = 100;


            // create default image
            int width  = GlobalVars.PixelWidth;
            int height = GlobalVars.PixelHeight;

            int numpixels = width * height;

            ushort[] defaultImage = new ushort[numpixels];
            for (int i = 0; i < numpixels; i++)
            {
                defaultImage[i] = 0;                                  // black image
            }
            SetImage(defaultImage, width, height);

            SetImageSize(width, height);

            m_mask.Reset((int)m_maskImage.Width, (int)m_maskImage.Height, m_mask.Mask.Rows, m_mask.Mask.Cols);

            m_mask.Mask.Description = "";
            m_mask.Mask.Shape       = 0;
        }