Dear all,
I have been building an application using dcm4che 2.0.26. To display images I have been using the following code to get a 16bit image
private Raster readRaster(final int sliceNo) throws IOException{
final DicomImageReader reader = this.createReader();
final ImageReadParam param = reader.getDefaultReadParam();
final Raster raster = reader.readRaster(sliceNo, param);
this.lut.lookup(raster, raster);
return raster;
}
From what I understand this does no apply the lookuptable so I have applied this manually on the fourth line above. To calculate the LUT I used
private LookupTable readVOILUT(final DicomObject dicomObject){
final int nbits = dicomObject.getInt(Tag.BitsStored);
return LookupTable.createLutForImage(dicomObject, nbits, null);
}
Finally I apply the colormodel (Calcuated previously) to get the BufferedImage
private BufferedImage readUnscaledImage(final Raster raster){
final WritableRaster writableRaster = raster.createCompatibleWritableRaster();
final BufferedImage dimg = new BufferedImage(
this.cm,writableRaster,true,null);
dimg.setData(raster);
return dimg;
}
My problem is that the image does not look as it is displayed on a clinical display. I can get an 8bit version that looks like it should be displayed on a clinical display using
private BufferedImage readUscaledBuff() {
DicomImageReader reader;
try {
reader = this.createReader();
return reader.read(0);
} catch (final IOException e) {
e.printStackTrace();
}
return null;
}
Could anyone show me where I am going wrong above?
Many thanks