Пример #1
0
        static void Main(string[] args)
        {
            if (args.Length < 3)
            {
                Console.WriteLine(@"Usage: ImagerSender.exe filename studynumber seriesnumber");
                return;
            }

            var actions = new List<Action>();
            for (int threadNum = 0; threadNum < Settings1.Default.SendThreadNumber; threadNum++)
            {
                actions.Add( () =>
                    {
                        var f = new DicomFile(args[0]);
                        f.Load();

                        for (int i = 0; i < int.Parse(args[1]); i++)
                        {
                            f.DataSet[DicomTags.StudyInstanceUid].SetString(0, DicomUid.GenerateUid().UID);
                            for (int j = 0; j < int.Parse(args[2]); j++)
                            {
                                f.DataSet[DicomTags.SeriesInstanceUid].SetString(0, DicomUid.GenerateUid().UID);
                                
                                for (int k = 0; k < 20; k++)
                                {
                                    var scu = new StorageScu(Settings1.Default.AETitle, Settings1.Default.RemoteAETitle,
                                        Settings1.Default.RemoteHost, Settings1.Default.RemotePort);
                                    f.DataSet[DicomTags.SopInstanceUid].SetString(0, MyDicomGenerater.GenerateUid());
                                    scu.AddStorageInstance(new StorageInstance(f));
                                    scu.Send();
                                }

                            }
                        }
                    } );
            }
            SpawnAndWait(actions);

            Console.WriteLine(@"Press any key to exist...");
            Console.ReadKey();

        }
Пример #2
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();
		}