繁体   English   中英

在ASP.NET MVC视图中显示DICOM MPR图像C#

[英]Displaying DICOM MPR image in asp.net MVC view c#

我的应用程序是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作为会话变量存储在controlloer中:

............
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;

我的问题是如何将图像放入视图包中以在视图中显示? 非常感谢您的建议,并在此先感谢。

我通过使用以下方法解决了它:

       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"/>

希望这可以帮助某人。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM