Ejemplo n.º 1
0
        public void AddDS(DicomDataSet addDS)
        {
            DicomDataSet ds = new DicomDataSet();

            ds.Copy(addDS, null, null);
            dsCollection.Add(ds);
        }
Ejemplo n.º 2
0
        public DicomCommandStatusType OnNAction(DicomClient Client, byte PresentationId, int MessageId, string AffectedClass, string Instance, int Action, DicomDataSet Request, DicomDataSet Response)
        {
            DicomDataSet ds = new DicomDataSet(Client.Server.TemporaryDirectory);
            string       ConnectionString = "Data Source='" + Client.Server.ServerDirectory + @"\Dicom.sdf'";
            string       DBFile           = Client.Server.ServerDirectory + @"\Dicom.sdf";

            if (!File.Exists(DBFile))
            {
                return(DicomCommandStatusType.ResourceLimitation);
            }

            ds.Copy(Request, null, null);

            MyParameters parameters = new MyParameters();

            parameters._client           = Client;
            parameters._ds               = ds;
            parameters._connectionString = ConnectionString;
            parameters._presentationId   = PresentationId;
            parameters._messageId        = MessageId;
            parameters.ServerAE          = Client.Server.AETitle;
            result = AsyncHelper.Execute <MyParameters>(new Action <MyParameters>(this.MyDelegate), parameters);

            Response = null;
            return(DicomCommandStatusType.Success);
        }
Ejemplo n.º 3
0
        public static DicomDataSet Copy(this DicomDataSet dataset, string tempDirectory)
        {
            DicomDataSet copy = null;

            if (dataset == null)
            {
                return(copy);
            }

            copy = new DicomDataSet(tempDirectory);
            copy.Copy(dataset, null, null);
            return(copy);
        }
Ejemplo n.º 4
0
        protected override void OnReceiveCStoreRequest(byte presentationID, int messageID, string affectedClass, string instance, DicomCommandPriorityType priority, string moveAE, int moveMessageID, DicomDataSet dataSet)
        {
            DicomDataSet ds = new DicomDataSet();

            server.cfind.InvokeStatusEvent(StatusType.ReceiveCStoreRequest, DicomExceptionCode.Success);
            if (dataSet == null)
            {
                SendCStoreResponse(presentationID, messageID, affectedClass, instance, DicomCommandStatusType.ProcessingFailure);
                return;
            }

            ds.Copy(dataSet, null, null);
            server.dsCollection.Add(ds);

            server.cfind.InvokeStatusEvent(StatusType.SendCStoreResponse, DicomExceptionCode.Success);
            SendCStoreResponse(presentationID, messageID, affectedClass, instance, DicomCommandStatusType.Success);
        }
Ejemplo n.º 5
0
        private DicomDataSet Anonymize()
        {
            DicomDataSet dsAnonymized = new DicomDataSet();

            try
            {
                DicomElement pixelData = null;

                pixelData = _ActiveDataSet.FindFirstElement(null, DicomTag.PixelData, true);
                _Anonymizer.BlackoutRects.Clear();
                if (toolStripButtonRedact.Checked && pixelData != null && _ActiveDataSet.GetImageCount(pixelData) > 0)
                {
                    using (SelectBlackoutRectsDialog dlgRects = new SelectBlackoutRectsDialog(_ActiveDataSet))
                    {
                        if (dlgRects.ShowDialog(this) == DialogResult.OK && dlgRects.BlackoutRects.Count > 0)
                        {
                            _Anonymizer.BlackoutRects.AddRange(dlgRects.BlackoutRects);
                        }
                    }
                }

                if (_ActiveDataSet.InformationClass != DicomClassType.BasicDirectory)
                {
                    dsAnonymized.Copy(_ActiveDataSet, null, null);
                    ToggleProgress(true);
                    _Anonymizer.Anonymize(dsAnonymized);
                    ShowDifference(_ActiveDataSet, dsAnonymized);
                }
            }
            catch (Exception exception)
            {
                Messager.ShowError(this, exception);
            }
            finally
            {
                ToggleProgress(false);
            }
            return(dsAnonymized);
        }
Ejemplo n.º 6
0
        private static DicomDataSet Copy(DicomDataSet dsOriginal)
        {
            DicomDataSet   copy      = new DicomDataSet();
            AutoResetEvent copyEvent = new AutoResetEvent(false);

            if (dsOriginal == null)
            {
                return(null);
            }

            try
            {
                copy.Copy(dsOriginal, null, null, DicomCopyCallback);
            }
            catch (Exception e)
            {
                Exception ex           = e;
                string    errorMessage = string.Empty;

                while (ex != null)
                {
                    errorMessage += ex.ToString() + "\r\n";
                    ex            = ex.InnerException;
                }

                try
                {
                    DicomLogEntry logEntry = new DicomLogEntry();

                    logEntry.ClientAETitle = "Logger";
                    logEntry.Description   = errorMessage;
                    logEntry.LogType       = LogType.Error;

                    Logger.Global.Log(logEntry);
                }
                catch { }
            }
            return(copy);
        }
Ejemplo n.º 7
0
 public DicomDS Copy()
 {
     return(new DicomDS(_Dataset.Copy()));
 }