Esempio n. 1
0
        private string UpdateInfoPicture(Image3D ImageToProcess)
        {
            string textBoxInfoPictureText;

            if (ImageToProcess == null)
            {
                textBoxInfoPicture.Text = "No picture selected";
                textBoxImageName.Enabled = false;
                numericUpDownChannelForHisto.Enabled = false;
                radioButtonHistoTypeClassic.Enabled = false;
                radioButtonHistoTypeCumulated.Enabled = false;
                UpdateHisto(null, 0);
                return "";
            }

            textBoxImageName.Enabled = true;
            //textBoxImageName.Text = ImageToProcess.Name;
            textBoxInfoPictureText = "Width : " + ImageToProcess.Width.ToString() + "\r\n";
            textBoxInfoPictureText += "Height : " + ImageToProcess.Height.ToString() + "\r\n";
            textBoxInfoPictureText += "Depth : " + ImageToProcess.Depth.ToString() + "\r\n";
            textBoxInfoPictureText += "Number of channels : " + ImageToProcess.NumBands.ToString() + "\r\n";
            textBoxInfoPictureText += "X Scale : " + ImageToProcess.XResolution + "\r\n";
            textBoxInfoPictureText += "Y Scale : " + ImageToProcess.YResolution + "\r\n";
            textBoxInfoPictureText += "Z Scale : " + ImageToProcess.ZResolution + "\r\n";

            float TmpValue;
            for (int channel = 0; channel < ImageToProcess.NumBands; channel++)
            {
                textBoxInfoPictureText += "----------------------\r\n";

                textBoxInfoPictureText += "Channel " + channel.ToString() + "\r\n";
                float minValue = new IM.Library.Mathematics.MathTools().Min(ImageToProcess.Data[channel]);
                textBoxInfoPictureText += "Min : " + minValue.ToString() + "\r\n";

                float maxValue = new IM.Library.Mathematics.MathTools().Max(ImageToProcess.Data[channel]);
                textBoxInfoPictureText += "Max : " + maxValue.ToString() + "\r\n";

                TmpValue = new IM.Library.Mathematics.MathTools().Mean(ImageToProcess.Data[channel]);
                textBoxInfoPictureText += "Mean : " + TmpValue.ToString() + "\r\n";

                TmpValue = new IM.Library.Mathematics.MathTools().Std(ImageToProcess.Data[channel]);
                textBoxInfoPictureText += "Std : " + TmpValue.ToString() + "\r\n";

                TmpValue = new IM.Library.Mathematics.MathTools().MAD(ImageToProcess.Data[channel], true);
                textBoxInfoPictureText += "MAD : " + TmpValue.ToString() + "\r\n";

                TmpValue = new IM.Library.Mathematics.MathTools().Median(ImageToProcess.Data[channel], 0, ImageToProcess.ImageSize - 1);
                textBoxInfoPictureText += "Median : " + TmpValue.ToString() + "\r\n";

                TmpValue = new IM.Library.Mathematics.MathTools().Skew(ImageToProcess.Data[channel]);
                textBoxInfoPictureText += "Skewness : " + TmpValue.ToString() + "\r\n";

                TmpValue = new IM.Library.Mathematics.MathTools().Kurt(ImageToProcess.Data[channel]);
                textBoxInfoPictureText += "Kurtosis : " + TmpValue.ToString() + "\r\n";

            }

            UpdateHisto(ImageToProcess, (int)numericUpDownChannelForHisto.Value);
            textBoxInfoPicture.Text = textBoxInfoPictureText;

            return textBoxInfoPictureText;
        }
Esempio n. 2
0
        private void meanValuesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ListView.SelectedIndexCollection indexes = this.listViewHeap.SelectedIndices;
            if (indexes.Count == 0) return;

            //Image3D Result = new Image3D(((Image3D)(this.listViewHeap.Items[indexes[0]].Tag)).Width,
            //    ((Image3D)(this.listViewHeap.Items[indexes[0]].Tag)).Height,
            //    ((Image3D)(this.listViewHeap.Items[indexes[0]].Tag)).Depth,
            //    ((Image3D)(this.listViewHeap.Items[indexes[0]].Tag)).NumBands);

            int indexesCount = indexes.Count;
            string sMeanValues;
            float CurrentMean;
            Console.WriteLine("Mean values:");
            for (int i = 0; i < indexesCount; i++)
            {
                Image3D TmpIm = ((Image3D)(this.listViewHeap.Items[indexes[i]].Tag));

                int NumChannel = TmpIm.NumBands;
                sMeanValues = "";
                for (int Band = 0; Band < NumChannel; Band++)
                {
                    CurrentMean = new IM.Library.Mathematics.MathTools().Mean(TmpIm.Data[Band]);
                    sMeanValues += CurrentMean.ToString();
                    sMeanValues += " ";
                }
                Console.WriteLine(sMeanValues);

            }
        }