本文整理汇总了C#中ClearCanvas.ImageViewer.StudyManagement.Frame类的典型用法代码示例。如果您正苦于以下问题:C# Frame类的具体用法?C# Frame怎么用?C# Frame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Frame类属于ClearCanvas.ImageViewer.StudyManagement命名空间,在下文中一共展示了Frame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RetrieveFrame
public void RetrieveFrame(Frame frame)
{
Interlocked.Increment(ref _activeRetrieveThreads);
try
{
string message = String.Format("Retrieving Frame (active threads: {0})", Thread.VolatileRead(ref _activeRetrieveThreads));
Trace.WriteLine(message);
IStreamingSopDataSource dataSource = (IStreamingSopDataSource) frame.ParentImageSop.DataSource;
IStreamingSopFrameData frameData = dataSource.GetFrameData(frame.FrameNumber);
frameData.RetrievePixelData();
}
catch (OutOfMemoryException)
{
Platform.Log(LogLevel.Error, "Out of memory trying to retrieve pixel data.");
}
catch (Exception e)
{
Platform.Log(LogLevel.Error, e, "Error retrieving frame pixel data.");
}
finally
{
Interlocked.Decrement(ref _activeRetrieveThreads);
}
}
示例2: ImagePlaneHelper
/// <summary>
/// Constructor (for use by <see cref="Frame"/> class only).
/// </summary>
internal ImagePlaneHelper(Frame frame)
: this(frame.ImagePositionPatient, frame.ImageOrientationPatient, frame.PixelSpacing, frame.Rows, frame.Columns)
{
// this constructor is internal because it keeps references to the source frame's position, orientation and spacing properties
// if the frame is changed or disposed, the calculations made by this instance would be affected
// thus, only the Frame class should use this constructor, since it will thus have the same lifetime as the referenced objects
// if you need to create an instance separated from a frame, use the other constructor with appropriate clones of the position, orientation and spacing
}
示例3: CanDecompressFrame
public bool CanDecompressFrame(Frame frame)
{
if (!(frame.ParentImageSop.DataSource is StreamingSopDataSource))
return false;
StreamingSopDataSource dataSource = (StreamingSopDataSource) frame.ParentImageSop.DataSource;
IStreamingSopFrameData frameData = dataSource.GetFrameData(frame.FrameNumber);
return frameData.PixelDataRetrieved;
}
示例4: CanDecompressFrame
public bool CanDecompressFrame(Frame frame)
{
var streamingFrame = frame.ParentImageSop.DataSource as StreamingSopDataSource;
if (streamingFrame == null)
return false;
var frameData = streamingFrame.GetFrameData(frame.FrameNumber);
return frameData.PixelDataRetrieved;
}
示例5: GetCompareValues
private static IEnumerable<IComparable> GetCompareValues(Frame frame)
{
//Group be common study level attributes
yield return frame.StudyInstanceUid;
//Group by common series level attributes
//This sorts "FOR PRESENTATION" images to the beginning (except in reverse, of course).
yield return frame.ParentImageSop.PresentationIntentType == "FOR PRESENTATION" ? 0 : 1;
yield return frame.ParentImageSop.SeriesNumber;
yield return frame.ParentImageSop.SeriesDescription;
yield return frame.SeriesInstanceUid;
yield return frame.FrameOfReferenceUid;
double? normalX = null, normalY = null, normalZ = null;
double? zImagePlane = null;
Vector3D normal = frame.ImagePlaneHelper.GetNormalVector();
if (normal != null)
{
// Return the 3 components of the image normal; if they are all equal
// then the images are in the same plane. We are disregarding
// the rare case where the 2 normals being compared are the negative
// of each other - technically, they could be considered to be in the
// same 'plane', but for the purposes of sorting, we won't consider it.
normalX = Math.Round(normal.X, 3, MidpointRounding.AwayFromZero);
normalY = Math.Round(normal.Y, 3, MidpointRounding.AwayFromZero);
normalZ = Math.Round(normal.Z, 3, MidpointRounding.AwayFromZero);
Vector3D positionPatient = frame.ImagePlaneHelper.ConvertToPatient(new PointF((frame.Columns - 1) / 2F, (frame.Rows - 1) / 2F));
if (positionPatient != null)
{
Vector3D positionImagePlane = frame.ImagePlaneHelper.ConvertToImagePlane(positionPatient, Vector3D.Null);
//return only the z-component of the image plane position (where the origin remains at the patient origin).
zImagePlane = Math.Round(positionImagePlane.Z, 3, MidpointRounding.AwayFromZero);
}
}
yield return normalX;
yield return normalY;
yield return normalZ;
yield return zImagePlane;
//as a last resort.
yield return frame.ParentImageSop.InstanceNumber;
yield return frame.FrameNumber;
yield return frame.AcquisitionNumber;
}
示例6: GetCompareValues
private static IEnumerable<IComparable> GetCompareValues(Frame frame)
{//Group be common study level attributes
yield return frame.StudyInstanceUid;
//Group by common series level attributes
//This sorts "FOR PRESENTATION" images to the beginning (except in reverse, of course).
yield return frame.ParentImageSop.PresentationIntentType == "FOR PRESENTATION" ? 0 : 1;
yield return frame.ParentImageSop.SeriesNumber;
yield return frame.ParentImageSop.SeriesDescription;
yield return frame.SeriesInstanceUid;
yield return frame.ParentImageSop.InstanceNumber;
yield return frame.FrameNumber;
//as a last resort.
yield return frame.AcquisitionNumber;
}
示例7: DecompressFrame
public void DecompressFrame(Frame frame)
{
try
{
//TODO: try to trigger header retrieval for data luts?
frame.GetNormalizedPixelData();
}
catch (OutOfMemoryException)
{
Platform.Log(LogLevel.Error, "Out of memory trying to decompress pixel data.");
}
catch (Exception e)
{
Platform.Log(LogLevel.Error, e, "Error decompressing frame pixel data.");
}
}
示例8: MockDicomPresentationImage
public MockDicomPresentationImage(string filename) : base(new GrayscaleImageGraphic(10, 10))
{
if (Path.IsPathRooted(filename))
_filename = filename;
else
_filename = Path.Combine(Environment.CurrentDirectory, filename);
_dicomFile = new DicomFile();
_dicomFile.DataSet[DicomTags.SopClassUid].SetStringValue(SopClass.SecondaryCaptureImageStorageUid);
_dicomFile.DataSet[DicomTags.SopInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
_dicomFile.MetaInfo[DicomTags.MediaStorageSopClassUid].SetStringValue(_dicomFile.DataSet[DicomTags.SopClassUid].ToString());
_dicomFile.MetaInfo[DicomTags.MediaStorageSopInstanceUid].SetStringValue(_dicomFile.DataSet[DicomTags.SopInstanceUid].ToString());
_dicomFile.Save(_filename);
_sopDataSource = new LocalSopDataSource(_dicomFile);
_imageSop = new ImageSop(_sopDataSource);
_frame = new MockFrame(_imageSop, 1);
}
示例9: RetrieveFrame
public void RetrieveFrame(Frame frame)
{
try
{
var dataSource = (IStreamingSopDataSource) frame.ParentImageSop.DataSource;
var frameData = dataSource.GetFrameData(frame.FrameNumber);
frameData.RetrievePixelData();
}
catch (OutOfMemoryException)
{
Platform.Log(LogLevel.Error, "Out of memory trying to retrieve pixel data.");
}
catch (Exception e)
{
Platform.Log(LogLevel.Error, e, "Error retrieving frame pixel data.");
}
}
示例10: CreateImage
protected override IPresentationImage CreateImage(Frame frame)
{
if (frame.PhotometricInterpretation == PhotometricInterpretation.Unknown)
throw new Exception("Photometric interpretation is unknown.");
IDicomPresentationImage image;
// TODO (CR Apr 2013): Since it's the "async" factory, it probably should only deal in AsyncFrames. Just throw NotSupportedException?
if (!frame.PhotometricInterpretation.IsColor)
image = frame is AsyncFrame ? new AsyncDicomGrayscalePresentationImage((AsyncFrame) frame) : new DicomGrayscalePresentationImage(frame);
else
image = new DicomColorPresentationImage(frame);
if (image.PresentationState == null || Equals(image.PresentationState, PresentationState.DicomDefault))
image.PresentationState = DefaultPresentationState;
return image;
}
示例11: GetCompareValues
private static IEnumerable<IComparable> GetCompareValues(Frame frame)
{
//Group be common study level attributes
yield return frame.StudyInstanceUid;
//Group by common series level attributes
//This sorts "FOR PRESENTATION" images to the beginning (except in reverse, of course).
yield return frame.ParentImageSop.PresentationIntentType == "FOR PRESENTATION" ? 0 : 1;
yield return frame.ParentImageSop.SeriesNumber;
yield return frame.ParentImageSop.SeriesDescription;
yield return frame.SeriesInstanceUid;
DateTime? datePart = null;
TimeSpan? timePart = null;
//then sort by acquisition datetime.
DateTime? acquisitionDateTime = DateTimeParser.Parse(frame.AcquisitionDateTime);
if (acquisitionDateTime != null)
{
datePart = acquisitionDateTime.Value.Date;
timePart = acquisitionDateTime.Value.TimeOfDay;
}
else
{
datePart = DateParser.Parse(frame.AcquisitionDate);
if (datePart != null)
{
//only set the time part if there is a valid date part.
DateTime? acquisitionTime = TimeParser.Parse(frame.AcquisitionTime);
if (acquisitionTime != null)
timePart = acquisitionTime.Value.TimeOfDay;
}
}
yield return datePart;
yield return timePart;
//as a last resort.
yield return frame.ParentImageSop.InstanceNumber;
yield return frame.FrameNumber;
yield return frame.AcquisitionNumber;
}
示例12: CreateT2Image
private static DynamicTePresentationImage CreateT2Image(ImageSop imageSop, Frame frame)
{
DicomFile pdMap = FindMap(imageSop.StudyInstanceUID, frame.SliceLocation, "PD");
pdMap.Load(DicomReadOptions.Default);
DicomFile t2Map = FindMap(imageSop.StudyInstanceUID, frame.SliceLocation, "T2");
t2Map.Load(DicomReadOptions.Default);
DicomFile probMap = FindMap(imageSop.StudyInstanceUID, frame.SliceLocation, "CHI2PROB");
probMap.Load(DicomReadOptions.Default);
DynamicTePresentationImage t2Image = new DynamicTePresentationImage(
frame,
(byte[])pdMap.DataSet[DicomTags.PixelData].Values,
(byte[])t2Map.DataSet[DicomTags.PixelData].Values,
(byte[])probMap.DataSet[DicomTags.PixelData].Values);
t2Image.DynamicTe.Te = 50.0f;
return t2Image;
}
示例13: RetrieveFrame
private void RetrieveFrame(Frame frame)
{
if (_stopAllActivity)
{
return;
}
try
{
//just return if the available memory is getting low - only retrieve and decompress on-demand now.
if (SystemResources.GetAvailableMemory(SizeUnits.Megabytes) < Prefetch.Default.AvailableMemoryLimitMegabytes)
{
return;
}
Interlocked.Increment(ref _activeRetrieveThreads);
//TODO (CR May 2010): do we need to do this all the time?
string message = String.Format("Retrieving Frame (active threads: {0})", Thread.VolatileRead(ref _activeRetrieveThreads));
Trace.WriteLine(message);
Console.WriteLine(message);
//TODO: try to trigger header retrieval for data luts?
frame.GetNormalizedPixelData();
}
catch(OutOfMemoryException)
{
_stopAllActivity = true;
Platform.Log(LogLevel.Error, "Out of memory trying to retrieve pixel data. Prefetching will not resume unless memory becomes available.");
}
catch (Exception e)
{
Platform.Log(LogLevel.Error, e, "Error retrieving frame pixel data.");
}
finally
{
Interlocked.Decrement(ref _activeRetrieveThreads);
}
}
示例14: SingleFrameDisplaySetDescriptor
public SingleFrameDisplaySetDescriptor(ISeriesIdentifier sourceSeries, Frame frame, int position)
: base(sourceSeries)
{
Platform.CheckForNullReference(sourceSeries, "sourceSeries");
Platform.CheckForNullReference(frame, "frame");
_seriesInstanceUid = frame.SeriesInstanceUid;
_sopInstanceUid = frame.SopInstanceUid;
_frameNumber = frame.FrameNumber;
_position = position;
if (sourceSeries.SeriesInstanceUid == frame.SeriesInstanceUid)
{
_suffix = String.Format(SR.SuffixFormatSingleFrameDisplaySet, frame.ParentImageSop.InstanceNumber, _frameNumber);
}
else
{
//this is a referenced frame (e.g. key iamge).
_suffix = String.Format(SR.SuffixFormatSingleReferencedFrameDisplaySet,
frame.ParentImageSop.SeriesNumber, frame.ParentImageSop.InstanceNumber, _frameNumber);
}
}
示例15: DynamicTePresentationImage
public DynamicTePresentationImage(
Frame frame,
byte[] protonDensityMap,
byte[] t2Map,
byte[] probabilityMap)
: base(frame)
{
Platform.CheckForNullReference(frame, "imageSop");
_frame = frame;
// TODO (Norman): DicomFilteredAnnotationLayoutProvider was made internal. Either need to derive
// this class from DicomGrayscalePresentationImage or create a layout provider.
//this.AnnotationLayoutProvider = new DicomFilteredAnnotationLayoutProvider(this);
AddProbabilityOverlay();
_dynamicTe = new DynamicTe(
this.ImageGraphic as GrayscaleImageGraphic,
protonDensityMap,
t2Map,
_probabilityOverlay,
probabilityMap);
}