Parameters
- Frame
- Frame number to extract
- cache
- Cache result for the extracted frame
Return Value
Raw pixel data of the request frame
DicomDataSet ds = new DicomDataSet("Dataset.dcm"); int frame = 10; bool cache = true; var pixelBytes = ds.GetRawFrame(frame, cache); if (pixelBytes != null) { int width = Convert.ToInt32(ds[Keyword.Columns].Value); int height = Convert.ToInt32(ds[Keyword.Rows].Value); using (Bitmap bitmap = new Bitmap(width, height, PixelFormat.Format24bppRgb)) { BitmapData bmpData = bitmap.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, bitmap.PixelFormat); IntPtr ptr = bmpData.Scan0; Marshal.Copy(pixelBytes, 0, ptr, pixelBytes.Length); bitmap.UnlockBits(bmpData); bitmap.Save(frame10.png", ImageFormat.Png); } }