Exemple #1
0
        private void loadPatientInfo()
        {
            PatientCountValue.Text = "" + pathStorer.currentPath;
            PatientRecord rec = InformationCSVMerger <PatientRecord> .getRecord(pathStorer.paths[pathStorer.currentPath], cSVMerger.getRecords());

            if (rec == null)
            {
                SexValue.Text       = "";
                AgeValue.Text       = "";
                ICDValue.Text       = "";
                DescriptionBox.Text = "";
            }
            else
            {
                SexValue.Text       = rec.sex;
                AgeValue.Text       = rec.age;
                ICDValue.Text       = rec.correct_icd_code;
                DescriptionBox.Text = rec.description1;
            }
            CSVStructure = CSVStructure.getStructure(pathStorer.getCurrentRecord());
            loadImageInfo();
        }
Exemple #2
0
        public List <ImagePair> go(CSVSaver CSVSaver, bool zanik)
        {
            int halfW;
            int halfH;

            if (zanik)
            {
                halfW = 80;
                halfH = 80;
            }
            else
            {
                // Połowa wielkości( wysokości i szerokości)
                halfH = 40;
                halfW = 40;
            }

            InformationCSVMerger <CSVRecord> informationCSVMerger = new InformationCSVMerger <CSVRecord>(CSVSaver.CsvPath);
            List <CSVRecord> list = informationCSVMerger.getRecords();
            ImageDrawer      id;

            if (zanik)
            {
                id = getZanikDrawer();
            }
            else
            {
                id = getWyjscieDrawer();
            }

            Image resultImage = new Bitmap(ImageSlider.WIDTH, ImageSlider.HEIGHT, PixelFormat.Format24bppRgb);

            using (Graphics grp = Graphics.FromImage(resultImage))
            {
                grp.FillRectangle(
                    Brushes.Black, 0, 0, resultImage.Width, resultImage.Height);
            }

            List <ImagePair> data = new List <ImagePair>();

            foreach (var item in list)
            {
                ImagePair IP = new ImagePair();
                IP.directory = "/" + item.Patient + "/" + item.Date + "/" + item.Eye + "/mask/";

                BitmapAndPath BAP1 = new BitmapAndPath();
                BAP1.path = IP.directory + item.PierscienImage;

                id.setImage(resultImage);

                Image drawn = id.Draw(CSVStructure.getStructure(item));

                Rectangle cropRect = new Rectangle(item.PierscienX - halfH, item.PierscienY - halfW, halfH * 2, halfW * 2);
                Bitmap    src      = drawn as Bitmap;
                Bitmap    target   = new Bitmap(cropRect.Width, cropRect.Height);

                using (Graphics g = Graphics.FromImage(target))
                {
                    g.DrawImage(src, new Rectangle(0, 0, target.Width, target.Height),
                                cropRect,
                                GraphicsUnit.Pixel);
                }

                BAP1.bmp = new Bitmap(target);

                BitmapAndPath BAP2 = new BitmapAndPath();
                BAP2.path = "/" + item.Patient + '/' + item.Date + '/' + item.Eye + "/" + item.PierscienImage;

                Image original = new Bitmap(Image.FromFile(PropertiesReader.PATH_PROVIDER_ADDITIONAL_ARGS + "/" + item.Patient + "/" + item.Date + "/" + item.PierscienImage), new Size(ImageSlider.WIDTH, ImageSlider.HEIGHT));

                Bitmap src2    = original as Bitmap;
                Bitmap target2 = new Bitmap(cropRect.Width, cropRect.Height);

                using (Graphics g = Graphics.FromImage(target2))
                {
                    g.DrawImage(src2, new Rectangle(0, 0, target2.Width, target2.Height),
                                cropRect,
                                GraphicsUnit.Pixel);
                }

                BAP2.bmp = new Bitmap(target2);

                IP.X = BAP1;
                IP.Y = BAP2;

                data.Add(IP);
            }

            return(data);
        }