本文整理汇总了C#中ClearCanvas.ImageViewer.StudyManagement.Frame.GetNormalizedPixelData方法的典型用法代码示例。如果您正苦于以下问题:C# Frame.GetNormalizedPixelData方法的具体用法?C# Frame.GetNormalizedPixelData怎么用?C# Frame.GetNormalizedPixelData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClearCanvas.ImageViewer.StudyManagement.Frame
的用法示例。
在下文中一共展示了Frame.GetNormalizedPixelData方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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.");
}
}
示例2: DecompressFrame
public void DecompressFrame(Frame frame)
{
Interlocked.Increment(ref _activeDecompressThreads);
try
{
string message = String.Format("Decompressing Frame (active threads: {0})", Thread.VolatileRead(ref _activeDecompressThreads));
Trace.WriteLine(message);
//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.");
}
finally
{
Interlocked.Decrement(ref _activeDecompressThreads);
}
}
示例3: FillVolumeFrame
private static void FillVolumeFrame(ushort[] volumeData, int position, int paddedColumns, Frame sourceFrame, ushort pixelPadValue, double normalizedSlope, double normalizedIntercept, int paddingRowsTop, int paddingRowsBottom, LutFactory lutFactory, out int frameMinPixelValue, out int frameMaxPixelValue)
{
if (paddingRowsTop > 0) // pad rows at the top if required
{
var count = paddingRowsTop*paddedColumns;
FillVolumeData(volumeData, pixelPadValue, position, count);
position += count; // update position so frame is copied after the top padding
}
// Copy frame data
var frameData = sourceFrame.GetNormalizedPixelData();
var frameBitsStored = sourceFrame.BitsStored;
var frameBytesPerPixel = sourceFrame.BitsAllocated/8;
var frameIsSigned = sourceFrame.PixelRepresentation != 0;
var frameModalityLut = lutFactory.GetModalityLutLinear(frameBitsStored, frameIsSigned, sourceFrame.RescaleSlope, sourceFrame.RescaleIntercept);
CopyFrameData(frameData, frameBytesPerPixel, frameIsSigned, frameModalityLut, volumeData, position, normalizedSlope, normalizedIntercept, out frameMinPixelValue, out frameMaxPixelValue);
if (paddingRowsBottom > 0) // pad rows at the bottom if required
{
position += frameData.Length/frameBytesPerPixel; // update position so bottom padding is copied after the frame data
var count = paddingRowsBottom*paddedColumns;
FillVolumeData(volumeData, pixelPadValue, position, count);
}
}
示例4: 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);
}
}
示例5: RetrieveFrame
public void RetrieveFrame(Frame frame)
{
frame.GetNormalizedPixelData();
}
示例6: CreateImagePixelModuleColor
private static unsafe void CreateImagePixelModuleColor(IDicomAttributeProvider target, Frame sourceFrame)
{
target[DicomTags.SamplesPerPixel].SetInt32(0, 3);
target[DicomTags.PhotometricInterpretation].SetStringValue(PhotometricInterpretation.Rgb.Code);
target[DicomTags.Rows].SetInt32(0, sourceFrame.Rows);
target[DicomTags.Columns].SetInt32(0, sourceFrame.Columns);
target[DicomTags.BitsAllocated].SetInt32(0, 8);
target[DicomTags.BitsStored].SetInt32(0, 8);
target[DicomTags.HighBit].SetInt32(0, 7);
target[DicomTags.PixelRepresentation].SetInt32(0, 0);
target[DicomTags.PlanarConfiguration].SetInt32(0, 0);
target[DicomTags.PixelAspectRatio].SetStringValue(GetPixelAspectRatioString(sourceFrame));
var pixelDataAttribute = (DicomAttributeBinary) target[DicomTags.PixelData];
using (var stream = pixelDataAttribute.AsStream())
{
stream.Seek(0, SeekOrigin.Begin);
var pixelData = sourceFrame.GetNormalizedPixelData();
var pixelCount = pixelData.Length/4;
var rgbLength = pixelCount*3;
fixed (byte* pPixelData = pixelData)
{
var pValue = (int*) pPixelData;
for (var n = 0; n < pixelCount; ++n)
{
var value = *pValue++; // endianess concerns (i.e. ARGB vs BGRA) eliminated by reading as int
stream.WriteByte((byte) (value >> 16)); // R
stream.WriteByte((byte) (value >> 8)); // G
stream.WriteByte((byte) (value)); // B
}
}
if (rgbLength%2 != 0)
{
++rgbLength;
stream.WriteByte(0);
}
stream.SetLength(rgbLength);
}
}
示例7: CreateImagePixelModuleGrayscale
private static void CreateImagePixelModuleGrayscale(IDicomAttributeProvider target, Frame sourceFrame)
{
target[DicomTags.SamplesPerPixel].SetInt32(0, 1);
target[DicomTags.PhotometricInterpretation].SetStringValue(sourceFrame.PhotometricInterpretation.Code);
target[DicomTags.Rows].SetInt32(0, sourceFrame.Rows);
target[DicomTags.Columns].SetInt32(0, sourceFrame.Columns);
target[DicomTags.BitsAllocated].SetInt32(0, sourceFrame.BitsAllocated);
target[DicomTags.BitsStored].SetInt32(0, sourceFrame.BitsStored);
target[DicomTags.HighBit].SetInt32(0, sourceFrame.BitsStored - 1);
target[DicomTags.PixelRepresentation].SetInt32(0, sourceFrame.PixelRepresentation);
target[DicomTags.PlanarConfiguration].SetInt32(0, 0);
target[DicomTags.PixelAspectRatio].SetStringValue(GetPixelAspectRatioString(sourceFrame));
var pixelDataAttribute = (DicomAttributeBinary) target[DicomTags.PixelData];
using (var stream = pixelDataAttribute.AsStream())
{
stream.Seek(0, SeekOrigin.Begin);
var pixelData = sourceFrame.GetNormalizedPixelData();
var length = pixelData.Length;
stream.Write(pixelData, 0, length);
if (length%2 != 0)
{
++length;
stream.WriteByte(0);
}
stream.SetLength(length);
}
}