Beispiel #1
0
        public static DElementList getProtocolContextSequenceItem()
        {
            DElementList list = new DElementList();

            DElement ValueType = list.Add(new DElement(0x0040, 0xA040, DVR.CS, DValueType.Type1));

            DElement ConceptNameCodeSequence = new DElement(0x0040, 0xA043, DVR.SQ, DValueType.Type1);

            ConceptNameCodeSequence.Sequence.Add(getCodeElementList());
            list.Add(ConceptNameCodeSequence);

            DElement DateTime   = list.Add(new DElement(0x0040, 0xA120, DVR.DT, DValueType.Type1));
            DElement PersonName = list.Add(new DElement(0x0040, 0xA123, DVR.PN, DValueType.Type1));
            DElement TextValue  = list.Add(new DElement(0x0040, 0xA160, DVR.UT, DValueType.Type1));

            DElement ConceptCodeSequence = new DElement(0x0040, 0xA168, DVR.SQ, DValueType.Type1);

            ConceptCodeSequence.Sequence.Add(getCodeElementList());
            list.Add(ConceptCodeSequence);

            DElement MeasurementUnitsCodeSequence = new DElement(0x0040, 0x08EA, DVR.SQ, DValueType.Type1);

            MeasurementUnitsCodeSequence.Sequence.Add(getCodeElementList());
            list.Add(MeasurementUnitsCodeSequence);

            return(list);
        }
Beispiel #2
0
        private static void FillItemArray(List <DPath> list, DElementList eleList, string sqRootPath, int sqIndex)
        {
            foreach (DElement ele in eleList)
            {
                DicomTag tag  = ele.DicomTag;
                DPath    path = DPath.GetDPath(tag, ele.getVR(), "", sqRootPath, sqIndex);
                path.Enable   = (ele.Type != DValueType.Type3 && ele.Type != DValueType.Unknown);
                path.Catagory = ele.Catagory;
                list.Add(path);

                if (ele.VR == DVR.SQ)
                {
                    int index = -1;
                    foreach (DElementList subList in ele.Sequence)
                    {
                        index++;
                        DPath pathBegin = DPath.GetItemGroupPathBegin(index);
                        DPath pathEnd   = DPath.GetItemGroupPathEnd(index);
                        list.Add(pathBegin);
                        FillItemArray(list, subList, path.Path, index);
                        list.Add(pathEnd);
                    }
                }
            }
        }
Beispiel #3
0
        public static DElementList getScheduledProcedureStepSequenceItem(params DElementList[] ScheduledProtocolCodeSequenceItems)
        {
            DElementList list = new DElementList();

            DElement ScheduledStationAETitle    = list.Add(new DElement(0x0040, 0x0001, DVR.AE, DValueType.Type1));
            DElement ScheduledProcedureStepDate = list.Add(new DElement(0x0040, 0x0002, DVR.DA, DValueType.Type1));
            DElement ScheduledProcedureStepTime = list.Add(new DElement(0x0040, 0x0003, DVR.TM, DValueType.Type1));
            DElement Modality = list.Add(new DElement(0x0008, 0x0060, DVR.CS, DValueType.Type1));
            DElement ScheduledPerformingPhysiciansName = list.Add(new DElement(0x0040, 0x0006, DVR.PN, DValueType.Type2));
            DElement ScheduledProcedureStepDescription = list.Add(new DElement(0x0040, 0x0007, DVR.LO, DValueType.Type1));
            DElement ScheduledStationName           = list.Add(new DElement(0x0040, 0x0010, DVR.SH, DValueType.Type2));
            DElement ScheduledProcedureStepLocation = list.Add(new DElement(0x0040, 0x0011, DVR.SH, DValueType.Type2));

            if (ScheduledProtocolCodeSequenceItems.Length > 0)
            {
                DElement ScheduledProtocolCodeSequence = new DElement(0x0040, 0x0008, DVR.SQ, DValueType.Type1);
                foreach (DElementList sqList in ScheduledProtocolCodeSequenceItems)
                {
                    ScheduledProtocolCodeSequence.Sequence.Add(sqList);
                }
                list.Add(ScheduledProtocolCodeSequence);
            }
            DElement PreMedication                = list.Add(new DElement(0x0040, 0x0012, DVR.LO, DValueType.Type2C));
            DElement ScheduledProcedureStepID     = list.Add(new DElement(0x0040, 0x0009, DVR.SH, DValueType.Type1));
            DElement RequestContrastAgent         = list.Add(new DElement(0x0032, 0x1070, DVR.LO, DValueType.Type2C));
            DElement ScheduledProcedureStepStatus = list.Add(new DElement(0x0040, 0x0020, DVR.CS, DValueType.Type3));

            return(list);
        }
Beispiel #4
0
        public static DElementList getReferencedPatientSequenceItem()
        {
            DElementList list = new DElementList();

            DElement ReferencedSOPClassUID    = list.Add(new DElement(0x0008, 0x1150, DVR.UI, DValueType.Type1));
            DElement ReferencedSOPInstanceUID = list.Add(new DElement(0x0008, 0x1155, DVR.UI, DValueType.Type1));

            return(list);
        }
Beispiel #5
0
        public static DElementList getExposureDoseSequenceItem()
        {
            DElementList list = new DElementList();

            DElement KVP                 = list.Add(new DElement(0x0018, 0x0060, DVR.DS, DValueType.Type3));
            DElement ExposureTime        = list.Add(new DElement(0x0018, 0x1150, DVR.IS, DValueType.Type3));
            DElement XRayTubeCurrentInuA = list.Add(new DElement(0x0018, 0x8151, DVR.DS, DValueType.Type3));

            return(list);
        }
Beispiel #6
0
        public static DElementList getCodeElementList()
        {
            DElementList list                 = new DElementList();
            DElement     CodeValue            = list.Add(new DElement(0x0008, 0x0100, DVR.SH, DValueType.Type1));
            DElement     CodeSchemeDesignator = list.Add(new DElement(0x0008, 0x0102, DVR.SH, DValueType.Type1));
            DElement     CodeSchemeVersion    = list.Add(new DElement(0x0008, 0x0103, DVR.SH, DValueType.Type3));
            DElement     CodeMeaning          = list.Add(new DElement(0x0008, 0x0104, DVR.LO, DValueType.Type3));

            return(list);
        }
Beispiel #7
0
        public static DPath[] CreateDPath(DElementList eleList)
        {
            if (eleList == null)
            {
                return(null);
            }
            List <DPath> list = new List <DPath>();

            FillItemArray(list, eleList, null, -1);
            return(list.ToArray());
        }
Beispiel #8
0
 public static void SetCatagory(DElementList eleList, string catagoryName)
 {
     if (eleList == null)
     {
         return;
     }
     foreach (DElement ele in eleList)
     {
         if (ele.Catagory == null || ele.Catagory.Length < 1)
         {
             ele.Catagory = catagoryName;
             if (ele.VR == DVR.SQ)
             {
                 foreach (DElementList subEleList in ele.Sequence)
                 {
                     SetCatagory(subEleList, catagoryName);
                 }
             }
         }
     }
 }
Beispiel #9
0
        public static DElementList getScheduledProtocolCodeSequenceItem(params DElementList[] ProtocolContextSequenceItems)
        {
            DElementList list = new DElementList();

            DElement CodeValue            = list.Add(new DElement(0x0008, 0x0100, DVR.SH, DValueType.Type1));
            DElement CodeSchemeDesignator = list.Add(new DElement(0x0008, 0x0102, DVR.SH, DValueType.Type1));
            DElement CodeSchemeVersion    = list.Add(new DElement(0x0008, 0x0103, DVR.SH, DValueType.Type3));
            DElement CodeMeaning          = list.Add(new DElement(0x0008, 0x0104, DVR.LO, DValueType.Type3));

            if (ProtocolContextSequenceItems.Length > 0)
            {
                DElement ProtocolContextSequence = new DElement(0x0040, 0x0440, DVR.SQ, DValueType.Type3);
                foreach (DElementList sqList in ProtocolContextSequenceItems)
                {
                    ProtocolContextSequence.Sequence.Add(sqList);
                }
                list.Add(ProtocolContextSequence);
            }

            return(list);
        }
Beispiel #10
0
        public DicomCStoreResponse OnCStoreRequest(DicomCStoreRequest request)
        {
            string prefix   = "[STORAGESCP] [" + session + "] ";
            var    studyUid = request.Dataset.Get <string>(DicomTag.StudyInstanceUID);
            var    instUid  = request.SOPInstanceUID.UID;

            Program.Log.Write(prefix + "Begin processing c-store request. " + request.SOPClassUID.UID);

            bool         res = true;
            DElementList iod = new DElementList(request.Dataset);

            if (Program.ConfigMgt.Config.SOAPEnable) //SOAP communication, 20121017
            {
                string requestDataSet = iod.ToDicomXMLString();
                string requestSoap    = string.Empty;
                string responseSoap   = string.Empty;

                string tick = DateTime.Now.Ticks.ToString();

                res = _reqTran.TransformString(requestDataSet, ref requestSoap);

                if (!res)
                {
                    Program.Log.Write(LogType.Error, "Transforming DICOM message to SOAP failed. ");
                    return(new DicomCStoreResponse(request, DicomStatus.ProcessingFailure));
                }

                res = _SOAPClient.SendMessage(requestSoap, out responseSoap);

                if (!res)
                {
                    Program.Log.Write(LogType.Error, "Sending SOAP message failed. ");
                    return(new DicomCStoreResponse(request, DicomStatus.ProcessingFailure));
                }
            }
            else
            {
                if (StorageSCPService.Service == null)
                {
                    Program.Log.Write(prefix + "[WARNING] SCP is not binded to GC Gateway, dump data to local folder only.");
                    iod.SaveXmlFile("StorageIOD_" + DateTime.Now.Ticks.ToString() + ".xml");
                }
                else
                {
                    DataSet dsIOD = DicomMappingHelper.CreateQCDataSet
                                    <StorageItem>(StorageSCPService.Service.StorageList, request.Dataset);

                    if (dsIOD == null)
                    {
                        Program.Log.Write(prefix + "[WARNING] Process storage IOD failed.");
                        return(new DicomCStoreResponse(request, DicomStatus.ProcessingFailure));
                    }

                    res = StorageSCPService.Service.SaveData(Program.ConfigMgt.Config.StorageRule, dsIOD);

                    if (!res)
                    {
                        Program.Log.Write(prefix + "[WARNING] Insert GC Gateway database failed.");
                        return(new DicomCStoreResponse(request, DicomStatus.ProcessingFailure));
                    }
                }
            }
            Program.Log.Write("[STORAGESCP] [" + session + "] Finish processing c-store request. Result:" + res.ToString());

            return(new DicomCStoreResponse(request, DicomStatus.Success));
        }