Example #1
0
 public CMoveResponse(CMoveRequest req, Status status)
 {
     this.CommandField              = (ushort)C.C_MOVE_RP;
     this.AffectedSOPClassUID       = req.AffectedSOPClassUID;
     this.MessageIDBeingRespondedTo = req.MessageID;
     this.DataSetType = (ushort)257;
     this.Status      = (ushort)status;
     this.GroupLength = (uint)GroupWriter.WriteGroupBytes(new DICOMObject(this.Elements.Skip <IDICOMElement>(1).Take <IDICOMElement>(6).ToList <IDICOMElement>()), new DICOMIOSettings(), "0000").Length;
 }
Example #2
0
 public CStoreResponse(CStoreRequest req, Status status)
 {
     AffectedSOPClassUID       = req.AffectedSOPClassUID;
     CommandField              = (ushort)C.C_STORE_RP;
     MessageIDBeingResponsedTo = req.MessageID;
     DataSetType            = _dataSet;
     AffectedSOPInstanceUID = req.AffectedSOPInstanceUID;
     Status      = (ushort)status;
     GroupLength = (uint)GroupWriter.WriteGroupBytes(new DICOMObject(Elements.Skip(1).Take(6).ToList()),
                                                     new DICOMWriteSettings(), "0000").Length;
 }
Example #3
0
 public CCancel(AbstractDIMSERequest req)
 {
     this.AffectedSOPClassUID       = req.AffectedSOPClassUID;
     this.MessageIDBeingResponsedTo = req.MessageID;
     this.DataSetType  = 257; // No data
     this.CommandField = (ushort)C.C_CANCEL;
     GroupLength       = (uint)GroupWriter.WriteGroupBytes(new DICOMObject(Elements.Skip(1).Take(5).ToList()),
                                                           new DICOMWriteSettings {
         TransferSyntax = TransferSyntax.IMPLICIT_VR_LITTLE_ENDIAN
     }, "0000").Length;
 }
Example #4
0
 /// <summary>
 ///     Used to generate a new Echo Response from an Echo Request
 /// </summary>
 /// <param name="req">the request that is being responded to</param>
 /// <param name="status">the status of the echo</param>
 /// <param name="presContext">the presentation context with which to write the data</param>
 public CEchoResponse(CEchoRequest req, Status status)
 {
     AffectedSOPClassUID       = req.AffectedSOPClassUID;
     CommandField              = (ushort)C.C_ECHO_RP;
     MessageIDBeingRespondedTo = req.MessageID;
     DataSetType = _dataSet;
     Status      = (ushort)status;
     GroupLength = (uint)GroupWriter.WriteGroupBytes(new DICOMObject(Elements.Skip(1).Take(5).ToList()),
                                                     new DICOMWriteSettings {
         TransferSyntax = TransferSyntax.IMPLICIT_VR_LITTLE_ENDIAN
     }, "0000").Length;
 }
Example #5
0
        public void OnRequestRecieved(CFindRequest req, Association asc)
        {
            asc.Logger.LogInformation("<-- DIMSE" + req.GetLogString());
            req.LogData(asc);
            asc.LastActive = DateTime.Now;
            asc.IdleClock.Restart();
            asc.State = NetworkState.TRANSPORT_CONNECTION_OPEN;
            var resp = new CFindResponse(req, Status.SUCCESS);

            dms.RaiseDIMSERequestReceived(req, asc);
            var results = RetrieveResults(req);

            if (results != null)
            {
                foreach (var result in results)
                {
                    resp.Data        = new DICOMObject(result.Elements);
                    resp.Status      = (ushort)Status.PENDING;
                    resp.GroupLength = (uint)GroupWriter.WriteGroupBytes(new DICOMObject(resp.Elements.Skip(1).ToList()),
                                                                         new DICOMIOSettings(), "0000").Length;
                    PDataMessenger.Send(resp, asc,
                                        asc.PresentationContexts.First(p => p.Id == req.DataPresentationContextId));
                }
                //Finish
                resp.Status      = results.Any() ? (ushort)Status.SUCCESS : (ushort)Status.FAILURE_UNABLE_TO_FIND;
                resp.Data        = null;
                resp.GroupLength = (uint)GroupWriter.WriteGroupBytes(new DICOMObject(resp.Elements.Skip(1).ToList()),
                                                                     new DICOMIOSettings(), "0000").Length;
                PDataMessenger.Send(resp, asc);
            }
            else
            {
                resp.Status      = (ushort)Status.FAILURE;
                resp.Data        = null;
                resp.GroupLength = (uint)GroupWriter.WriteGroupBytes(new DICOMObject(resp.Elements.Skip(1).ToList()),
                                                                     new DICOMIOSettings(), "0000").Length;
                PDataMessenger.Send(resp, asc);
            }
        }
Example #6
0
        public void SetGroupLength()
        {
            var bytes = GroupWriter.WriteGroupBytes(new DICOMObject(Elements), DICOMIOSettings.Default(), "0000");

            GroupLength = (uint)bytes.Length;
        }