シーメンスのCTなど。
画像データに傾斜と切片を付加して8bitグレースケールを得る。
- fixed (byte* pData = pixelData)
- {
- int pixel;
- short* ptr = (short*)pData; //short型ポインタ
- byte* pBitmap = (byte*)bitmapData.Scan0;
- int j = 0, i = 0;
- int difference = max - min;
- if (rescaleIntercept == 0.0d )
- {
- for (int x = 0; x < _columns; x++)
- {
- pixel = (int)(((*ptr + rescaleIntercept - windowCenter) / windowWidth + 0.5d) * 255.0d);
- if (pixel > 255) pixel = 255;
- else if (pixel < 0) pixel = 0;
- *pBitmap = (byte)pixel; ptr++; pBitmap++;
- }
- pBitmap += padding;
- }
- else
- {
- for (int y = 0; y < _rows; y++)
- {
- j = y * _columns;
- for (int x = 0; x < _columns; x++)
- {
- pixel = (int)((((int)ptr[j + x] + rescaleIntercept - windowCenter) / windowWidth + 0.5d) * 255.0d);
- if (pixel > 255) pixel = 255;
- if (pixel < 0) pixel = 0;
- pixel = (int)(rescaleSlope * pixel + rescaleIntercept);
- pBitmap[i] = (byte)pixel;
- i++;
- }
- i += padding;
- }
- }
- }
0 件のコメント :
コメントを投稿