private unsafe static void CopyFromSigned16(ImageGraphic image, itkImageBase itkImage) { fixed(byte *pDstByte = image.PixelData.Raw) { itkImageRegionConstIterator_ISS2 itkIt = new itkImageRegionConstIterator_ISS2(itkImage, itkImage.LargestPossibleRegion); short *pDst = (short *)pDstByte; int height = image.Rows; int width = image.Columns; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { pDst[0] = itkIt.Get().ValueAsSS; pDst++; itkIt++; } } } }
private unsafe static void CopyFromUnsigned16(ImageGraphic image, itkImageBase itkImage) { fixed (byte* pDstByte = image.PixelData.Raw) { itkImageRegionConstIterator_ISS2 itkIt = new itkImageRegionConstIterator_ISS2(itkImage, itkImage.LargestPossibleRegion); ushort* pDst = (ushort*)pDstByte; int height = image.Rows; int width = image.Columns; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { int sl = itkIt.Get().ValueAsSL; pDst[0] = (ushort) sl;// itkIt.Get().ValueAsUS; pDst++; itkIt++; } } } }