Esempio n. 1
0
        public DicomParseHelper(string filepath)
        {
            ImageList = new List <DicomImageItem>();
            //FileInfo fileInfo = new FileInfo(filepath);

            string path = HttpContext.Current.Server.MapPath(filepath);

            ImageVPath = filepath.Replace(".", "").Replace("~", "") + "/images";
            ImagePPath = HttpContext.Current.Server.MapPath(ImageVPath);
            if (!Directory.Exists(ImagePPath))
            {
                Directory.CreateDirectory(ImagePPath);
            }
            DicomFilePath = path;

            foreach (string file in Directory.GetFiles(path))
            {
                DicomImage dcm = new  DicomImage(file);

                for (int i = 0; i < dcm.FrameCount; i++)
                {
                    dcm.Frame = i;
                    Bitmap bmp = dcm.Bitmap();
                    bmp.Save(ImagePPath + "\\big" + (new FileInfo(file)).Name + i.ToString() + ".jpg");
                    SaveThumbnail((new FileInfo(file)).Name, i, bmp, 64, 64);
                    ImageList.Add(new DicomImageItem()
                    {
                        BigImage   = ImageVPath + "/big" + (new FileInfo(file)).Name + i.ToString() + ".jpg",
                        SmallImage = ImageVPath + "/small" + (new FileInfo(file)).Name + i.ToString() + ".jpg"
                    });
                }
            }
        }