我的应用程序是asp.net MVC3;目前我可以使用图像处理程序显示DCIOM MPR图像,并使用以下方法将图像存储在会话中:
objImage = im.Bitmap(outputSize, System.Drawing.Imaging.PixelFormat.Format24bppRgb, m);
context.Response.ContentType = "image/png";
objImage.Save(context.Response.OutputStream,
System.Drawing.Imaging.ImageFormat.Png);它工作得很好,但是当我旋转图像时,响应非常慢!我尝试使用以下命令将DICOM MPR作为会话变量存储在控制器中:
............
DicomImageMPR mpr1 = new DicomImageMPR(volume);
mpr1.SetViewPlane(new Point3D(), new Vector3D(0, 1, 0), new Vector3D(0, 0, -1));
mpr1.Interpolation = InterpolationType3D.Trilinear;
MySession.Current.mpr1 = mpr1;我的问题是,如何将图像放在视图包中,以便在视图中显示?我将非常感谢您的建议,并提前感谢您。
发布于 2013-04-17 01:34:43
我用下面的方法解决了这个问题:
public ActionResult GenerateImage()
{
FileContentResult result;
System.Drawing.Image objImage = null;
....
mpr = MySession.Current.mpr2;
im = mpr;
...
objImage = im.Bitmap(outputSize,
System.Drawing.Imaging.PixelFormat.Format24bppRgb, m);
using (var memStream = new MemoryStream())
{
objImage.Save(memStream, System.Drawing.Imaging.ImageFormat.Png);
result = this.File(memStream.GetBuffer(), "image/png");
}
return result;
}在视图中:
<img src='<%=Url.Action("GenerateImage")%>' alt="" id="dImage"/>希望这能帮助到一些人。
https://stackoverflow.com/questions/16030438
复制相似问题