Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在UIImageView中显示12位和16位(Dicom)图像_C#_Ios_Ipad_Xamarin.ios_Monodevelop - Fatal编程技术网

C# 如何在UIImageView中显示12位和16位(Dicom)图像

C# 如何在UIImageView中显示12位和16位(Dicom)图像,c#,ios,ipad,xamarin.ios,monodevelop,C#,Ios,Ipad,Xamarin.ios,Monodevelop,只是我不想在UIImageView中显示12位或16位的图像,但图像显示不正确,所以请建议我一些解决方案,我从几天以来一直在努力显示这些图像 欲了解更多信息,请检查此代码和图像。代码复制如下: const int bytesPerPixel = 4; int _width = (int)_drawArg.RectUIImageMatrix.Width; int _height = (int)_drawArg.RectUIImageMatrix.Height; CGImage _bitmap

只是我不想在UIImageView中显示12位或16位的图像,但图像显示不正确,所以请建议我一些解决方案,我从几天以来一直在努力显示这些图像

欲了解更多信息,请检查此代码和图像。代码复制如下:

const int bytesPerPixel = 4; 
int _width = (int)_drawArg.RectUIImageMatrix.Width; 
int _height = (int)_drawArg.RectUIImageMatrix.Height; 
CGImage _bitmap ; 

Rectangle srcRectangle = new Rectangle(0, 0, imageGraphic.Columns, imageGraphic.Rows); 
Rectangle rect = Rectangle.Round(new RectangleF(0,0,_width , _height)); 
Rectangle dstRectangle = rect; 

int[] srcPixels = new int[image.Columns * image.Rows * image.PixelData.BytesPerPixel]; 

int bitsPerComponent = 8; 
int bytesPerRow = srcRectangle.Width * bytesPerPixel  *2; 
var  pixelBytes = imageGraphic.PixelData.Raw; 
CGColorSpace _color = CGColorSpace.CreateDeviceRGB(); 
CGDataProvider _provide = new CGDataProvider(pixelBytes , 0,pixelBytes.Length); 

_bitmap = new CGImage(srcRectangle.Width,srcRectangle.Height ,bitsPerComponent,32,bytesPerRow , _color , CGBitmapFlags.ByteOrder16Big | CGBitmapFlags.PremultipliedLast ,_provide ,null ,true ,CGColorRenderingIntent.Default); 

ImgView.Image = UIImage.FromImage(_bitmap); 
那里


THNKS在ADVC/

帮助,这个代码是什么,C++?很高兴知道。此外,您没有向我们提供有关“图像”及其属性的信息。如果不知道源代码的格式是什么,就根本无法帮助您。您正在告诉CGImageRef,以像素字节为单位的数据是32位、大端和最后一个字母。不知何故,我不认为这是尝试。从你发布的链接来看,你遇到的问题似乎是,分辨率是错误的-图像似乎比它应该的更宽-这是正确的吗?新CGImage的参数来自哪里?你试过重新计算图像的宽度吗?另外,试着用谷歌搜索“convert DICOM to UIImage”——你会在这个网站上获得很多点击率。这是一个有很多变化的困难任务-祝你好运。是的,Gambrinus图像大小比UIImageView大得多,例如图像宽度=2500,高度=2048,UIImageView高度=759,宽度=748。还有一件事我必须问参数,我传递给CGImage的高度和宽度应该是图像的高度和宽度或宽度UIImageView高度和宽度