ํ์ฌ 512*512 ์ฌ์ด์ฆ์ ์ด๋ฏธ์ง๋ฅผ wpf์ ์๊ฐํํ๋ ค๊ณ ํฉ๋๋ค.
ํด๋น ์ด๋ฏธ์ง๋ gray16์ด๋ผ 512512 2 byte๋ฐฐ์ด์ ๋ด๊ฒจ์์ด์
Image.Source = BitmapSource.Create(rows, columns, 96, 96, PixelFormats.Gray16, null, Pixel[frameIndex], (columns * 16 + 7) / 8);
๋ก๋ ์ถ๋ ฅ์ด ๋์ง ์๋๋ฐ ์ด๋ค ๋ฌธ์ ์ผ๊น์? ๊ตฌ๊ธ์ gray16 ์๊ฐํ ์์ ๊ฐ ์์ด ์ง๋ฌธ๋๋ฆฝ๋๋ค.
๊ฐ์ฌํฉ๋๋ค.
2๊ฐ์ ์ข์์
leechw9
12์ 12, 2023, 10:42์คํ
3
์คํ์ค๋ฒํ๋ก์ฐ ์ฐธ๊ณ ํ์ต๋๋ค.
c#, wpf, .net-4.0
์ฃผ์ ์ฝ๋๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
bitmapSource.WritePixels(new Int32Rect(0, 0, width, height), pixels, width * 2, 0);
์๋๋ ์ ์ฝ๋๋ฅผ ์ฌ์ฉํ์ฌ Gray16 ์ ๋ง๋๋ ์ฝ๋์
๋๋ค.
public static BitmapSource MakeGray16()
{
var width = 256;
var height = 256;
var bitmapSource = new WriteableBitmap(width, height, 96, 96, PixelFormats.Gray16, null);
var pixels = new ushort[width * height];
for (var y = 0; y < height; ++y)
for (var x = 0; x < width; ++x)
{
var v = x * y;
pixels[y * width + x] = (ushort)v;
}
bitmapSource.WritePixels(new Int32Rect(0, 0, width, height), pixels, width * 2, 0);
return bitmapSource;
}
2๊ฐ์ ์ข์์
์ฐ์ ๋ค๋ค ๋ต๋ณ ๊ฐ์ฌํฉ๋๋ค.
์ผ๋จ ํด๋น ๋ฌธ์ ๋ ํด๊ฒฐํ์ต๋๋ค.
์ ๊ฐ ์ฌ์ฉํ๋ ์ด๋ฏธ์ง์์์ด Dicom์ด๋ผ๋ ์๋ฃ์์์ธ๋ฐ ๊ณ ๋ คํด์ผํ ๊ฒ์ด Bitstored์ด
8,12,16 bit์ด ์๊ณ smallest, largest value๊ฐ ์์์ต๋๋ค.
8bit์ ๊ฒฝ์ฐ byte๋ฐฐ์ด์ ๊ทธ๋๋ก ๋ค์ด๊ฐ๊ณ
12,16์ ๊ฒฝ์ฐ byte๋ฐฐ์ด์ ํ์8bit, ์์8bit๋ก ๋๋์ด ๋ค์ด๊ฐ์ต๋๋ค.
๋๋ฌธ์ 12,16์ 0~12,16์ง์์ ์ต๋๊ฐ์ 0~255๋ก ๋ฒ์๋ฅผ ์์ ํ์ฌ ๋ค์ byte๋ฐฐ์ด์ ๋ฃ๊ณ
gray8๋ก ์๊ฐํํ์ต๋๋ค.
๋ํ smallest(๋ณดํต 0 ), largest value๊ฐ tag๋ก ์๋๊ฒฝ์ฐ ํด๋น ๊ฐ์ ๊ธฐ์ค์ผ๋ก 0~255๋ก ์์ ํ์ต๋๋ค.
๋ ์ข์ ๋ฐฉ๋ฒ์ด ์๋ค๋ฉด ์๋ ค์ฃผ์๋ฉด ๊ฐ์ฌํ๊ฒ ์ต๋๋ค.
dicomImage.Source = BitmapSource.Create(columns, rows, 96, 96, PixelFormats.Gray8, null, image[frameIndex], (columns * 8 + 7) / 8);
์ ๋ ํด๋น์ฝ๋๋ก ์๊ฐํํ์ต๋๋ค.
2๊ฐ์ ์ข์์