当前位置: 首页>>代码示例>>C#>>正文


C# IDicomAttributeProvider.TryGetAttribute方法代码示例

本文整理汇总了C#中IDicomAttributeProvider.TryGetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# IDicomAttributeProvider.TryGetAttribute方法的具体用法?C# IDicomAttributeProvider.TryGetAttribute怎么用?C# IDicomAttributeProvider.TryGetAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDicomAttributeProvider的用法示例。


在下文中一共展示了IDicomAttributeProvider.TryGetAttribute方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StudyInformation

		public StudyInformation(IDicomAttributeProvider attributeProvider)
		{
			if (attributeProvider[DicomTags.StudyId]!=null)
				StudyId = attributeProvider[DicomTags.StudyId].ToString();
            
			if (attributeProvider[DicomTags.AccessionNumber]!=null)
				AccessionNumber = attributeProvider[DicomTags.AccessionNumber].ToString();

			if (attributeProvider[DicomTags.StudyDate] != null )
				StudyDate = attributeProvider[DicomTags.StudyDate].ToString();

			if (attributeProvider[DicomTags.ModalitiesInStudy] != null)
				Modalities = attributeProvider[DicomTags.ModalitiesInStudy].ToString();

			if (attributeProvider[DicomTags.StudyInstanceUid] != null)
				StudyInstanceUid = attributeProvider[DicomTags.StudyInstanceUid].ToString();

			if (attributeProvider[DicomTags.StudyDescription] != null)
				StudyDescription = attributeProvider[DicomTags.StudyDescription].ToString();


			if (attributeProvider[DicomTags.ReferringPhysiciansName] != null)
				ReferringPhysician = attributeProvider[DicomTags.ReferringPhysiciansName].ToString();

			PatientInfo = new PatientInformation(attributeProvider);

		    DicomAttribute seriesUidAttr;
		    if (attributeProvider.TryGetAttribute(DicomTags.SeriesInstanceUid, out seriesUidAttr))
            {
                SeriesInformation series = new SeriesInformation(attributeProvider);
                Add(series);
            }
			
		}
开发者ID:nhannd,项目名称:Xian,代码行数:34,代码来源:StudyInformation.cs

示例2: AddSequenceItem

        /// <summary>
        /// Adds a sequence item to temporarydictionary with the current offset.
        /// </summary>
        /// <param name="recordType">Type of the record.</param>
        /// <param name="dataSet">The data set.</param>
        /// <param name="tags">The tags.</param>
        /// <returns>The newly created DirectoryRecord</returns>
        /// <remarks>Tags are a dictionary of tags and optional values - if the value is null, then it will get the value from the specified dataset</remarks>
        private static DirectoryRecordSequenceItem AddSequenceItem(DirectoryRecordType recordType, IDicomAttributeProvider dataSet, IDictionary<uint, object> tags)
        {
            DirectoryRecordSequenceItem dicomSequenceItem = new DirectoryRecordSequenceItem();
            dicomSequenceItem[DicomTags.OffsetOfTheNextDirectoryRecord].Values = 0;
            dicomSequenceItem[DicomTags.RecordInUseFlag].Values = 0xFFFF;
            dicomSequenceItem[DicomTags.OffsetOfReferencedLowerLevelDirectoryEntity].Values = 0;

        	string recordName;
        	DirectoryRecordTypeDictionary.TryGetName(recordType, out recordName);
            dicomSequenceItem[DicomTags.DirectoryRecordType].Values = recordName;

        	DicomAttribute charSetAttrib;
			if (dataSet.TryGetAttribute(DicomTags.SpecificCharacterSet, out charSetAttrib))
				dicomSequenceItem[DicomTags.SpecificCharacterSet] = charSetAttrib.Copy();

            foreach (uint dicomTag in tags.Keys)
            {
                try
                {
                    DicomTag dicomTag2 = DicomTagDictionary.GetDicomTag(dicomTag);
                	DicomAttribute attrib;
                    if (tags[dicomTag] != null)
                    {
                        dicomSequenceItem[dicomTag].Values = tags[dicomTag];
                    }
                    else if (dataSet.TryGetAttribute(dicomTag, out attrib))
                    {
                        dicomSequenceItem[dicomTag].Values = attrib.Values;
                    }
                    else
                    {
                        Platform.Log(LogLevel.Info, 
							"Cannot find dicomTag {0} for record type {1}", dicomTag2 != null ? dicomTag2.ToString() : dicomTag.ToString(), recordType);
                    }
                }
                catch (Exception ex)
                {
					Platform.Log(LogLevel.Error, ex, "Exception adding dicomTag {0} to directory record for record type {1}", dicomTag, recordType);
                }
            }

            return dicomSequenceItem;
        }
开发者ID:emmandeb,项目名称:ClearCanvas-1,代码行数:51,代码来源:DicomDirectory.cs

示例3: GetDateTimeAttributeValues

		/// <summary>
		/// Gets the date/time value of either a DICOM DT attribute, or a concatenation of a DT attribute and a TM attribute, formatted as a DT string.
		/// </summary>
		/// <param name="dicomAttributeProvider">The source DICOM data set.</param>
		/// <param name="dicomDateTimeTag">The DT tag.</param>
		/// <param name="dicomDateTag">The DA tag.</param>
		/// <param name="dicomTimeTag">The TM tag.</param>
		/// <returns></returns>
		public static string GetDateTimeAttributeValues(IDicomAttributeProvider dicomAttributeProvider, uint dicomDateTimeTag, uint dicomDateTag, uint dicomTimeTag)
		{
			DicomAttribute dicomAttribute;

			// if the DT attribute is present, return that value
			if (dicomDateTimeTag != 0 && dicomAttributeProvider.TryGetAttribute(dicomDateTimeTag, out dicomAttribute) && !dicomAttribute.IsEmpty)
				return dicomAttribute.GetString(0, string.Empty);

			// check for presence of DA attribute, and return that concatenated with the TM attribute value if it exists
			if (dicomDateTag != 0 && dicomAttributeProvider.TryGetAttribute(dicomDateTag, out dicomAttribute))
			{
				var daString = dicomAttribute.GetString(0, string.Empty);
				if (!string.IsNullOrEmpty(daString))
				{
					string tmString = null;
					if (dicomTimeTag != 0 && dicomAttributeProvider.TryGetAttribute(dicomTimeTag, out dicomAttribute) && !dicomAttribute.IsEmpty)
						tmString = dicomAttribute.GetString(0, string.Empty);
					return GetDateTimeAttributeValues(daString, tmString);
				}
			}
			return string.Empty;
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:30,代码来源:DateTimeParser.cs

示例4: GetTimeAttributeValues

		/// <summary>
		/// Gets the time value of a DICOM DT attribute or a TM attribute, formatted as a TM string.
		/// </summary>
		/// <param name="dicomAttributeProvider">The source DICOM data set.</param>
		/// <param name="dicomDateTimeTag">The DT tag.</param>
		/// <param name="dicomTimeTag">The TM tag.</param>
		/// <returns></returns>
		public static string GetTimeAttributeValues(IDicomAttributeProvider dicomAttributeProvider, uint dicomDateTimeTag, uint dicomTimeTag)
		{
			DicomAttribute dicomAttribute;

			// if the DT attribute is present, use the time component of that
			if (dicomDateTimeTag != 0 && dicomAttributeProvider.TryGetAttribute(dicomDateTimeTag, out dicomAttribute) && !dicomAttribute.IsEmpty)
			{
				var dtString = dicomAttribute.GetString(0, string.Empty);
				if (!string.IsNullOrEmpty(dtString)) return GetTimeAttributeValues(dtString);
			}

			// if the TM attribute is present, return that value
			if (dicomTimeTag != 0 && dicomAttributeProvider.TryGetAttribute(dicomTimeTag, out dicomAttribute))
				return dicomAttribute.GetString(0, string.Empty);
			return string.Empty;
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:23,代码来源:DateTimeParser.cs

示例5: AddDicomFileValues

        public void AddDicomFileValues(IDicomAttributeProvider dicomAttributes)
        {
			uint[] dicomTags = new uint[]
                {
                    DicomTags.ImageType,
                    DicomTags.SopClassUid,
                    DicomTags.SopInstanceUid,
                    DicomTags.StudyInstanceUid,
                    DicomTags.SamplesPerPixel,
                    DicomTags.PhotometricInterpretation,
                    DicomTags.NumberOfFrames,
                    DicomTags.Rows,
                    DicomTags.Columns,
                    DicomTags.BitsAllocated,
                    DicomTags.BitsStored,
                    DicomTags.HighBit,
                    DicomTags.PixelRepresentation,
                    DicomTags.SmallestImagePixelValue,
                    DicomTags.LargestImagePixelValue,
                    DicomTags.WindowCenter,
                    DicomTags.WindowWidth,
                    DicomTags.PixelData
                };

            foreach (uint dicomTag in dicomTags)
            {
                try
                {

                    DicomAttribute dicomAttribute;
                    if (dicomAttributes.TryGetAttribute(dicomTag, out dicomAttribute))
                        DicomAttributeProvider[dicomTag].Values = dicomAttribute.Values;
                }
                catch (Exception ex)
                {
                    Platform.Log(LogLevel.Error, ex, "Exception adding dicom tag value for uint: " + dicomTag);
                    throw;
                }
            }
        }
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:40,代码来源:BasicGrayscaleImageSequenceIod.cs

示例6: TryGetAttributeSQ

		private static bool TryGetAttributeSQ(IDicomAttributeProvider provider, uint tag, out DicomAttributeSQ dicomAttributeSQ)
		{
			DicomAttribute dicomAttribute;
			if (provider.TryGetAttribute(tag, out dicomAttribute))
			{
				dicomAttributeSQ = dicomAttribute as DicomAttributeSQ;
				return dicomAttributeSQ != null;
			}
			dicomAttributeSQ = null;
			return false;
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:11,代码来源:VoiDataLut.cs

示例7: FormatString

		private static string FormatString(IDicomAttributeProvider frame, uint dicomTag, string unused)
		{
			DicomAttribute attribute;
			bool tagExists = frame.TryGetAttribute(dicomTag, out attribute) && !attribute.IsEmpty;
			if (tagExists)
				return attribute.ToString();

			return "";
		}
开发者ID:yjsyyyjszf,项目名称:ClearCanvas-1,代码行数:9,代码来源:DXImageAnnotationItemProvider.cs

示例8: GetPixelSpacingAttributeInfo

		private static string GetPixelSpacingAttributeInfo(IDicomAttributeProvider sopDataSource)
		{
			var modality = sopDataSource[DicomTags.Modality].ToString();
			var imagerPixelSpacing = "*";
			var pixelSpacing = "*";
			var pixelSpacingCalibrationType = "*";
			var pixelSpacingCalibrationDescription = "*";
			var estimatedRadiographicMagnificationFactor = "*";

			DicomAttribute attribute;
			if (sopDataSource.TryGetAttribute(DicomTags.ImagerPixelSpacing, out attribute))
				imagerPixelSpacing = attribute.ToString();

			if (sopDataSource.TryGetAttribute(DicomTags.PixelSpacing, out attribute))
				pixelSpacing = attribute.ToString();

			if (sopDataSource.TryGetAttribute(DicomTags.PixelSpacingCalibrationType, out attribute))
				pixelSpacingCalibrationType = attribute.ToString();

			if (sopDataSource.TryGetAttribute(DicomTags.PixelSpacingCalibrationDescription, out attribute))
				pixelSpacingCalibrationDescription = attribute.ToString();

			if (sopDataSource.TryGetAttribute(DicomTags.EstimatedRadiographicMagnificationFactor, out attribute))
				estimatedRadiographicMagnificationFactor = attribute.ToString();

			return string.Format("[{0}] ImagerPixSpac={1} PixSpac={2} PixSpacCalType={3} PixSpacCalDesc={4} EstRadMagFac={5}", modality, imagerPixelSpacing, pixelSpacing, pixelSpacingCalibrationType, pixelSpacingCalibrationDescription, estimatedRadiographicMagnificationFactor);
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:27,代码来源:NormalizedPixelSpacingTests.cs


注:本文中的IDicomAttributeProvider.TryGetAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。