示例#1
0
		/// ///////////////////////////////////////////////////////////////////////////////////////
		// Public - UI

		// ====================================================================
		// Description: Constructor - initialize the object
		public Resize( ImageView fm )
		// ====================================================================
		{
			InitializeComponent();

			m_Orig = fm;
			this.Text = fm.Text;

			m_dWid = m_Orig.m_Img.Width;
			m_dLen = m_Orig.m_Img.Height;
			
			checkBox_AspectRatio.Checked = true;

			button_OK.Click += new EventHandler ( OnOK );
			button_Cancel.Click += new EventHandler ( OnCancel );

			textBox_OrigLen.Text = Convert.ToString ( m_Orig.m_Img.Height );
			textBox_OrigWid.Text = Convert.ToString ( m_Orig.m_Img.Width );

			textBox_NewLen.Text = Convert.ToString ( m_Orig.m_Img.Height );
			textBox_NewWid.Text = Convert.ToString ( m_Orig.m_Img.Width );
		
			textBox_NewWid.TextChanged += new EventHandler ( OnNewWidChanged );
			textBox_NewLen.TextChanged += new EventHandler ( OnNewLenChanged );

			checkBox_AspectRatio.Click += new EventHandler ( OnAspectRatioClick );
		}
示例#2
0
		// ====================================================================
		//	Description:	Initialize this form / class
		//	Return:			void
		public void OnInitForm ( ImageView fm )
		// ====================================================================
		{
			/* allocation */
			m_Orig = fm;
			this.Text = fm.Text;

			BuiltHist();
			RotateZ(45);
			RotateY(45);
			DrawPBVolume();
			DrawPBSpin((int)PUSH.EMPTY);
		}
示例#3
0
		// ====================================================================
		// Description:	Initialized the object
		// Return:		void
		public void OnInitForm ( ImageView fm )  // [in] image object
		// ====================================================================
		{
			m_Orig = fm;
			this.Text = fm.Text;

			/* Show a preview image */
			if ( m_prv != null)
				m_prv.Dispose();

			m_prv = new ImageView();
			m_prv.MdiParent = this.ParentForm;
			m_prv.OnInitForm ( "Preview", (Bitmap)fm.m_Img );
			m_prv.OnFormSize ( m_Orig.Width-m_Orig.XPADD, m_Orig.Height-m_Orig.YPADD );
			m_prv.Show();
	
			comboBox_Radius.SelectedIndex = 0;
		}
示例#4
0
		public bool OnInitForm(ImageView fm)
		{
			try
			{
				m_Orig = fm;
				this.Text = fm.Text;

				/* Show a preview image */
				if (m_prv != null)
					m_prv.Dispose();

				m_prv = new ImageView();
				m_prv.MdiParent = this.ParentForm;
				m_prv.OnInitForm("Preview", (Bitmap)fm.m_Img);
				m_prv.OnFormSize(m_Orig.Width - m_Orig.XPADD, m_Orig.Height - m_Orig.YPADD);
				m_prv.Show();
				return true;
			}
			catch (Exception e)
			{
				log.Write(e.ToString());
			}
			return false;
		}
示例#5
0
		// ====================================================================
		//	Description:	Initialize this form / class
		//	Return:			void
		public void OnInitForm ( ImageView fm )	// [in] image object
		// ====================================================================
		{
			/* allocation */
			m_Orig = fm;
			m_RGBKHist = new int[CHANNEL_DEPTH*NUM_CHANNEL];
			m_HistMode = new long[NUM_CHANNEL];

			m_MinLoc = new int[NUM_CHANNEL];
			m_MaxLoc = new int[NUM_CHANNEL];
			m_GammaLoc = new int[NUM_CHANNEL];

			/* initialize slider settings */
			for ( int i = 0; i < NUM_CHANNEL; i ++ )
			{
				m_MinLoc[i] = m_MinXPos;
				m_MaxLoc[i] = m_MaxXPos;
				m_GammaLoc[i] = m_MaxXPos-CHANNEL_DEPTH/2;
			}

			BuiltHist((Bitmap)fm.m_Img);				// create histograms R,G,B,Intensity
			FindStat();									// Find Mode of all 4 histograms
			
			comboBox_Channel.Items.Clear();
			comboBox_Channel.Items.Add("Red");			// Initialize combo box
			comboBox_Channel.Items.Add("Green");
			comboBox_Channel.Items.Add("Blue");
			comboBox_Channel.Items.Add("Intensity");
			comboBox_Channel.SelectedIndex = 3;

			this.Text = fm.Text;

			/* Show a preview image */
			if ( m_prv != null)
				m_prv.Dispose();

			m_prv = new ImageView();
			m_prv.MdiParent = this.ParentForm;
			m_prv.OnInitForm ( "Preview", (Bitmap)fm.m_Img );
			m_prv.OnFormSize ( m_Orig.Width-m_Orig.XPADD, m_Orig.Height-m_Orig.YPADD );
			m_prv.Show();
			m_prv.Location = new Point ( m_Orig.Location.X + m_Orig.Width/2, m_Orig.Location.Y+m_Orig.Height/2);
			
		}
示例#6
0
		///////////////////////////////////////////////////////////////////////////////////////////
		// Public

		// ====================================================================
		//	Description:	Constructor
		//	Return:			void
		public ColorRGB(ImageView fm)
		// ====================================================================
		{
			m_Img = fm.m_Img;
		}
示例#7
0
		// ====================================================================
		// Description:	Color - split channels
		// Return		void
		void Color_Split_RGB ( object sender, EventArgs ev )
		// ====================================================================
		{
			try
			{
				if ( m_list.Count > 0 )
				{
					ImageView img = (ImageView)this.ActiveMdiChild;
					ColorRGB clr = new ColorRGB(img);
					
					string[] sName = new string[3];
					sName[(int)ClrChannel.Blue] = "_Blue";
					sName[(int)ClrChannel.Green] = "_Green";
					sName[(int)ClrChannel.Red] = "_Red";

					this.Cursor = Cursors.WaitCursor;
					
					for ( int i = 0; i < 3; i ++ )
					{
						Bitmap bmp = clr.GetChannel ( i );
						ImageView fm = new ImageView();
						fm.MdiParent = this;
						fm.OnInitForm ( img.Text + sName[i], bmp );
						fm.OnFormSize ( img.Width - img.XPADD, img.Height - img.YPADD );
						fm.Show();
						m_list.Add (fm);
					}

					this.Cursor = Cursors.Default;
				}
			}
			catch(Exception e)
			{
				DisplayError("Color_Split_RGB() failed " + e.ToString() );
			}
		}
示例#8
0
		/// ///////////////////////////////////////////////////////////////////////////////////////
		// File

		// ====================================================================
		// Description:	1) Open File Dialog
		//				2) Create a new form
		//				3) Open file and bitblit onto form
		// Return:		void
		void File_Open (object sender, EventArgs evv)
		// ====================================================================
		{
			string sPath;
			try
			{
				sPath = ConfigurationSettings.AppSettings.Get("OPEN_PATH");
				openFileDialog1.InitialDirectory = sPath;
				openFileDialog1.Filter = "All files (*.*)|*.*|JPEG files (*.jpg)|*.jpg|PNG files (*.png)|*.png |TIFF files (*.tif)|*.tif|Bitmap files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif" ;
				openFileDialog1.FilterIndex = 1 ;

				/* I create a temp file because the image is "Locked"
				* during the life of Image.  Temp file is deleted during
				* destruction of the object ImageView.
				*/
				if ( openFileDialog1.ShowDialog() == DialogResult.OK)
				{
					ImageView fm = new ImageView();
					fm.MdiParent = this;
					
		
					fm.OnInitForm ( openFileDialog1.FileName, this.Width, this.Height );
					fm.Show();	
					m_list.Add (fm);

					sPath = openFileDialog1.FileName;
					int pos = sPath.LastIndexOf("\\");
					sPath = sPath.Substring(0, pos+1);
					ConfigurationSettings.AppSettings.Set("OPEN_PATH", sPath);
				}
			}
			catch(Exception e)
			{
				string str = e.ToString();
				if (!str.StartsWith("System.NotSupportedException: Collection is read-only."))
					DisplayError("File_Open() failed " + e.ToString() );
			}
		}
示例#9
0
		// ====================================================================
		// Description:	Color to gray
		// Return		void
		void Color_2_Gray ( object sender, EventArgs ev )
		// ====================================================================
		{
			try
			{
				if ( m_list.Count > 0 )
				{
					ImageView img = (ImageView)this.ActiveMdiChild;
					ColorRGB clr = new ColorRGB(img);
					
					string sName = "_Gray";

					this.Cursor = Cursors.WaitCursor;			
					
					Bitmap bmp = clr.GetChannel ( (int)ClrChannel.Gray );
					ImageView fm = new ImageView();
					fm.MdiParent = this;
					fm.OnInitForm ( img.Text + sName, bmp );
					fm.OnFormSize ( img.Width - img.XPADD, img.Height - img.YPADD );
					fm.Show();
					m_list.Add (fm);

					this.Cursor = Cursors.Default;
				}
			}
			catch(Exception e)
			{
				DisplayError("Color_2_Gray() failed " + e.ToString() );
			}
		}
示例#10
0
		// ====================================================================
		//	Description:	Initialize this form / class
		//	Return:			void
		public void OnInitForm ( ImageView fm )
		// ====================================================================
		{
			/* allocation */
			m_Orig = fm;
			m_RGBKHist = new int[CHANNEL_DEPTH*NUM_CHANNEL];
			BuiltHist((Bitmap)fm.m_Img);				// create histograms R,G,B,Intensity		
			InitKnots();								// create knot points

			/* Show a preview image */
			if ( m_prv != null)
				m_prv.Dispose();

			m_prv = new ImageView();
			m_prv.MdiParent = this.ParentForm;
			m_prv.OnInitForm ( "Preview", (Bitmap)fm.m_Img );
			m_prv.OnFormSize ( m_Orig.Width-m_Orig.XPADD, m_Orig.Height-m_Orig.YPADD );
			m_prv.Show();
			m_prv.Location = new Point ( m_Orig.Location.X + m_Orig.Width/2, m_Orig.Location.Y+m_Orig.Height/2);
	

			/* combo boxes */
			comboBox_Knots.Items.Clear();	
			comboBox_Knots.Items.Add("3");			
			comboBox_Knots.Items.Add("5");			
			comboBox_Knots.Items.Add("9");			
			comboBox_Knots.Items.Add("17");			
			comboBox_Knots.Items.Add("33");			
			comboBox_Knots.Items.Add("65");
			comboBox_Knots.Items.Add("129");
			comboBox_Knots.SelectedIndex = INIT_NUM_KNOT;

			comboBox_Channel.Items.Clear();
			comboBox_Channel.Items.Add("Red");			// Initialize combo box
			comboBox_Channel.Items.Add("Green");
			comboBox_Channel.Items.Add("Blue");
			comboBox_Channel.Items.Add("Intensity");
			comboBox_Channel.SelectedIndex = INIT_CHANNEL;

			this.Text = fm.Text;
		}