本文整理汇总了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;
}
示例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();
}
示例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;
}
}
示例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));
}
示例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;
}
示例6: GetTransform
private static IMemorable GetTransform(IPresentationImage image)
{
if (image is ISpatialTransformProvider)
return ((ISpatialTransformProvider)image).SpatialTransform;
return null;
}
示例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;
}
示例8: GetAnnotationText
public override string GetAnnotationText(IPresentationImage presentationImage)
{
if (presentationImage != null && presentationImage.ParentDisplaySet != null)
return presentationImage.ParentDisplaySet.Description ?? "";
else
return "";
}
示例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;
}
示例10: GetLayerOpacityManager
private static IMemorable GetLayerOpacityManager(IPresentationImage image)
{
if (image is FusionPresentationImage)
return ((FusionPresentationImage) image).LayerOpacityManager;
return null;
}
示例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")));
}
示例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 "";
}
}
示例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);
}
}
示例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;
}
示例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;
}
}