Lookuptable

66 views
Skip to first unread message

Padraig Looney

unread,
Jun 16, 2013, 3:13:45 PM6/16/13
to
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

Padraig Looney

unread,
Jun 16, 2013, 3:17:14 PM6/16/13
to dcm...@googlegroups.com
I've managed to find a solution to this. I went back to the source code of DicomImageReader in dcm4che3.2.1 that is applying the 8bit lookup correctly and used the same methods to get a 16 bit image.
Reply all
Reply to author
Forward
0 new messages