Example #1
0
 /// <summary>
 /// Constructor. Encapsulates a DvtkData.Dimse.AttributeSet instance.
 /// </summary>
 /// <param name="dvtkDataDataSet">The DvtkData.Dimse.DataSet instance to encapsulate.</param>
 internal DataSet(DvtkData.Dimse.DataSet dvtkDataDataSet) : base(dvtkDataDataSet)
 {
     if (dvtkDataAttributeSet == null)
     {
         throw new HliException("Parameter may not be null/Nothing.");
     }
 }
        public static DvtkData.Dimse.DataSet Convert(Hl7Message message)
        {
            DvtkData.Dimse.DataSet dataset = new DvtkData.Dimse.DataSet("Transient");

            try
            {
                if (message != null)
                {
                    // iterate over all the segments in the HL7 message
                    ICollection segments = message.Segments.Values;
                    foreach (Hl7Segment hl7Segment in segments)
                    {
                        // iterate over all the fields in the HL7 segments
                        for (int i = 1; i < hl7Segment.Count; i++)
                        {
                            System.String hl7Value = hl7Segment[i];
                            if (hl7Value != System.String.Empty)
                            {
                                // check if there is an Hl7 Tag corresponding to the value in the DicomHl7Template
                                Hl7Tag hl7Tag = new Hl7Tag(hl7Segment[0], i);
                                DicomHl7TagMap dicomHl7TagMap = DicomHl7TagMapTemplate.FindTagMap(hl7Tag);
                                if (dicomHl7TagMap != null)
                                {
                                    System.String dicomValue = hl7Value;
                                    if (dicomHl7TagMap.ValueConvertor != null)
                                    {
                                        dicomValue = dicomHl7TagMap.ValueConvertor.FromHl7ToDicom(hl7Value, dicomHl7TagMap.Hl7ComponentIndex);
                                    }
                                    AddDicomAttribute(dataset, dicomHl7TagMap.DicomTagPath, dicomValue);
                                }

                                for (int componentIndex = 2; componentIndex < 7; componentIndex++)
                                {
                                    dicomHl7TagMap = DicomHl7TagMapTemplate.FindTagMap(hl7Tag, componentIndex);
                                    if (dicomHl7TagMap != null)
                                    {
                                        System.String dicomValue = hl7Value;
                                        if (dicomHl7TagMap.ValueConvertor != null)
                                        {
                                            dicomValue = dicomHl7TagMap.ValueConvertor.FromHl7ToDicom(hl7Value, dicomHl7TagMap.Hl7ComponentIndex);
                                        }
                                        AddDicomAttribute(dataset, dicomHl7TagMap.DicomTagPath, dicomValue);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (System.Exception e)
            {
                Console.WriteLine("HL7 to DICOM conversion exception: {0} - {1}", e.Message, e.StackTrace);
            }

            return dataset;
        }
Example #3
0
        public static DvtkData.Dimse.DataSet Convert(Hl7Message message)
        {
            DvtkData.Dimse.DataSet dataset = new DvtkData.Dimse.DataSet("Transient");

            try
            {
                if (message != null)
                {
                    // iterate over all the segments in the HL7 message
                    ICollection segments = message.Segments.Values;
                    foreach (Hl7Segment hl7Segment in segments)
                    {
                        // iterate over all the fields in the HL7 segments
                        for (int i = 1; i < hl7Segment.Count; i++)
                        {
                            System.String hl7Value = hl7Segment[i];
                            if (hl7Value != System.String.Empty)
                            {
                                // check if there is an Hl7 Tag corresponding to the value in the DicomHl7Template
                                Hl7Tag         hl7Tag         = new Hl7Tag(hl7Segment[0], i);
                                DicomHl7TagMap dicomHl7TagMap = DicomHl7TagMapTemplate.FindTagMap(hl7Tag);
                                if (dicomHl7TagMap != null)
                                {
                                    System.String dicomValue = hl7Value;
                                    if (dicomHl7TagMap.ValueConvertor != null)
                                    {
                                        dicomValue = dicomHl7TagMap.ValueConvertor.FromHl7ToDicom(hl7Value, dicomHl7TagMap.Hl7ComponentIndex);
                                    }
                                    AddDicomAttribute(dataset, dicomHl7TagMap.DicomTagPath, dicomValue);
                                }

                                for (int componentIndex = 2; componentIndex < 7; componentIndex++)
                                {
                                    dicomHl7TagMap = DicomHl7TagMapTemplate.FindTagMap(hl7Tag, componentIndex);
                                    if (dicomHl7TagMap != null)
                                    {
                                        System.String dicomValue = hl7Value;
                                        if (dicomHl7TagMap.ValueConvertor != null)
                                        {
                                            dicomValue = dicomHl7TagMap.ValueConvertor.FromHl7ToDicom(hl7Value, dicomHl7TagMap.Hl7ComponentIndex);
                                        }
                                        AddDicomAttribute(dataset, dicomHl7TagMap.DicomTagPath, dicomValue);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (System.Exception e)
            {
                Console.WriteLine("HL7 to DICOM conversion exception: {0} - {1}", e.Message, e.StackTrace);
            }

            return(dataset);
        }
Example #4
0
        protected DvtkData.Dimse.DataSet Hl7ToDicom(Hl7Message message)
        {
            DvtkData.Dimse.DataSet dataset = new DvtkData.Dimse.DataSet("Transient");

            if (message != null)
            {
                // try to get the patient id
                CommonIdFormat patientId = new CommonIdFormat();
                patientId.FromHl7Format(message.Value(new Hl7Tag("PID", 3)));
                if (patientId.ToDicomFormat() != System.String.Empty)
                {
                    dataset.AddAttribute(DvtkData.Dimse.Tag.PATIENT_ID.GroupNumber, DvtkData.Dimse.Tag.PATIENT_ID.ElementNumber, DvtkData.Dimse.VR.LO, patientId.ToDicomFormat());
                }

                // try to get the patient's name
                CommonNameFormat patientName = new CommonNameFormat();
                patientName.FromHl7Format(message.Value(new Hl7Tag("PID", 5)));
                if (patientName.ToDicomFormat() != System.String.Empty)
                {
                    dataset.AddAttribute(DvtkData.Dimse.Tag.PATIENTS_NAME.GroupNumber, DvtkData.Dimse.Tag.PATIENTS_NAME.ElementNumber, DvtkData.Dimse.VR.PN, patientName.ToDicomFormat());
                }

                // try to get the patient's birth date
                CommonDateFormat patientBirthDate = new CommonDateFormat();
                patientBirthDate.FromHl7Format(message.Value(new Hl7Tag("PID", 7)));
                if (patientBirthDate.ToDicomFormat() != System.String.Empty)
                {
                    dataset.AddAttribute(DvtkData.Dimse.Tag.PATIENTS_BIRTH_DATE.GroupNumber, DvtkData.Dimse.Tag.PATIENTS_BIRTH_DATE.ElementNumber, DvtkData.Dimse.VR.DA, patientBirthDate.ToDicomFormat());
                }

                // try to get the patient's sex
                CommonStringFormat patientSex = new CommonStringFormat();
                patientSex.FromHl7Format(message.Value(new Hl7Tag("PID", 8)));
                if (patientSex.ToDicomFormat() != System.String.Empty)
                {
                    dataset.AddAttribute(DvtkData.Dimse.Tag.PATIENTS_SEX.GroupNumber, DvtkData.Dimse.Tag.PATIENTS_SEX.ElementNumber, DvtkData.Dimse.VR.CS, patientSex.ToDicomFormat());
                }

                // try to get the merge patient id
                CommonIdFormat mergePatientId = new CommonIdFormat();
                mergePatientId.FromHl7Format(message.Value(new Hl7Tag("MRG", 1)));
                if (mergePatientId.ToDicomFormat() != System.String.Empty)
                {
                    dataset.AddAttribute(DvtkData.Dimse.Tag.OTHER_PATIENT_IDS.GroupNumber, DvtkData.Dimse.Tag.OTHER_PATIENT_IDS.ElementNumber, DvtkData.Dimse.VR.LO, mergePatientId.ToDicomFormat());
                }
            }

            return(dataset);
        }
Example #5
0
 /// <summary>
 /// Patient Update request - update modality worklist information model.
 /// </summary>
 /// <param name="dataset">Dataset containing patient update attributes.</param>
 public void PatientUpdate(DvtkData.Dimse.DataSet dataset)
 {
     _modalityWorklistInformationModel.PatientUpdate(dataset);
 }
Example #6
0
 /// <summary>
 /// Placer order management request - update modality worklist information model.
 /// </summary>
 /// <param name="dataset">Dataset containing placer order management attributes.</param>
 public void PlacerOrderManagement(DvtkData.Dimse.DataSet dataset)
 {
     _modalityWorklistInformationModel.PlacerOrderManagement(dataset);
 }
Example #7
0
 /// <summary>
 /// Placer order management request - update modality worklist information model.
 /// </summary>
 /// <param name="dataset">Dataset containing placer order management attributes.</param>
 public void PlacerOrderManagement(DvtkData.Dimse.DataSet dataset)
 {
     _root.PlacerOrderManagement(dataset);
 }
Example #8
0
 /// <summary>
 /// Patient merge request - update modality worklist information model.
 /// </summary>
 /// <param name="dataset">Dataset containing patient merge attributes.</param>
 public void PatientMerge(DvtkData.Dimse.DataSet dataset)
 {
     _root.PatientMerge(dataset);
 }
Example #9
0
 /// <summary>
 /// Patient Registration request - update modality worklist information model.
 /// </summary>
 /// <param name="dataset">Dataset containing patient registration attributes.</param>
 public void PatientRegistration(DvtkData.Dimse.DataSet dataset)
 {
     _root.PatientRegistration(dataset);
 }
Example #10
0
 protected override void LoadData(DvtkData.Dimse.DataSet _dataSet)
 {
     base.LoadData(_dataSet);
     StudyID          = BaseCompositeInformationEntity.GetDicomValue(_dataSet.GetAttribute(DvtkData.Dimse.Tag.STUDY_ID));
     StudyInstanceUID = BaseCompositeInformationEntity.GetDicomValue(_dataSet.GetAttribute(DvtkData.Dimse.Tag.STUDY_INSTANCE_UID));
 }
Example #11
0
 /// <summary>
 /// Class constructor with DICOM dataset which contains study attributes
 /// </summary>
 /// <param name="_dataSet">DICOM dataset which contains study attributes</param>
 public Study(DvtkData.Dimse.DataSet _dataSet)
     : base()
 {
     LoadData(_dataSet);
 }
Example #12
0
 protected override void LoadData(DvtkData.Dimse.DataSet _dataSet)
 {
     base.LoadData(_dataSet);
     instanceNumber = BaseCompositeInformationEntity.GetDicomValue(_dataSet.GetAttribute(DvtkData.Dimse.Tag.INSTANCE_NUMBER));
     SOPInstanceUID = BaseCompositeInformationEntity.GetDicomValue(_dataSet.GetAttribute(DvtkData.Dimse.Tag.SOP_INSTANCE_UID));
 }
Example #13
0
 /// <summary>
 /// Class constructer with Dataset as parameter
 /// </summary>
 /// <param name="_dataSet">DICOM dataset which is having Image attributes</param>
 public Image(DvtkData.Dimse.DataSet _dataSet)
     : base()
 {
     LoadData(_dataSet);
 }
Example #14
0
        protected Hl7Message DicomtoHl7(DvtkData.Dimse.DataSet dataset)
        {
            Hl7Message message = null;

            return(message);
        }
Example #15
0
        protected DvtkData.Dimse.DataSet Hl7ToDicom(Hl7Message message)
        {
            DvtkData.Dimse.DataSet dataset = new DvtkData.Dimse.DataSet("Transient");

            if (message != null)
            {
                // try to get the patient id
                CommonIdFormat patientId = new CommonIdFormat();
                patientId.FromHl7Format(message.Value(new Hl7Tag("PID", 3)));
                if (patientId.ToDicomFormat() != System.String.Empty)
                {
                   dataset.AddAttribute(DvtkData.Dimse.Tag.PATIENT_ID.GroupNumber, DvtkData.Dimse.Tag.PATIENT_ID.ElementNumber, DvtkData.Dimse.VR.LO, patientId.ToDicomFormat());
                }

                // try to get the patient's name
                CommonNameFormat patientName = new CommonNameFormat();
                patientName.FromHl7Format(message.Value(new Hl7Tag("PID", 5)));
                if (patientName.ToDicomFormat() != System.String.Empty)
                {
                    dataset.AddAttribute(DvtkData.Dimse.Tag.PATIENTS_NAME.GroupNumber, DvtkData.Dimse.Tag.PATIENTS_NAME.ElementNumber, DvtkData.Dimse.VR.PN, patientName.ToDicomFormat());
                }

                // try to get the patient's birth date
                CommonDateFormat patientBirthDate = new CommonDateFormat();
                patientBirthDate.FromHl7Format(message.Value(new Hl7Tag("PID", 7)));
                if (patientBirthDate.ToDicomFormat() != System.String.Empty)
                {
                    dataset.AddAttribute(DvtkData.Dimse.Tag.PATIENTS_BIRTH_DATE.GroupNumber, DvtkData.Dimse.Tag.PATIENTS_BIRTH_DATE.ElementNumber, DvtkData.Dimse.VR.DA, patientBirthDate.ToDicomFormat());
                }

                // try to get the patient's sex
                CommonStringFormat patientSex = new CommonStringFormat();
                patientSex.FromHl7Format(message.Value(new Hl7Tag("PID", 8)));
                if (patientSex.ToDicomFormat() != System.String.Empty)
                {
                    dataset.AddAttribute(DvtkData.Dimse.Tag.PATIENTS_SEX.GroupNumber, DvtkData.Dimse.Tag.PATIENTS_SEX.ElementNumber, DvtkData.Dimse.VR.CS, patientSex.ToDicomFormat());
                }

                // try to get the merge patient id
                CommonIdFormat mergePatientId = new CommonIdFormat();
                mergePatientId.FromHl7Format(message.Value(new Hl7Tag("MRG", 1)));
                if (mergePatientId.ToDicomFormat() != System.String.Empty)
                {
                    dataset.AddAttribute(DvtkData.Dimse.Tag.OTHER_PATIENT_IDS.GroupNumber, DvtkData.Dimse.Tag.OTHER_PATIENT_IDS.ElementNumber, DvtkData.Dimse.VR.LO, mergePatientId.ToDicomFormat());
                }
            }

            return dataset;
        }
Example #16
0
 /// <summary>
 /// Class constructor with DICOM dataset as parameter.
 /// </summary>
 /// <param name="_dataSet">DICOM dataset which contains series attributes</param>
 public Series(DvtkData.Dimse.DataSet _dataSet)
     : base()
 {
     LoadData(_dataSet);
 }