예제 #1
0
        private void SendImages()
        {
            Random ran = new Random();
            textBox1.Clear();
            
                _seriesMap = new Dictionary<string, string>();
                _prevSentFiles = new List<DicomFile>();
                List<StorageScu> scuClients = new List<StorageScu>();
				StorageScu scu = new StorageScu(LocalAE.Text, ServerAE.Text, ServerHost.Text, int.Parse(ServerPort.Text));
                    scu.ImageStoreCompleted += new EventHandler<ImageStoreEventArgs>(scu_ImageStoreCompleted);
                    scuClients.Add(scu);

                int seriesCount = 0;
                do
                {
                    String seriesDescription = _seriesDesc[ran.Next(_seriesDesc.Count)];
                    string[] seriesUids = new string[_seriesToFilesMap.Count];
                    _seriesToFilesMap.Keys.CopyTo(seriesUids, 0);
                    String seriesToUse = seriesUids[ran.Next(_seriesToFilesMap.Count)];
                    List<string> files = _seriesToFilesMap[seriesToUse];

                
                    foreach (string path in files)
                    {
                        DicomFile file = new DicomFile(path);
                        file.Load();

                        RandomizeFile(file, seriesDescription);
                        _prevSentFiles.Add(file);


                        foreach (StorageScu client in scuClients)
                        {
                            client.AddStorageInstance(new StorageInstance(file));
                        }


                        if (ran.Next() % 50 == 0)
                            break; // don't use all images
                    }

                    seriesCount++;

                } while (ran.Next() % 5 != 0);

                Log(String.Format("Sending {0} images using {1} client(s)", _prevSentFiles.Count, scuClients.Count));
                    scu.BeginSend(InstanceSent, scu);
                    scu.Join();
                    scu.Dispose();
                
        }
예제 #2
0
 private void ResendImages()
 {
     if (_prevSentFiles != null && _prevSentFiles.Count>0)
     {
         using (StorageScu scu = new StorageScu(LocalAE.Text, ServerAE.Text, ServerHost.Text, int.Parse(ServerPort.Text)))
         {
             foreach (DicomFile file in _prevSentFiles)
             {
                 SetDicomFields(file);
                 scu.AddStorageInstance(new StorageInstance(file));
             }
             scu.ImageStoreCompleted += new EventHandler<ImageStoreEventArgs>(scu_ImageStoreCompleted);
             scu.Send();
             scu.Join();
         }
     }
     
 }