Example #1
0
        private void propertiesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PictureBoxProperties pbp = new PictureBoxProperties();
            CaseImage            cs  = caseImages[currentImage - 1];

            pbp.AddProp("Width", cs.image.Width.ToString());
            pbp.AddProp("Height", cs.image.Height.ToString());
            pbp.AddProp("Image URL", cs.imageURL);
            pbp.AddProp("Study URL", cs.studyURL);
            pbp.AddProp("Study Accession", cs.studyAccession);

            pbp.ShowDialog();
        }
Example #2
0
        void getImages(XmlDocument doc, string sourcedir)
        {
            XmlNodeList nodelist = doc.SelectNodes("//image");

            foreach (XmlNode node in nodelist)
            {
                string src       = node.Attributes["src"].Value;
                string imgsource = Path.Combine(sourcedir, src);
                nextImage = LoadUnlockImage(imgsource);
                CaseImage caseImage   = new CaseImage(nextImage);
                XmlNode   captionNode = node.SelectSingleNode("./image-caption");
                if (captionNode != null)
                {
                    caseImage.caption = captionNode.InnerText;
                }
                XmlNode urlNode = node.SelectSingleNode("./pacs-image");
                if (urlNode != null)
                {
                    caseImage.imageURL = urlNode.Attributes["src"].Value;
                    caseImage.studyUID = urlNode.Attributes["studyUID"].Value;
                    caseImage.imageUID = urlNode.Attributes["imageUID"].Value;
                    XmlNode testNode = urlNode.Attributes["studyURL"];
                    if (testNode != null)
                    {
                        caseImage.studyURL = testNode.Value;
                    }
                    testNode = urlNode.Attributes["studyAccession"];
                    if (testNode != null)
                    {
                        caseImage.studyAccession = testNode.Value;
                    }
                }
                caseImages.Add(caseImage);
            }
            if (caseImages.Count > 0)
            {
                pb.Image     = caseImages[0].image;
                currentImage = 1;
            }
            else
            {
                pb.Image     = null;
                currentImage = 0;
            }
            updateImageLabels();
        }
Example #3
0
        private void imagePanel_DragDrop(object sender, DragEventArgs e)
        {
            toolStripStatusLabel.Text = "";
            if (validData)
            {
                thumbnail.Visible = false;

                if (pb.Image != nextImage)
                {
                    string       imageURL  = "";
                    string       imageUID  = "";
                    string       studyUID  = "";
                    string       studyURL  = "";
                    string       accession = "";
                    MemoryStream ms        = e.Data.GetData("Synapse.FujiOffset") as MemoryStream;
                    if (ms != null)
                    {
                        StreamReader sr     = new StreamReader(ms, Encoding.Unicode);
                        string       mrn    = sr.ReadToEnd().TrimEnd('\0');
                        DialogResult result = DialogResult.Yes;
                        if ((textMRN.Text != "") && (textMRN.Text != mrn))
                        {
                            dialogConflict.Owner = this;
                            result = dialogConflict.ShowDialog();
                            if (result == DialogResult.Cancel)
                            {
                                return;
                            }
                        }
                        if (result != DialogResult.No)
                        {
                            ms = e.Data.GetData("Synapse.TC") as MemoryStream;
                            if (ms != null)
                            {
                                sr = new StreamReader(ms, Encoding.Unicode);
                                string[] tcString = sr.ReadToEnd().Trim('\0').Split(',');
                                foreach (string s in tcString)
                                {
                                    if (s.StartsWith("U="))
                                    {
                                        studyURL = s.Substring(2);
                                    }
                                    if (s.StartsWith("A="))
                                    {
                                        accession = s.Substring(2);
                                    }
                                }
                            }
                            ms           = e.Data.GetData("UniformResourceLocator") as MemoryStream;
                            textLoc.Text = "";
                            if (ms != null)
                            {
                                sr       = new StreamReader(ms);
                                imageURL = sr.ReadToEnd().TrimEnd('\0');

                                int epath_loc = imageURL.IndexOf("epath=");
                                if (epath_loc != -1)
                                {
                                    string epath = DecodeFrom64(imageURL.Substring(epath_loc + 6));
                                    epath    = epath.Substring(0, epath.LastIndexOf("&") + 1);
                                    epath    = epath.Replace("&", "%26");
                                    epath    = epath.Replace("%3A", "%253A");
                                    epath    = epath.Replace("%2F", "%252F");
                                    imageURL = imageURL.Substring(0, epath_loc) + "path=" + epath;
                                }

                                studyUID = Regex.Match(imageURL, @"studyuid=(\d*)").Groups[1].Value;
                                imageUID = Regex.Match(imageURL, @"imageuid=(\d*)").Groups[1].Value;

                                textLoc.Text = mapToLocation(imageURL);
                            }
                            textMRN.Text = mrn;
                            //getCacheDemographics(mrn, accession);
                        }
                    }
                    CaseImage caseImage = new CaseImage(nextImage);
                    caseImage.imageURL       = imageURL;
                    caseImage.studyURL       = studyURL;
                    caseImage.studyAccession = accession;
                    caseImage.studyUID       = studyUID;
                    caseImage.imageUID       = imageUID;
                    caseImages.Add(caseImage);
                    pb.Image     = nextImage;
                    currentImage = caseImages.Count;
                    updateImageLabels();
                    setDirty(true);
                }
            }
        }
Example #4
0
        private void copyToClipboardToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CaseImage cs = caseImages[currentImage - 1];

            Clipboard.SetImage(cs.image);
        }
Example #5
0
        private void imagePanel_DragDrop(object sender, DragEventArgs e)
        {
            toolStripStatusLabel.Text = "";
            if (validData)
            {
                thumbnail.Visible = false;

                if (pb.Image != nextImage)
                {
                    string imageURL = "";
                    string imageUID = "";
                    string studyUID = "";
                    string studyURL = "";
                    string accession = "";
                    MemoryStream ms = e.Data.GetData("Synapse.FujiOffset") as MemoryStream;
                    if (ms != null)
                    {
                        StreamReader sr = new StreamReader(ms, Encoding.Unicode);
                        string mrn = sr.ReadToEnd().TrimEnd('\0');
                        DialogResult result = DialogResult.Yes;
                        if ((textMRN.Text != "") && (textMRN.Text != mrn))
                        {
                            dialogConflict.Owner = this;
                            result = dialogConflict.ShowDialog();
                            if (result == DialogResult.Cancel) return;

                        }
                        if (result != DialogResult.No)
                        {
                            ms = e.Data.GetData("Synapse.TC") as MemoryStream;
                            if (ms != null)
                            {
                                sr = new StreamReader(ms, Encoding.Unicode);
                                string[] tcString = sr.ReadToEnd().Trim('\0').Split(',');
                                foreach (string s in tcString)
                                {
                                    if (s.StartsWith("U="))
                                        studyURL = s.Substring(2);
                                    if (s.StartsWith("A="))
                                        accession = s.Substring(2);
                                }

                            }
                            ms = e.Data.GetData("UniformResourceLocator") as MemoryStream;
                            textLoc.Text = "";
                            if (ms != null)
                            {
                                sr = new StreamReader(ms);
                                imageURL = sr.ReadToEnd().TrimEnd('\0');

                                int epath_loc = imageURL.IndexOf("epath=");
                                if (epath_loc != -1)
                                {
                                    string epath = DecodeFrom64(imageURL.Substring(epath_loc + 6));
                                    epath = epath.Substring(0, epath.LastIndexOf("&") + 1);
                                    epath = epath.Replace("&", "%26");
                                    epath = epath.Replace("%3A", "%253A");
                                    epath = epath.Replace("%2F", "%252F");
                                    imageURL = imageURL.Substring(0, epath_loc) + "path=" + epath;
                                }

                                studyUID = Regex.Match(imageURL, @"studyuid=(\d*)").Groups[1].Value;
                                imageUID = Regex.Match(imageURL, @"imageuid=(\d*)").Groups[1].Value;

                                textLoc.Text = mapToLocation(imageURL);

                            }
                            textMRN.Text = mrn;
                            //getCacheDemographics(mrn, accession);
                        }
                    }
                    CaseImage caseImage = new CaseImage(nextImage);
                    caseImage.imageURL = imageURL;
                    caseImage.studyURL = studyURL;
                    caseImage.studyAccession = accession;
                    caseImage.studyUID = studyUID;
                    caseImage.imageUID = imageUID;
                    caseImages.Add(caseImage);
                    pb.Image = nextImage;
                    currentImage = caseImages.Count;
                    updateImageLabels();
                    setDirty(true);
                }
            }
        }
Example #6
0
 void getImages(XmlDocument doc, string sourcedir)
 {
     XmlNodeList nodelist = doc.SelectNodes("//image");
     foreach (XmlNode node in nodelist)
     {
         string src = node.Attributes["src"].Value;
         string imgsource = Path.Combine(sourcedir, src);
         nextImage = LoadUnlockImage(imgsource);
         CaseImage caseImage = new CaseImage(nextImage);
         XmlNode captionNode = node.SelectSingleNode("./image-caption");
         if (captionNode != null)
         {
             caseImage.caption = captionNode.InnerText;
         }
         XmlNode urlNode = node.SelectSingleNode("./pacs-image");
         if (urlNode != null)
         {
             caseImage.imageURL = urlNode.Attributes["src"].Value;
             caseImage.studyUID = urlNode.Attributes["studyUID"].Value;
             caseImage.imageUID = urlNode.Attributes["imageUID"].Value;
             XmlNode testNode = urlNode.Attributes["studyURL"];
             if (testNode != null)
                 caseImage.studyURL = testNode.Value;
             testNode = urlNode.Attributes["studyAccession"];
             if (testNode != null)
                 caseImage.studyAccession = testNode.Value;
         }
         caseImages.Add(caseImage);
     }
     if (caseImages.Count > 0)
     {
         pb.Image = caseImages[0].image;
         currentImage = 1;
     }
     else
     {
         pb.Image = null;
         currentImage = 0;
     }
     updateImageLabels();
 }