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();
         }
     }
     
 }
Beispiel #2
0
        private void InsertStudy(SopGenerator generator, DateTime currentDay)
        {
            try
            {
                DicomFile file = generator.NewStudy(currentDay);

                if (_partition == null)
                {
                    var scu = new StorageScu("TESTTOOL", _aeTitle, _host, _port);

                    scu.AddStorageInstance(new StorageInstance(file));
                    int series = _rand.Next(1, generator.MaxSeries);
                    for (int i = 1; i < series; i++)
                    {
                        file = generator.NewSeries();
                        scu.AddStorageInstance(new StorageInstance(file));
                    }
                    scu.Send();
                }
                else
                {


                    InsertInstance(file);
                    int series = _rand.Next(1, generator.MaxSeries);
                    for (int i = 1; i < series; i++)
                    {
                        file = generator.NewSeries();
                        InsertInstance(file);
                    }
                }
            }
            catch (Exception e)
            {
                Platform.Log(LogLevel.Error, e, "Unexecpted exception inserting instance into the database.");
            }
        }
Beispiel #3
0
		/// <summary>
		/// Builds the study tree and publishes all the created studies to the specified application entity.
		/// </summary>
		/// <remarks>
		/// <para>The <see cref="BuildTree"/> method is called automatically, and hence does not need to be explicitly called before invoking this method.</para>
		/// </remarks>
		/// <param name="localAE">The local AETITLE that is sending the studies.</param>
		/// <param name="remoteAE">The AETITLE of the device that is receiving the studies.</param>
		/// <param name="remoteHost">The hostname of the device that is receiving the studies.</param>
		/// <param name="remotePort">The port number on which the device receiving the studies is listening.</param>
		/// <returns>A list of the SOP instance UIDs that were created.</returns>
		public IList<string> Publish(string localAE, string remoteAE, string remoteHost, int remotePort)
		{
			List<SopInstanceNode> sops;

			try
			{
				sops = DoBuildTree();
			}
			catch (Exception ex)
			{
				throw new StudyBuilderException("Unexpected StudyBuilder error", ex);
			}

			List<string> uids = new List<string>(sops.Count);

			try
			{
				StorageScu scu = new StorageScu(localAE, remoteAE, remoteHost, remotePort);

				// queue each instance into scu
				foreach (SopInstanceNode sop in sops)
				{
					StorageInstance sInst = new StorageInstance(sop.DicomFile);
					scu.AddStorageInstance(sInst);
					uids.Add(sop.InstanceUid);
				}

				// begin asynch send operation
				scu.Send();
			}
			catch (Exception ex)
			{
				throw new StudyBuilderException("Storage SCU error", ex);
			}

			return uids.AsReadOnly();
		}