Exemplo n.º 1
0
 public PathStorer(CSVSaver CSVSaver)
 {
     paths             = new List <string>();
     currentPath       = -1;
     this.pathAnalyzer = new PathAnalyzer(new PathProvider(), CSVSaver);
     this.records      = new List <CSVRecord>();
 }
Exemplo n.º 2
0
        public Form1()
        {
            InitializeComponent();
            trackBar1.SendToBack();
            Utils.initAutoMapper();
            PropertiesReader.loadValues();
            CSVSaver = new CSVSaver(Directory.GetCurrentDirectory() + PropertiesReader.OUTPUT_CSV_RELATIVE_PATH);
            PathAnalyzer pathAnalyzer = new PathAnalyzer(new PathProvider(), CSVSaver, true);

            pathStorer = new PathStorer(pathAnalyzer);

            currentParameter = 0;
            cSVMerger        = new InformationCSVMerger <PatientRecord>(Directory.GetCurrentDirectory() + PropertiesReader.PATIENT_DATA_RELATIVE_PATH);
            drawer           = new ImageDrawer();
            refreshFeatures();
        }
Exemplo n.º 3
0
 public PathAnalyzer(PathProvider pathProvider, CSVSaver CSVSaver, bool dropPolitics = true)
 {
     this.CSVSaver     = CSVSaver;
     this.pathProvider = pathProvider;
     this.dropPolitics = dropPolitics;
 }
Exemplo n.º 4
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);
        }