Inheritance: DicomDataset
Exemple #1
0
 public static void Start(int port, string aet)
 {
     Printer = new Printer(aet);
     _server = new DicomServer<PrintService>(port);
 }
        /// <summary>
        /// Construct new print job using specified SOP instance UID. If passed SOP instance UID is missing, new UID will
        /// be generated
        /// </summary>
        /// <param name="sopInstance">New print job SOP instance uID</param>
        public PrintJob(DicomUID sopInstance, Printer printer, string originator, Dicom.Log.Logger log)
            : base()
        {
            if (printer == null)
            {
                throw new ArgumentNullException("printer");
            }

            Log = log;

            if (sopInstance == null || sopInstance.UID == string.Empty)
            {
                SOPInstanceUID = DicomUID.Generate();
            }
            else
            {
                SOPInstanceUID = sopInstance;
            }

            this.Add(DicomTag.SOPClassUID, SOPClassUID);
            this.Add(DicomTag.SOPInstanceUID, SOPInstanceUID);

            Printer = printer;

            Status = PrintJobStatus.Pending;

            PrinterName = Printer.PrinterAet;

            Originator = originator;

            if (CreationDateTime == DateTime.MinValue)
            {
                CreationDateTime = DateTime.Now;
            }

            PrintJobFolder = SOPInstanceUID.UID;

            var receivingFolder = Environment.CurrentDirectory + @"\PrintJobs";

            FullPrintJobFolder = string.Format(@"{0}\{1}", receivingFolder.TrimEnd('\\'), PrintJobFolder);

            FilmBoxFolderList = new List<string>();
        }
Exemple #3
0
        public Task OnReceiveAssociationRequestAsync(DicomAssociation association)
        {
            Logger.Info("Received association request from AE: {0} with IP: {1} ", association.CallingAE, RemoteIP);
            string calledAE = association.CalledAE;

            this._config = Config_.Instance.FindPrinter(calledAE);

            if (!ReferenceEquals(this._config, null))
            {
                Printer = new Printer(this._config.AETitle);
            }
            else
            {
                MessageBox.Show("AET ERROR PLEASE CHECK");
            }

            if (Printer.PrinterAet != association.CalledAE)
            {
                Logger.Error(
                    "Association with {0} rejected since requested printer {1} not found",
                    association.CallingAE,
                    association.CalledAE);
                return(SendAssociationRejectAsync(
                           DicomRejectResult.Permanent,
                           DicomRejectSource.ServiceUser,
                           DicomRejectReason.CalledAENotRecognized));
            }

            CallingAE = association.CallingAE;
            CalledAE  = Printer.PrinterAet;

            foreach (var pc in association.PresentationContexts)
            {
                if (pc.AbstractSyntax == DicomUID.Verification ||
                    pc.AbstractSyntax == DicomUID.BasicGrayscalePrintManagementMetaSOPClass ||
                    pc.AbstractSyntax == DicomUID.BasicColorPrintManagementMetaSOPClass ||
                    pc.AbstractSyntax == DicomUID.PrinterSOPClass ||
                    pc.AbstractSyntax == DicomUID.BasicFilmSessionSOPClass ||
                    pc.AbstractSyntax == DicomUID.BasicFilmBoxSOPClass ||
                    pc.AbstractSyntax == DicomUID.BasicGrayscaleImageBoxSOPClass ||
                    pc.AbstractSyntax == DicomUID.BasicColorImageBoxSOPClass)
                {
                    pc.AcceptTransferSyntaxes(AcceptedTransferSyntaxes);
                }
                else if (pc.AbstractSyntax == DicomUID.PrintJobSOPClass)
                {
                    pc.AcceptTransferSyntaxes(AcceptedTransferSyntaxes);
                    _sendEventReports = true;
                }
                else
                {
                    Logger.Warn(
                        "Requested abstract syntax {abstractSyntax} from {callingAE} not supported",
                        pc.AbstractSyntax,
                        association.CallingAE);
                    pc.SetResult(DicomPresentationContextResult.RejectAbstractSyntaxNotSupported);
                }
            }

            Logger.Info("Accepted association request from {callingAE}", association.CallingAE);
            return(SendAssociationAcceptAsync(association));
        }
Exemple #4
0
 public static void Start(int port, string aet)
 {
     Printer = new Printer(aet);
     _server = DicomServer.Create <PrintService>(port);
 }
Exemple #5
0
 public static void Printer_ini(string aet)
 {
     Printer = new Printer(aet);
 }