Пример #1
0
        public RecordCollection CFind(DataSet dicom)
        {
            PresentationDataPdu   pdu = new PresentationDataPdu(Syntaxes[0]);
            PresentationDataValue pdv = new PresentationDataValue(PresentationContextId, Syntaxes[0], MessageType.LastCommand);

            DataSet command = new DataSet();

            command.Add(t.GroupLength(0), (uint)0);
            command.Add(t.AffectedSOPClassUID, SOPClassUId);
            command.Add(t.CommandField, (ushort)CommandType.C_FIND_RQ);
            command.Add(t.MessageId, (ushort)1);
            command.Add(t.Priority, (ushort)Priority.Medium);
            command.Add(t.CommandDataSetType, (ushort)DataSetType.DataSetPresent);

            pdv.Dicom = command;
            pdu.Values.Add(pdv);

            records = new RecordCollection();

            SendPdu("C-FIND-RQ", pdu);
            SendDataPdu("C-FIND-RQ DATA", dicom);

            Dictionary <string, string> errors = new Dictionary <string, string>();

            errors.Add("A700", "Refused: Out of Resources");
            errors.Add("A900", "Identifier does not match SOP Class");
            errors.Add("C", "Unable to process");

            ProcessResponse("C-FIND-RQ", 30000, errors, null);
            // it is figured that Status.Pending would not bee seen here

            return(records);
        }
Пример #2
0
        public RecordCollection InternalQuery(Elements query)
        {
            RecordCollection records = new RecordCollection();

            if (this.SOPClassUId != SOPClass.ModalityWorklistInformationModelFIND)
            {
                DicomDir dir = new DicomDir(".");

                string level = (string)query[t.QueryRetrieveLevel].Value;

                foreach (Patient patient in dir.Patients)
                {
                    if (level == "PATIENT")
                    {
                        if (Compare(query, patient.Elements))
                        {
                            records.Add(patient.Elements);
                        }
                    }
                    else
                    {
                        foreach (Study study in patient)
                        {
                            if (level == "STUDY")
                            {
                                if (Compare(query, study.Elements))
                                {
                                    records.Add(study.Elements);
                                }
                            }
                            else
                            {
                                foreach (Series series in study)
                                {
                                    if (level == "SERIES")
                                    {
                                        if (Compare(query, series.Elements))
                                        {
                                            records.Add(series.Elements);
                                        }
                                    }
                                    else
                                    {
                                        foreach (Image image in series)
                                        {
                                            if (Compare(query, image.Elements))
                                            {
                                                records.Add(image.Elements);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(records);
        }
Пример #3
0
        public void OnData(MessageType control, Message message)
        {
            // TODO put a lock on the pdu array
            // TODO interpret the commands

            Logging.Log("CFindServiceSCU({0}).OnData", Reflection.GetName(typeof(SOPClass), this.SOPClassUId));

            DataSet dicom = message.Dicom;

            if (MessageControl.IsCommand(control))
            {
                ushort status = (ushort)dicom[t.Status].Value;
                bool   last   = !(status == 0xFF00 || status == 0xFF01);

                //if (!last && status == 0xFF01)
                //{
                //    Logging.Log("Warning that one or more Optional Keys were not supported for existence and/or matching for this Identifier.");
                //}

                DataSetType present = (DataSetType)dicom[t.CommandDataSetType].Value;

                Logging.Log("<< C-FIND-RSP {0},{1}", (last) ? "LAST FRAGMENT" : "NOT-LAST FRAGMENT", present.ToString());
                //dicom.Dump();

                if (last)
                {
                    // TODO do we reset the state to Open here
                    completeEvent.Set();
                }
            }
            else
            {
                Logging.Log("<< P-DATA-TF");
                if (records == null)
                {
                    records = new RecordCollection();
                }
                records.Add(dicom.Elements);
            }
        }
Пример #4
0
 public QueryEventArgs(DataSet query)
 {
     this.cancel  = false;
     this.query   = query;
     this.records = new RecordCollection();
 }
Пример #5
0
 /// <summary>
 /// Initializes a new PduDataEventArgs instance with the specified RecordCollection.
 /// </summary>
 /// <param name="records"></param>
 public MwlEventArgs(RecordCollection records)
 {
     this.records = records;
 }