GetElement() public méthode

public GetElement ( Dicom.Data.DicomTag tag ) : DcmElement
tag Dicom.Data.DicomTag
Résultat DcmElement
        private static Expression<Func<Study, bool>> FilterByModality(DcmDataset query)
        {
            Expression<Func<Study, bool>> allMatch = p => true;

            var studyQuery = query.GetElement(DicomTags.ModalitiesInStudy);

            if (studyQuery == null)
                return allMatch;

            var valueString = studyQuery.GetValueString();

            if (String.IsNullOrWhiteSpace(valueString))
                return allMatch;

            var modalities = valueString.Replace(@"\\", @"\").Split('\\');

            if (modalities.Length == 1)
            {
                return s => s.ModalityAggregation.Contains(modalities[0]);
            }
            else
            {
                return s => s.Series.Any( series => modalities.Contains(series.PerformedModalityType));
            }
        }
        private static Expression<Func<Patient, bool>> FilterByPatientsName(DcmDataset query)
        {
            Expression<Func<Patient, bool>> allMatch = p => true;

            var patientNameQuery = query.GetElement(DicomTags.PatientsName);

            if (patientNameQuery == null)
                return allMatch;

            var patientNameDicomFormatted = patientNameQuery.GetValueString();

            if (String.IsNullOrWhiteSpace(patientNameDicomFormatted))
                return allMatch;

            string[] lName;

            if (patientNameDicomFormatted.Contains("[^]"))
                lName = patientNameDicomFormatted.Split(new[] { "[^]" }, StringSplitOptions.None);
            else if (patientNameDicomFormatted.Contains("^"))
                lName = patientNameDicomFormatted.Split(new[] { "^" }, StringSplitOptions.None);
            else
                lName = patientNameDicomFormatted.Split(new[] { Properties.Settings.Default.PatientNameSplitCharacterForFind });

            var firstName = "";
            var lastName = "";

            if (lName.Length == 0)
                return allMatch;

            if (lName.Length >= 2)
            {
                firstName = lName[1];
                firstName = firstName.TrimEnd('*').Trim();
                firstName = firstName.Replace('*', '%');
            }

            if (lName.Length >= 1)
            {
                lastName = lName[0];
                lastName = lastName.TrimEnd('*').Trim();
                lastName = lastName.Replace('*', '%');
            }

            if (!firstName.StartsWith("\""))
                firstName += "%";
            if (!lastName.StartsWith("\""))
                lastName += "%";

            return p => SqlMethods.Like(p.FirstName, firstName) && SqlMethods.Like(p.LastName, lastName);
        }
        private static Expression<Func<Series, bool>> FilterBySeriesDate(DcmDataset query)
        {
            Expression<Func<Series, bool>> allMatch = p => true;

            var studyQuery = query.GetElement(DicomTags.SeriesDate);

            if (studyQuery == null)
                return allMatch;

            var valueString = studyQuery.GetValueString();

            if (String.IsNullOrWhiteSpace(valueString))
                return allMatch;

            var dateTimeRange = DateTimeRangeQuery.Parse(valueString);

            return s => s.PerformedDateTime >= dateTimeRange.From && s.PerformedDateTime <= dateTimeRange.To;
        }
        private static Expression<Func<Patient, bool>> FilterByPatientsBirthDate(DcmDataset query)
        {
            Expression<Func<Patient, bool>> allMatch = p => true;

            var patientQuery = query.GetElement(DicomTags.PatientsBirthDate);

            if (patientQuery == null)
                return allMatch;

            var valueString = patientQuery.GetValueString();

            if (String.IsNullOrWhiteSpace(valueString))
                return allMatch;

            var dateTimeRange = DateTimeRangeQuery.Parse(valueString);

            return p => p.BirthDateTime >= dateTimeRange.From && p.BirthDateTime <= dateTimeRange.To;
        }
        private static Expression<Func<Study, bool>> FilterByAccessionNumber(DcmDataset query)
        {
            Expression<Func<Study, bool>> allMatch = p => true;

            var studyQuery = query.GetElement(DicomTags.AccessionNumber);

            if (studyQuery == null)
                return allMatch;

            var valueString = studyQuery.GetValueString();

            if (String.IsNullOrWhiteSpace(valueString))
                return allMatch;

            if (valueString.EndsWith("*"))
                return s => s.AccessionNumber.StartsWith(valueString.Trim('*'));
            else
                return s => s.AccessionNumber == valueString;
        }
        private static Expression<Func<Patient, bool>> FilterByPatientsId(DcmDataset query)
        {
            Expression<Func<Patient, bool>> allMatch = p => true;

            var patientQuery = query.GetElement(DicomTags.PatientID);

            if (patientQuery == null)
                return allMatch;

            var valueString = patientQuery.GetValueString();

            if (String.IsNullOrWhiteSpace(valueString))
                return allMatch;

            if (valueString.EndsWith("*"))
                return p => p.ExternalPatientID.StartsWith(valueString.Trim('*'));
            else
                return p => p.ExternalPatientID == valueString;
        }
        private static Expression<Func<Series, bool>> FilterByStudyUid(DcmDataset query)
        {
            Expression<Func<Series, bool>> allMatch = p => true;

            var seriesQuery = query.GetElement(DicomTags.StudyInstanceUID);

            if (seriesQuery == null)
                return allMatch;

            var valueString = seriesQuery.GetValueString();

            if (String.IsNullOrWhiteSpace(valueString))
                return allMatch;

            if (valueString.EndsWith("*"))
            {
                return s => s.StudyInstanceUid.StartsWith(valueString.Trim('*'));
            }
            else
            {
                return s => s.StudyInstanceUid == valueString;
            }
        }
Exemple #8
0
		private void Load(DcmDataset ds) {
			_rows = ds.GetUInt16(OverlayTag(DicomTags.OverlayRows), 0);
			_columns = ds.GetUInt16(OverlayTag(DicomTags.OverlayColumns), 0);
			_type = ds.GetString(OverlayTag(DicomTags.OverlayType), "Unknown");

			DicomTag tag = OverlayTag(DicomTags.OverlayOrigin);
			if (ds.Contains(tag)) {
				short[] xy = ds.GetSS(tag).GetValues();
				if (xy != null && xy.Length == 2) {
					_originX = xy[0];
					_originY = xy[1];
				}
			}

			_bitsAllocated = ds.GetUInt16(OverlayTag(DicomTags.OverlayBitsAllocated), 1);
			_bitPosition = ds.GetUInt16(OverlayTag(DicomTags.OverlayBitPosition), 0);

			tag = OverlayTag(DicomTags.OverlayData);
			if (ds.Contains(tag)) {
				DcmElement elem = ds.GetElement(tag);
				_data = elem.ByteBuffer.ToBytes();
			}

			_description = ds.GetString(OverlayTag(DicomTags.OverlayDescription), String.Empty);
			_subtype = ds.GetString(OverlayTag(DicomTags.OverlaySubtype), String.Empty);
			_label = ds.GetString(OverlayTag(DicomTags.OverlayLabel), String.Empty);

			_frames = ds.GetInt32(OverlayTag(DicomTags.NumberOfFramesInOverlay), 1);
			_frameOrigin = ds.GetUInt16(OverlayTag(DicomTags.ImageFrameOrigin), 1);

			//TODO: include ROI
		}
Exemple #9
0
		public DcmPixelData(DcmDataset dataset) {
			_transferSyntax = dataset.InternalTransferSyntax;
			_lossy = dataset.GetString(DicomTags.LossyImageCompression, "00") != "00";
			_lossyMethod = dataset.GetString(DicomTags.LossyImageCompressionMethod, String.Empty);
			_lossyRatio = dataset.GetString(DicomTags.LossyImageCompressionRatio, String.Empty);
			_frames = dataset.GetInt32(DicomTags.NumberOfFrames, 1);
			_width = dataset.GetUInt16(DicomTags.Columns, 0);
			_height = dataset.GetUInt16(DicomTags.Rows, 0);
			_bitsStored = dataset.GetUInt16(DicomTags.BitsStored, 0);
			_bitsAllocated = dataset.GetUInt16(DicomTags.BitsAllocated, 0);
			_highBit = dataset.GetUInt16(DicomTags.HighBit, (ushort)(_bitsStored - 1));
			_samplesPerPixel = dataset.GetUInt16(DicomTags.SamplesPerPixel, 0);
			_pixelRepresentation = dataset.GetUInt16(DicomTags.PixelRepresentation, 0);
			_planarConfiguration = dataset.GetUInt16(DicomTags.PlanarConfiguration, 0);
			_photometricInterpretation = dataset.GetString(DicomTags.PhotometricInterpretation, String.Empty);
			_rescaleSlope = dataset.GetDouble(DicomTags.RescaleSlope, 1.0);
			_rescaleIntercept = dataset.GetDouble(DicomTags.RescaleIntercept, 0.0);
			_pixelDataItem = dataset.GetItem(DicomTags.PixelData);

			_hasPixelPadding = dataset.Contains(DicomTags.PixelPaddingValue);
			if (_hasPixelPadding) {
				DcmElement elem = dataset.GetElement(DicomTags.PixelPaddingValue);
				if (elem is DcmUnsignedShort)
					_pixelPaddingValue = (elem as DcmUnsignedShort).GetValue();
				else if (elem is DcmSignedShort) {
					_pixelPaddingValue = (elem as DcmSignedShort).GetValue();
				} else
					_pixelPaddingValue = MinimumDataValue;
			}
		}
 private static bool QueryHasPatientSpecificFilters(DcmDataset query)
 {
     return query.Elements.Any(e => e.Tag.Group == 0x0010 && !String.IsNullOrWhiteSpace(query.GetElement(e.Tag).GetValueString()) );
 }
        private static IEnumerable<string> GetFilePaths(MedicalISDataContext database, DcmDataset query)
        {
            if ( ! String.IsNullOrWhiteSpace(query.GetString(DicomTags.SeriesInstanceUID, "")) )
            {
                string seriesInstanceUid = query.GetString(DicomTags.SeriesInstanceUID,"");

                var imagePaths = from i in database.Images
                                 where i.SeriesInstanceUid == seriesInstanceUid
                                 select Path.Combine(Settings.Default.RootPath, i.ArchivedStorageLocation);

                return imagePaths;
            }
            else if ( !String.IsNullOrWhiteSpace(query.GetString(DicomTags.StudyInstanceUID, "")))
            {
                string studyInstanceUid = query.GetElement(DicomTags.StudyInstanceUID).GetValueString();

                var imagePaths = from i in database.Images
                                 where i.Series.Study.StudyInstanceUid == studyInstanceUid
                                 select Path.Combine(Settings.Default.RootPath, i.ArchivedStorageLocation);

                return imagePaths;
            }
            else
            {
                return new string[]{};
            }
        }