The dicom bufferedImage from pixelmed is having low contrast

I would like to display a DICOM image in my java program. I am using pixelmed. However, I found that i cant correctly display the correct contrast. The contrast is too low.

Here is my code:

(SourceImage is a class provided by PixelMed, chosenImageFile.getPath() is just the path of the DICOM File.)

SourceImage dimg = new SourceImage(chosenImageFile.getPath());
BufferedImage image = dimg.getBufferedImage();

BufferedImage source = new BufferedImage(image.getWidth(), image.getHeight(),    BufferedImage.TYPE_INT_RGB);

Graphics2D g2d = source.createGraphics();
g2d.drawImage(image, 0, 0, null);
dicomImgDisplayer1.setImage(source);

dicomImgDisplayer1 is an class extend JPanel. setImage() of this JPanel class will call the setImage() of an JFrame class.

The JFrame class's setImage() code:

public void setImage(BufferedImage image) {
   this.image = image;
   setPreferredSize(new Dimension(image.getWidth(), image.getHeight()));
   repaint();
   revalidate();
}

public void paint(Graphics graphics) {
   Graphics2D g2d = (Graphics2D) graphics;
   g2d.drawImage(image, null, 0, 0);
}

Is that something wrong with the color model? Please help. Thanks.

Answers


Does your image have a prescribed window width / window center? Be sure you set that (or allow the user to adjust it). See SingleImagePanel - there are some static methods to apply windowing to your buffered image.


Need Your Help

insert jquery variable into php using ajax?

javascript php jquery mysql ajax

I perform a mysql query SELECT * FROM table WHERE mp3link = '$songname' I want the variable $songname to = a jquery variable named 'key' which changes depending on the song playing. So far everything