|
|
Comments and Discussions
|
|
 |

|
Hi, its one of the great App, Add print option to it. if u did already please send it to my mail pranee.3@gmail.com
|
|
|
|

|
Hi,
Is there a way to paint certain pixels overlayed on top of the gray scale one?
either paint over or change the hue of a grayscale pixel?
i think its related to these two lines (in mainform.cs -> ReadAndDisplayDicomFile -> , and to pixels16, but i am not sure how to manipulate that variable, help would be highly appreciated.:
if (samplesPerPixel == 1 && bitDepth == 16)
{ ......
.......
imagePanelControl.Signed16Image = dd.signedImage;
imagePanelControl.SetParameters(ref pixels16, imageWidth, imageHeight,
winWidth, winCentre, true, this);
}
|
|
|
|

|
For selectively painting certain pixels, you need to:
- Have a criterion for selecting those "certain pixels" - based on intensity, or something else,
- Modify the variable pixels16 accordingly, just before the lines which you've quoted above. Which means that you should add code just before the line "imagePanelControl.Signed16Image = dd.signedImage" to modify that variable. Bear in mind that pixels16 is a list, and you need to be careful in identifying the right indices of that list for modification.
This should be sufficient, in my opinion. Please let me know if you still run into issues.
|
|
|
|

|
- the selected pixels are already known to me, i just need to color them somehow.
- regarding pixels16, this is what i thought. i am actually trying to color them in white value of ushort.Max
- i understand that pixel16 is a 2D map of 480x480 and not like i would expect a dicom list of slices to be, composed of 80x80 adjacent slices. so if i am working in "Dicom" space, i should some how map each pixel in each slice to the 480x480 2D map, correct?
- is there a way to access the 2D map via the actual Dicom space coordinates?
|
|
|
|

|
pixels16 is not a 2D map of 480 x 480 (not sure where you got those numbers from). It is a 2D map of the actual dimensions of the image.
|
|
|
|

|
you are right, its not like that in the code, its based on my Dicom image. which is 480x480.
how can i convert the grayscale image to a colored one, or paint colored pixels on top? any value in pixels16 will be considered grayscale.
|
|
|
|

|
You cannot do this using pixels16. You need to add a new buffer, and overlay this on top of the image rendered.
Or, you need to create individual pixels, and set their positions on top of the image, using a function like SetPixel (not sure what the exact equivalent is in C#).
Try an experiment like this - outside the DICOM viewer. Write a program to load an image (an ordinary photographic image) onto the screen. Then, again programmatically, try to paint a few pixels at known positions - with some color, say Red. With this, you'll see the original picture, and also selected spots painted as Red. (I presume this is what you want to do with the DICOM images). You need to try out with the Image APIs available within C#. Once this "plain vanilla" application is ready, try to emulate this within the DICOM viewer.
|
|
|
|

|
i actually had another idea, is it possible to convert pixel16 (ushorts) into pixel24 in some way? do you know how exactly?
|
|
|
|

|
Yes - you can.
Take pixels16, and divide each value by 256. This will give you an 8-bit image, call the variable as pixels8. Now, each value within pixels8 represents the image as an 8-bit grayscale value. Replicate each pixel value 2 more times, so that this will give the RGB representation of each pixel. Since we are working with grayscale images, the R, G and B images will all be the same. This RGB representation is the 24-bit representation pixel24 which you need.
|
|
|
|

|
thanks, doesnt sound too difficult. do i need to fill the pixel24 structure in any other way beside pixel values, dimentions etc (in order to push to: imagePanelControl.SetParameters(ref pixels24, imageWidth, imageHeight, winWidth, winCentre, samplesPerPixel, true, this); ) ?
if yes, is there an easy way to do it?
|
|
|
|

|
We use pixels24 currently to display 24-bit RGB ultrasound images. Look at the way the pixels24 is being used on line 182 of the file MainForm.cs. This should help.
If you can find any ultrasound RGB DICOM image (with the Transfer Syntaxes we allow), you'll be able to debug through the code, and see what exactly is done.
|
|
|
|

|
Hi,
this is my code, am i doing something wrong with the division? dividing by 256 will create values between 0-5 as my raw voxel data never goes higher than ~1000
pixels16.Clear();
pixels8.Clear();
pixels24.Clear();
dd.GetPixels16(ref pixels16);
byte cellValue;
for (int i=0; i < pixels16.Count;i++)
{
cellValue = Convert.ToByte(pixels16[i] / 256);
pixels24.Add(cellValue);
pixels24.Add(cellValue);
pixels24.Add(cellValue);
}
imagePanelControl.SetParameters(ref pixels24, imageWidth, imageHeight,
winWidth, winCentre, 3, true, this);
however, a division by 8 helps to see some kind of image, but its way too dark, i have also experimented with lower values (6,4,2) but the maximum value that byte accepts is significanly lower than the outcome of any of these divisions. so bottom line only 8 works.
any ideas how to lit the image, pixel wise?
modified 14 Nov '12 - 1:31.
|
|
|
|

|
i think i figured it out, i had to divide winWidth and winCentreby 8 as well
imagePanelControl.SetParameters(ref pixels24, imageWidth, imageHeight,
winWidth /8, winCentre/8, 3, true, this);
sounds like what you would do?
|
|
|
|

|
Yes - the Window Centre and Window Width are especially meant for contrast-stretching. By doing this division by 8, are you getting a reasonable image to see?
With the division by 256 also (and similarly dividing the window centre and width by 256), you should be able to see a similar image.
On a side note, were you able to color those 'certain pixels' differently - so as to be able to discern them?
|
|
|
|

|
yes a very good image. i can try the 256 but the 8 is realy good.
yes i was able to color them. do you want me to post the entire code?
|
|
|
|

|
Great that you could get a very good image. Try with other images, and see whether the image quality is retained - maybe you need a few tweaks to make it work for other images.
You may post the code, but please do consult the Intellectual Property Department at your current company / university before posting.
|
|
|
|

|
i tried 256 but it seems that using a divider that better fits the range of a byte to the maximum value of a voxel, is better.
basically because 1000 is the max brain voxel value, dividing by 256 will give a range of 4 values. just 4 colors!.
if we use 8 we get a much better range of gray scale colors.
|
|
|
|

|
Instead of dividing by 8-or-some-other-number, can you adjust the window/level. For example, set the window centre as 500, and window width as 1000 - this will make the window min as 0, and window max as 1000, effectively stretching the grayscale to the maximum extent possible.
|
|
|
|

|
without dividing, how will you get from int16(pixel16: 0-65k) to byte (pixel24 = 3*8, 0-255)?
|
|
|
|

|
By using Contrast Stretch. For example, if you have an 8-bit image with pixel values from 10 to 20, it will appear predominantly dark. Now, using Contrast Stretch, you can make the 10 map to 0, and 20 map to 255, which will make uniformly lit up over the range 0-255. Please take a look at our article on Linear Contrast Stretch of Grayscale Images[^]
|
|
|
|

|
yes i understand, its good if you have a nice range of many values. but after a division by 256 i will only have 4 or 5 values for pixels, (0,1,2,3,4). as far as i understand stretching these over a larger range will not do anything since only 5 values exist in total. makes sense?
|
|
|
|

|
Yes, makes sense.
A basic question on how your images are acquired. Is it not possible to set a higher dynamic range in your imaging system? Because, if you have only four or five values for the pixels, the images may appear to have a quantized look.
|
|
|
|

|
our original range is roughly between 0 and 1000. what i meant was that if i divide by 256 first, i would get a range of 0 to 4. this range cant be manipulated using the center and width trick, as far as i understand. makes sense now?
|
|
|
|

|
hi,
thanks to authors,
can you give me some advise to decoding image sequences?
|
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
A simple viewer of images stored in the DICOM 3.0 File Format (C#). The file should have raw pixel data, uncompressed. Window Level functionality is also provided.
| Type | Article |
| Licence | CPOL |
| First Posted | 29 Apr 2009 |
| Views | 330,016 |
| Downloads | 14,627 |
| Bookmarked | 114 times |
|
|