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


C# IPresentationImage类代码示例

本文整理汇总了C#中IPresentationImage的典型用法代码示例。如果您正苦于以下问题:C# IPresentationImage类的具体用法?C# IPresentationImage怎么用?C# IPresentationImage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: FromImage

		public static DicomImagePlane FromImage(IPresentationImage sourceImage)
		{
			if (sourceImage == null)
				return null;

			Frame frame = GetFrame(sourceImage);
			SpatialTransform transform = GetSpatialTransform(sourceImage);

			if (transform == null || frame == null)
				return null;

			if (String.IsNullOrEmpty(frame.FrameOfReferenceUid) || String.IsNullOrEmpty(frame.ParentImageSop.StudyInstanceUid))
				return null;

			DicomImagePlane plane;
			if (_referenceCount > 0)
				plane = CreateFromCache(frame);
			else
				plane = CreateFromFrame(frame);

			if (plane != null)
			{
				plane._sourceImage = sourceImage;
				plane._sourceImageTransform = transform;
				plane._sourceFrame = frame;
			}

			return plane;
		}
开发者ID:nhannd,项目名称:Xian,代码行数:29,代码来源:DicomImagePlane.cs

示例2: LinearRoi

		/// <summary>
		/// Constructs a new linear region of interest.
		/// </summary>
		/// <param name="point1">The first end point of the line.</param>
		/// <param name="point2">The second end point of the line.</param>
		/// <param name="presentationImage">The image containing the source pixel data.</param>
		public LinearRoi(PointF point1, PointF point2, IPresentationImage presentationImage) : base(presentationImage)
		{
			List<PointF> points = new List<PointF>();
			points.Add(point1);
			points.Add(point2);
			_points = points.AsReadOnly();
		}
开发者ID:nhannd,项目名称:Xian,代码行数:13,代码来源:LinearRoi.cs

示例3: Apply

		public void Apply(IPresentationImage image)
		{
			var transform = ResetImageOperation.GetSpatialTransform(image);
			if (transform != null)
			{
				transform.Scale = 1.0f;
				transform.TranslationX = 0.0f;
				transform.TranslationY = 0.0f;
				transform.FlipY = false;
				transform.FlipX = false;
				transform.RotationXY = 0;
				transform.ScaleToFit = true;
			}

			var transform3D = ResetImageOperation.GetSpatialTransform3D(image);
			if (transform3D != null)
			{
				transform3D.Scale = 1.0f;
				transform3D.TranslationX = 0.0f;
				transform3D.TranslationY = 0.0f;
				transform3D.TranslationZ = 0.0f;
				transform3D.FlipYZ = false;
				transform3D.FlipXZ = false;
				transform3D.FlipXY = false;
				transform3D.Rotation = null;
			}
		}
开发者ID:jfphilbin,项目名称:ClearCanvas,代码行数:27,代码来源:ResetTool.cs

示例4: Add

		/// <summary>
		/// Adds an <see cref="IPresentationImage"/> to the clipboard.
		/// </summary>
		/// <param name="image"></param>
		/// <remarks>
		/// When called, a copy of the specified <see cref="IPresentationImage"/> is made and stored
		/// in the clipbaord.  This ensures that the <see cref="IPresentationImage"/> is in fact a
		/// snapshot and not a reference that could be changed in unpredictable ways.
		/// Pixel data, however, is not replicated.
		/// </remarks>
		public static void Add(IPresentationImage image)
		{
			Platform.CheckForNullReference(image, "image");

			var clipboard = Default;
			clipboard._items.Add(clipboard.CreatePresentationImageItem(image));
		}
开发者ID:yjsyyyjszf,项目名称:ClearCanvas-1,代码行数:17,代码来源:Clipboard.cs

示例5: GetAnnotationText

		public override string GetAnnotationText(IPresentationImage presentationImage)
		{
			IImageSopProvider provider = presentationImage as IImageSopProvider;
			if (provider == null)
				return "";

            Frame frame = provider.Frame;

            string str;
			
			if (frame.ParentImageSop.ParentSeries != null)
			{
				//TODO: figure out how to do this without the parent series!
				str = String.Format(SR.FormatImageNumberAndCount, frame.ParentImageSop.InstanceNumber, frame.ParentImageSop.ParentSeries.Sops.Count);
			}
			else
			{
				str = frame.ParentImageSop.InstanceNumber.ToString();
			}

            if (frame.ParentImageSop.NumberOfFrames > 1)
            {
                string frameString = String.Format(
					SR.FormatFrameNumberAndCount,
                    frame.FrameNumber,
                    frame.ParentImageSop.NumberOfFrames);

                str += " " + frameString;
            }

            return str;
        }
开发者ID:tcchau,项目名称:ClearCanvas,代码行数:32,代码来源:InstanceNumberAnnotationItem.cs

示例6: GetTransform

		private static IMemorable GetTransform(IPresentationImage image)
		{
			if (image is ISpatialTransformProvider)
				return ((ISpatialTransformProvider)image).SpatialTransform;

			return null;
		}
开发者ID:nhannd,项目名称:Xian,代码行数:7,代码来源:SpatialTransformImageOperation.cs

示例7: GetAnnotationText

		/// <summary>
		/// Gets the annotation text.
		/// </summary>
		/// <param name="presentationImage">the input presentation image.</param>
		/// <returns>the annotation text.</returns>
		public override string GetAnnotationText(IPresentationImage presentationImage)
		{
			string markerText = "";

			if (presentationImage != null)
			{
				ISpatialTransformProvider associatedTransform = presentationImage as ISpatialTransformProvider;
				IImageSopProvider associatedDicom = presentationImage as IImageSopProvider;

				if (associatedDicom != null && associatedTransform != null)
				{
					var spatialTransform = associatedTransform.SpatialTransform as SpatialTransform;
					if (spatialTransform != null)
					{
						var imageOrientationPatient = associatedDicom.Frame.ImageOrientationPatient;
						var patientOrientation = associatedDicom.Frame.PatientOrientation;

						if (imageOrientationPatient != null && !imageOrientationPatient.IsNull)
							markerText = GetAnnotationTextInternal(spatialTransform, imageOrientationPatient);
						else if (patientOrientation != null && patientOrientation.IsValid)
							markerText = GetAnnotationTextInternal(spatialTransform, patientOrientation);
					}
				}
			}

			return markerText;
		}
开发者ID:nhannd,项目名称:Xian,代码行数:32,代码来源:DirectionalMarkerAnnotationItem.cs

示例8: GetAnnotationText

		public override string GetAnnotationText(IPresentationImage presentationImage)
		{
			if (presentationImage != null && presentationImage.ParentDisplaySet != null)
				return presentationImage.ParentDisplaySet.Description ?? "";
			else
				return "";
		}
开发者ID:nhannd,项目名称:Xian,代码行数:7,代码来源:DisplaySetAnnotationItems.cs

示例9: IsImageMarkupPresent

        public static bool IsImageMarkupPresent(IPresentationImage image)
        {
            IOverlayGraphicsProvider currentOverlayGraphics = image as IOverlayGraphicsProvider;
            if (currentOverlayGraphics != null)
            {
                foreach (IGraphic graphic in currentOverlayGraphics.OverlayGraphics)
                {
                    if (graphic is RoiGraphic)
                        return true;

                    ContextMenuControlGraphic contextMenuControlGraphic = graphic as ContextMenuControlGraphic;
                    if (contextMenuControlGraphic != null && contextMenuControlGraphic.Subject != null)
                    {
                        UserCalloutGraphic userCalloutGraphic = contextMenuControlGraphic.Subject as UserCalloutGraphic;
                        if (userCalloutGraphic != null)
                            return true;

                        InvariantTextPrimitive invariantTextPrimitive = contextMenuControlGraphic.Subject as InvariantTextPrimitive;
                        if (invariantTextPrimitive != null)
                            return true;

                        UserCrosshairCalloutGraphic crosshairGraphic = contextMenuControlGraphic.Subject as UserCrosshairCalloutGraphic;
                        if (crosshairGraphic != null)
                            return true;
                    }
                }
            }
            return false;
        }
开发者ID:nettashani,项目名称:annotation-and-image-markup,代码行数:29,代码来源:AimHelpers.cs

示例10: GetLayerOpacityManager

		private static IMemorable GetLayerOpacityManager(IPresentationImage image)
		{
			if (image is FusionPresentationImage)
				return ((FusionPresentationImage) image).LayerOpacityManager;

			return null;
		}
开发者ID:nhannd,项目名称:Xian,代码行数:7,代码来源:LayerOpacityOperation.cs

示例11: GetAnnotationText

		public override string GetAnnotationText(IPresentationImage presentationImage)
		{
			if (presentationImage == null)
				return String.Empty;

			IImageSopProvider imageSopProvider = presentationImage as IImageSopProvider;
			if (imageSopProvider == null)
				return String.Empty;

			ISpatialTransformProvider spatialTransformProvider = presentationImage as ISpatialTransformProvider;
			if (spatialTransformProvider == null)
				return String.Empty;

			// 2D DFOV value doesn't make a lot of sense when the "image" is 3D, so we're blanking it out until we define what DFOV means in this context
			if (presentationImage is ISpatialTransform3DProvider)
				return String.Empty;

			IImageSpatialTransform transform = spatialTransformProvider.SpatialTransform as IImageSpatialTransform;
			if (transform == null)
				return String.Empty;

			if (transform.RotationXY%90 != 0)
				return SR.ValueNotApplicable;

			Frame frame = imageSopProvider.Frame;
			PixelSpacing normalizedPixelSpacing = frame.NormalizedPixelSpacing;
			if (normalizedPixelSpacing.IsNull)
				return String.Empty;

			RectangleF sourceRectangle = new RectangleF(0, 0, frame.Columns, frame.Rows);
			RectangleF destinationRectangle = transform.ConvertToDestination(sourceRectangle);
			destinationRectangle = RectangleUtilities.Intersect(destinationRectangle, presentationImage.ClientRectangle);

			//Convert the displayed width and height to source dimensions
			SizeF widthInSource = transform.ConvertToSource(new SizeF(destinationRectangle.Width, 0));
			SizeF heightInSource = transform.ConvertToSource(new SizeF(0, destinationRectangle.Height));

			//The displayed FOV is given by the magnitude of each line in source coordinates, but
			//for each of the 2 lines, one of x or y will be zero, so we can optimize.

			float x1 = Math.Abs(widthInSource.Width);
			float y1 = Math.Abs(widthInSource.Height);
			float x2 = Math.Abs(heightInSource.Width);
			float y2 = Math.Abs(heightInSource.Height);

			double displayedFieldOfViewX, displayedFieldOfViewY;

			if (x1 > y1) //the image is not rotated
			{
				displayedFieldOfViewX = x1*normalizedPixelSpacing.Column/10;
				displayedFieldOfViewY = y2*normalizedPixelSpacing.Row/10;
			}
			else //the image is rotated by 90 or 270 degrees
			{
				displayedFieldOfViewX = x2*normalizedPixelSpacing.Column/10;
				displayedFieldOfViewY = y1*normalizedPixelSpacing.Row/10;
			}

			return String.Format(SR.FormatCentimeters, String.Format(SR.Format2Dimensions, displayedFieldOfViewX.ToString("F1"), displayedFieldOfViewY.ToString("F1")));
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:60,代码来源:DFOVAnnotationItem.cs

示例12: GetAnnotationText

		public override string GetAnnotationText(IPresentationImage presentationImage)
		{
			if (presentationImage != null && presentationImage.ParentDisplaySet != null)
			{
				if (presentationImage.ParentDisplaySet.ParentImageSet != null)
				{
					return String.Format(SR.FormatDisplaySetNumberAndCount, presentationImage.ParentDisplaySet.Number,
						presentationImage.ParentDisplaySet.ParentImageSet.DisplaySets.Count);
				}
				else
				{
					// try to find a corresponding display set in the logical workspace with a matching UID, and let display set number reflect that
					// this happens particularly when the image is part of a generated display set derived from a display set based on stored DICOM SOP instances
					var displaySetUid = presentationImage.ParentDisplaySet.Uid ?? string.Empty;
					var sourceDisplaySet = presentationImage.ImageViewer.LogicalWorkspace.ImageSets.SelectMany(s => s.DisplaySets).FirstOrDefault(s => s.Uid == displaySetUid);
					if (sourceDisplaySet != null)
						return string.Format(SR.FormatDisplaySetNumberAndCount, sourceDisplaySet.Number, sourceDisplaySet.ParentImageSet.DisplaySets.Count);

					return presentationImage.ParentDisplaySet.Number.ToString(System.Globalization.CultureInfo.InvariantCulture);
				}
			}
			else
			{
				return "";
			}
		}
开发者ID:stevengiblin,项目名称:ClearCanvas,代码行数:26,代码来源:DisplaySetAnnotationItems.cs

示例13: GetAnnotationText

		public override string GetAnnotationText(IPresentationImage presentationImage)
		{
			var imageSopProvider = presentationImage as IImageSopProvider;
			if (imageSopProvider == null)
				return string.Empty;

			var details = imageSopProvider.Frame.NormalizedPixelSpacing.CalibrationDetails;
			switch (imageSopProvider.Frame.NormalizedPixelSpacing.CalibrationType)
			{
				case NormalizedPixelSpacingCalibrationType.None:
					return string.Empty;
				case NormalizedPixelSpacingCalibrationType.Manual:
					return SR.ValueManualCalibration;
				case NormalizedPixelSpacingCalibrationType.CrossSectionalSpacing:
					return SR.ValueActualSpacingCalibration;
				case NormalizedPixelSpacingCalibrationType.Detector:
					return SR.ValueDetectorSpacingCalibration;
				case NormalizedPixelSpacingCalibrationType.Geometry:
					return FormatCalibrationDetails(SR.ValueGeometricCalibration, details);
				case NormalizedPixelSpacingCalibrationType.Fiducial:
					return FormatCalibrationDetails(SR.ValueFiducialCalibration, details);
				case NormalizedPixelSpacingCalibrationType.Magnified:
					return FormatCalibrationDetails(SR.ValueMagnifiedCalibration, details);
				case NormalizedPixelSpacingCalibrationType.Unknown:
				default:
					return FormatCalibrationDetails(SR.ValueUnknownCalibration, details);
			}
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:28,代码来源:ImageCalibrationAnnotationItem.cs

示例14: PresentationImageChangedEventArgs

		/// <summary>
		/// Initializes a new instance of <see cref="PresentationImageChangedEventArgs"/>.
		/// </summary>
		/// <param name="oldPresentationImage"></param>
		/// <param name="newPresentationImage"></param>
		public PresentationImageChangedEventArgs(
			IPresentationImage oldPresentationImage,
			IPresentationImage newPresentationImage)
		{
			_oldPresentationImage = oldPresentationImage;
			_newPresentationImage = newPresentationImage;
		}
开发者ID:nhannd,项目名称:Xian,代码行数:12,代码来源:PresentationImageChangedEventArgs.cs

示例15: Roi

		/// <summary>
		/// Constructs a new region of interest, specifying an <see cref="IPresentationImage"/> as the source of the pixel data.
		/// </summary>
		/// <param name="presentationImage">The image containing the source pixel data.</param>
		protected Roi(IPresentationImage presentationImage)
		{
			IImageGraphicProvider provider = presentationImage as IImageGraphicProvider;
			if (provider == null)
				return;

			_imageRows = provider.ImageGraphic.Rows;
			_imageColumns = provider.ImageGraphic.Columns;
			_presentationImage = presentationImage;

			_pixelData = provider.ImageGraphic.PixelData;
			if (presentationImage is IModalityLutProvider)
				_modalityLut = ((IModalityLutProvider) presentationImage).ModalityLut;

			if (presentationImage is IImageSopProvider)
			{
				Frame frame = ((IImageSopProvider) presentationImage).Frame;
				_normalizedPixelSpacing = frame.NormalizedPixelSpacing;
				_pixelAspectRatio = frame.PixelAspectRatio;
				_modality = frame.ParentImageSop.Modality;
				_modalityLutUnits = frame.RescaleUnits;
				_subnormalModalityLut = frame.IsSubnormalRescale;
			}
			else
			{
				_normalizedPixelSpacing = new PixelSpacing(0, 0);
				_pixelAspectRatio = new PixelAspectRatio(0, 0);
				_modalityLutUnits = RescaleUnits.None;
				_subnormalModalityLut = false;
			}
		}
开发者ID:nhannd,项目名称:Xian,代码行数:35,代码来源:Roi.cs


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