org.dcm4che2.image
Class LookupTable

java.lang.Object
  extended by org.dcm4che2.image.LookupTable
Direct Known Subclasses:
ByteLookupTable, ShortLookupTable

public abstract class LookupTable
extends java.lang.Object

Since:
Jul 23, 2007
Version:
$Revision$ $Date$
Author:
Gunter Zeilinger

Field Summary
protected  int andmask
           
protected  int inBits
           
static java.lang.String LINEAR
           
protected  int off
           
protected  int ormask
           
protected  int outBits
           
protected  boolean preserve
           
static java.lang.String SIGMOID
           
protected  int signbit
           
 
Constructor Summary
protected LookupTable(int inBits, boolean signed, int off, int outBits, boolean preserve)
           
 
Method Summary
protected abstract  LookupTable combine(LookupTable other, int outBits, boolean inverse, short[] pval2out)
           
protected abstract  LookupTable combine(LookupTable vlut, LookupTable plut, int outBits, boolean inverse, short[] pval2out)
           
static LookupTable createLut(int inBits, boolean signed, int outBits, DicomObject mLut, DicomObject voiLut, boolean inverse, short[] pval2out, java.lang.Integer pixelPaddingValue, java.lang.Integer pixelPaddingRange)
          Create LUT for given i/o range, non-linear Modality LUT and non-linear VOI LUT.
static LookupTable createLut(int inBits, boolean signed, int outBits, DicomObject mLut, DicomObject voiLut, DicomObject pLut, boolean inverse, short[] pval2out, java.lang.Integer pixelPaddingValue, java.lang.Integer pixelPaddingRange)
          Create LUT for given i/o range, non-linear Modality LUT, non-linear VOI LUT and non-linear Presentation LUT.
static LookupTable createLut(int inBits, boolean signed, int outBits, DicomObject mLut, float center, float width, java.lang.String vlutFct, boolean inverse, short[] pval2out, java.lang.Integer pixelPaddingValue, java.lang.Integer pixelPaddingRange)
          Create LUT for given i/o range, non-linear Modality LUT and Window Center/Width.
static LookupTable createLut(int inBits, boolean signed, int outBits, DicomObject mLut, float center, float width, java.lang.String vlutFct, DicomObject pLut, boolean inverse, short[] pval2out, java.lang.Integer pixelPaddingValue, java.lang.Integer pixelPaddingRange)
          Create LUT for given i/o range, non-linear Modality LUT, Window Center/Width and non-linear Presentation LUT.
static LookupTable createLut(int inBits, boolean signed, int outBits, float slope, float intercept, DicomObject voiLut, boolean inverse, short[] pval2out, java.lang.Integer pixelPaddingValue, java.lang.Integer pixelPaddingRange)
          Create LUT for given i/o range, Rescale Slope/Intercept and non-linear VOI LUT.
static LookupTable createLut(int inBits, boolean signed, int outBits, float slope, float intercept, DicomObject voiLut, DicomObject pLut, boolean inverse, short[] pval2out, java.lang.Integer pixelPaddingValue, java.lang.Integer pixelPaddingRange)
          Create LUT for given i/o range, Rescale Slope/Intercept, non-linear VOI LUT and non-linear Presentation LUT.
static LookupTable createLut(int inBits, boolean signed, int outBits, float slope, float intercept, float center, float width, java.lang.String vlutFct, boolean inverse, short[] pval2out, java.lang.Integer pixelPaddingValue, java.lang.Integer pixelPaddingRange)
          Create ramp or sigmoid LUT for given i/o range, Rescale Slope/Intercept and Window Center/Width.
static LookupTable createLut(int inBits, boolean signed, int outBits, float slope, float intercept, float center, float width, java.lang.String vlutFct, DicomObject pLut, boolean inverse, short[] pval2out)
          Deprecated. Please use createLut(int, boolean, int, float, float, float, float, String, DicomObject, boolean, short[], Integer, Integer)
Create LUT for given i/o range, Rescale Slope/Intercept, Window Center/Width and non-linear Presentation LUT. Apply no Window if Window Width = 0.

If pval2out is not null, the output will be weighted according this function, where the highest input value (p-value) maps to array index length-1 and the highest output value (2^outBits-1) is represented by 0xFFFF. Length of pval2out must be equal to 2^inBits, with inBits in the range [8, 16].

static LookupTable createLut(int inBits, boolean signed, int outBits, float slope, float intercept, float center, float width, java.lang.String vlutFct, DicomObject pLut, boolean inverse, short[] pval2out, java.lang.Integer pixelPaddingValue, java.lang.Integer pixelPaddingRange)
          Create LUT for given i/o range, Rescale Slope/Intercept, Window Center/Width and non-linear Presentation LUT.
static LookupTable createLutForImage(DicomObject img, DicomObject mlutObj, DicomObject voiObj, DicomObject pLut, float center, float width, java.lang.String vlutFct, boolean inverse, int outBits, short[] pval2out)
          Creates a LUT based on a set of provided objects.
static LookupTable createLutForImage(DicomObject img, int outBits, short[] pval2out)
          Create LUT for given DICOM image and output range.
static LookupTable createLutForImageWithPR(DicomObject img, DicomObject pr, int frame, float center, float width, java.lang.String vlutFct, int outBits, short[] pval2out)
          Create LUT for given DICOM image with DICOM Presentation State and output range and possibly a window level over-ride.
static LookupTable createLutFromVOISequence(DicomObject img, DicomObject mLut, DicomObject voiLut, boolean inverse, int outBits, short[] pval2out)
          Deprecated. Please use createLutFromVOISequence(DicomObject, DicomObject, DicomObject, boolean, int, short[], Integer, Integer)
Create LUT for given DICOM image, non-linear VOI LUT and output range.

If pval2out is not null, the output will be weighted according this function, where the highest input value (p-value) maps to array index length-1 and the highest output value (2^outBits-1) is represented by 0xFFFF. Length of pval2out must be equal to 2^inBits, with inBits in the range [8, 16].

static LookupTable createLutFromVOISequence(DicomObject img, DicomObject mLut, DicomObject voiLut, boolean inverse, int outBits, short[] pval2out, java.lang.Integer pixelPaddingValue, java.lang.Integer pixelPaddingRange)
          Create LUT for given DICOM image, non-linear VOI LUT and output range.
static LookupTable createLutFromWL(DicomObject img, DicomObject mLut, float center, float width, java.lang.String vlutFct, boolean inverse, int outBits, short[] pval2out)
          Deprecated. Please use #createLut(DicomObject, DicomObject, float, float, String, boolean, int, short[], Integer, Integer)
Create LUT for given DICOM image, modality LUT, and Window Center/Width and output range. Apply no Window if Window Width = 0.

If pval2out is not null, the output will be weighted according this function, where the highest input value (p-value) maps to array index length-1 and the highest output value (2^outBits-1) is represented by 0xFFFF. Length of pval2out must be equal to 2^inBits, with inBits in the range [8, 16].

static LookupTable createLutFromWL(DicomObject img, DicomObject mLut, float center, float width, java.lang.String vlutFct, boolean inverse, int outBits, short[] pval2out, java.lang.Integer pixelPaddingValue, java.lang.Integer pixelPaddingRange)
          Create LUT for given DICOM image, modality LUT, and Window Center/Width and output range.
static java.lang.Integer getIntPixelValue(DicomObject ds, int tag, boolean signed, int stored)
          Gets a pixel value from the given field - the field can be a regular integer or it can be ob data.
static java.lang.Integer[] getMinMaxPixelPadding(java.lang.Integer pixelPaddingValue, java.lang.Integer pixelPaddingRange)
           
 int getOffset()
           
abstract  int length()
           
 byte[] lookup(byte[] src, byte[] dst)
           
 int[] lookup(byte[] src, int[] dst, int alpha)
           
abstract  byte[] lookup(byte[] src, int srcPos, byte[] dst, int dstPos, int length, int channels, int skip)
           
abstract  int[] lookup(byte[] src, int srcPos, int[] dst, int dstPos, int length, int alpha)
           
 void lookup(byte[] src, int srcWidth, int srcHeight, int srcScanlineStride, byte[] dst, int dstScanlineStride, int channels, int skip)
           
 void lookup(byte[] src, int srcWidth, int srcHeight, int srcScanlineStride, int[] dst, int dstScanlineStride, int alpha)
           
 void lookup(byte[] src, int srcWidth, int srcHeight, int srcScanlineStride, short[] dst, int dstScanlineStride)
           
abstract  short[] lookup(byte[] src, int srcPos, short[] dst, int dstPos, int length)
           
 short[] lookup(byte[] src, short[] dst)
           
 void lookup(java.awt.image.DataBuffer src, int srcWidth, int srcHeight, int srcScanlineStride, byte[] dst, int dstScanlineStride, int channels, int skip, int bank)
           
 void lookup(java.awt.image.DataBuffer src, int srcWidth, int srcHeight, int srcScanlineStride, int[] dst, int dstScanlineStride, int alpha)
           
 void lookup(java.awt.image.DataBuffer src, int srcWidth, int srcHeight, int srcScanlineStride, short[] dst, int dstScanlineStride)
           
abstract  int lookup(int in)
           
 void lookup(java.awt.image.Raster src, java.awt.image.Raster dst)
           
 void lookup(java.awt.image.Raster src, java.awt.image.Raster dst, int alpha)
           
 void lookup(java.awt.image.Raster src, java.awt.image.Raster dst, int alpha, int channels, int skip)
           
 byte[] lookup(short[] src, byte[] dst)
           
 int[] lookup(short[] src, int[] dst, int alpha)
           
abstract  byte[] lookup(short[] src, int srcPos, byte[] dst, int dstPos, int length)
           
abstract  int[] lookup(short[] src, int srcPos, int[] dst, int dstPos, int length, int alpha)
           
 void lookup(short[] src, int srcWidth, int srcHeight, int srcScanlineStride, byte[] dst, int dstScanlineStride)
           
 void lookup(short[] src, int srcWidth, int srcHeight, int srcScanlineStride, int[] dst, int dstScanlineStride, int alpha)
           
 void lookup(short[] src, int srcWidth, int srcHeight, int srcScanlineStride, short[] dst, int dstScanlineStride)
           
 short[] lookup(short[] src, int srcPos, short[] dst)
           
abstract  short[] lookup(short[] src, int srcPos, short[] dst, int dstPos, int length)
           
abstract  byte lookupByte(int in)
           
abstract  short lookupShort(int in)
           
protected abstract  LookupTable scale(int outBits, boolean inverse, short[] pval2out)
           
protected  int toIndex(int in)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LINEAR

public static final java.lang.String LINEAR
See Also:
Constant Field Values

SIGMOID

public static final java.lang.String SIGMOID
See Also:
Constant Field Values

inBits

protected final int inBits

andmask

protected final int andmask

ormask

protected final int ormask

signbit

protected final int signbit

preserve

protected final boolean preserve

outBits

protected int outBits

off

protected int off
Constructor Detail

LookupTable

protected LookupTable(int inBits,
                      boolean signed,
                      int off,
                      int outBits,
                      boolean preserve)
Method Detail

getOffset

public final int getOffset()

length

public abstract int length()

lookupByte

public abstract byte lookupByte(int in)

lookupShort

public abstract short lookupShort(int in)

lookup

public abstract int lookup(int in)

lookup

public abstract byte[] lookup(byte[] src,
                              int srcPos,
                              byte[] dst,
                              int dstPos,
                              int length,
                              int channels,
                              int skip)

lookup

public abstract short[] lookup(byte[] src,
                               int srcPos,
                               short[] dst,
                               int dstPos,
                               int length)

lookup

public abstract int[] lookup(byte[] src,
                             int srcPos,
                             int[] dst,
                             int dstPos,
                             int length,
                             int alpha)

lookup

public abstract byte[] lookup(short[] src,
                              int srcPos,
                              byte[] dst,
                              int dstPos,
                              int length)

lookup

public abstract short[] lookup(short[] src,
                               int srcPos,
                               short[] dst,
                               int dstPos,
                               int length)

lookup

public abstract int[] lookup(short[] src,
                             int srcPos,
                             int[] dst,
                             int dstPos,
                             int length,
                             int alpha)

lookup

public byte[] lookup(byte[] src,
                     byte[] dst)

lookup

public short[] lookup(byte[] src,
                      short[] dst)

lookup

public int[] lookup(byte[] src,
                    int[] dst,
                    int alpha)

lookup

public byte[] lookup(short[] src,
                     byte[] dst)

lookup

public short[] lookup(short[] src,
                      int srcPos,
                      short[] dst)

lookup

public int[] lookup(short[] src,
                    int[] dst,
                    int alpha)

lookup

public void lookup(java.awt.image.Raster src,
                   java.awt.image.Raster dst)

lookup

public void lookup(java.awt.image.Raster src,
                   java.awt.image.Raster dst,
                   int alpha)

lookup

public void lookup(java.awt.image.Raster src,
                   java.awt.image.Raster dst,
                   int alpha,
                   int channels,
                   int skip)

lookup

public void lookup(java.awt.image.DataBuffer src,
                   int srcWidth,
                   int srcHeight,
                   int srcScanlineStride,
                   byte[] dst,
                   int dstScanlineStride,
                   int channels,
                   int skip,
                   int bank)

lookup

public void lookup(java.awt.image.DataBuffer src,
                   int srcWidth,
                   int srcHeight,
                   int srcScanlineStride,
                   short[] dst,
                   int dstScanlineStride)

lookup

public void lookup(java.awt.image.DataBuffer src,
                   int srcWidth,
                   int srcHeight,
                   int srcScanlineStride,
                   int[] dst,
                   int dstScanlineStride,
                   int alpha)

lookup

public void lookup(byte[] src,
                   int srcWidth,
                   int srcHeight,
                   int srcScanlineStride,
                   byte[] dst,
                   int dstScanlineStride,
                   int channels,
                   int skip)

lookup

public void lookup(short[] src,
                   int srcWidth,
                   int srcHeight,
                   int srcScanlineStride,
                   byte[] dst,
                   int dstScanlineStride)

lookup

public void lookup(byte[] src,
                   int srcWidth,
                   int srcHeight,
                   int srcScanlineStride,
                   short[] dst,
                   int dstScanlineStride)

lookup

public void lookup(short[] src,
                   int srcWidth,
                   int srcHeight,
                   int srcScanlineStride,
                   short[] dst,
                   int dstScanlineStride)

lookup

public void lookup(byte[] src,
                   int srcWidth,
                   int srcHeight,
                   int srcScanlineStride,
                   int[] dst,
                   int dstScanlineStride,
                   int alpha)

lookup

public void lookup(short[] src,
                   int srcWidth,
                   int srcHeight,
                   int srcScanlineStride,
                   int[] dst,
                   int dstScanlineStride,
                   int alpha)

scale

protected abstract LookupTable scale(int outBits,
                                     boolean inverse,
                                     short[] pval2out)

combine

protected abstract LookupTable combine(LookupTable other,
                                       int outBits,
                                       boolean inverse,
                                       short[] pval2out)

combine

protected abstract LookupTable combine(LookupTable vlut,
                                       LookupTable plut,
                                       int outBits,
                                       boolean inverse,
                                       short[] pval2out)

toIndex

protected final int toIndex(int in)

createLut

public static LookupTable createLut(int inBits,
                                    boolean signed,
                                    int outBits,
                                    float slope,
                                    float intercept,
                                    float center,
                                    float width,
                                    java.lang.String vlutFct,
                                    boolean inverse,
                                    short[] pval2out,
                                    java.lang.Integer pixelPaddingValue,
                                    java.lang.Integer pixelPaddingRange)
Create ramp or sigmoid LUT for given i/o range, Rescale Slope/Intercept and Window Center/Width. Create linear LUT if Window Width = 0.

If vlutFct is null or "LINEAR", a ramp LUT will be created. If vlutFct is "SIGMOID", a sigmoid LUT will be created.

If pval2out is not null, the output will be weighted according this function, where the highest input value (p-value) maps to array index length-1 and the highest output value (2^outBits-1) is represented by 0xFFFF. Length of pval2out must be equal to 2^inBits, with inBits in the range [8, 16].

Parameters:
inBits - number of significant bits within input values
signed - specifies if input values are signed or unsigned
outBits - bit depth of output range
slope - Rescale Slope (0028,1053)
intercept - Rescale Intercept (0028,1052)
center - Window Center (0028,1050)
width - Window Width (0028,1051) or 0 (= no Window specified)
vlutFct - VOI LUT Function (0028,1056)
inverse - specifies if output shall be inverted
pval2out - p-value to output map or null
pixelPaddingValue - pixel padding value (0028, 0120) or null
pixelPaddingRange - pixel padding range limit (0028, 0121) or null
Returns:
created LUT

createLut

public static LookupTable createLut(int inBits,
                                    boolean signed,
                                    int outBits,
                                    DicomObject mLut,
                                    float center,
                                    float width,
                                    java.lang.String vlutFct,
                                    boolean inverse,
                                    short[] pval2out,
                                    java.lang.Integer pixelPaddingValue,
                                    java.lang.Integer pixelPaddingRange)
Create LUT for given i/o range, non-linear Modality LUT and Window Center/Width. Do not apply any Window if Window Width = 0.

If pval2out is not null, the output will be weighted according this function, where the highest input value (p-value) maps to array index length-1 and the highest output value (2^outBits-1) is represented by 0xFFFF. Length of pval2out must be equal to 2^inBits, with inBits in the range [8, 16].

Parameters:
inBits - number of significant bits within input values
signed - specifies if input values are signed or unsigned
outBits - bit depth of output range
mLut - item of Modality LUT Sequence (0028,3000)
center - Window Center (0028,1050)
width - Window Width (0028,1051) or 0 (= no Window specified)
vlutFct - VOI LUT Function (0028,1056)
inverse - specifies if output shall be inverted
pval2out - p-value to output map or null
pixelPaddingValue - pixel padding value (0028, 0120) or null
pixelPaddingRange - pixel padding range limit (0028, 0121) or null
Returns:
created LUT

createLut

public static LookupTable createLut(int inBits,
                                    boolean signed,
                                    int outBits,
                                    float slope,
                                    float intercept,
                                    DicomObject voiLut,
                                    boolean inverse,
                                    short[] pval2out,
                                    java.lang.Integer pixelPaddingValue,
                                    java.lang.Integer pixelPaddingRange)
Create LUT for given i/o range, Rescale Slope/Intercept and non-linear VOI LUT.

If pval2out is not null, the output will be weighted according this function, where the highest input value (p-value) maps to array index length-1 and the highest output value (2^outBits-1) is represented by 0xFFFF. Length of pval2out must be equal to 2^inBits, with inBits in the range [8, 16].

Parameters:
inBits - number of significant bits within input values
signed - specifies if input values are signed or unsigned
outBits - bit depth of output range
slope - Rescale Slope (0028,1053)
intercept - Rescale Intercept (0028,1052)
voiLut - item of VOI LUT Sequence (0028,3010)
inverse - specifies if output shall be inverted
pval2out - p-value to output map or null
pixelPaddingValue - pixel padding value (0028, 0120) or null
pixelPaddingRange - pixel padding range limit (0028, 0121) or null
Returns:
created LUT

createLut

public static LookupTable createLut(int inBits,
                                    boolean signed,
                                    int outBits,
                                    float slope,
                                    float intercept,
                                    float center,
                                    float width,
                                    java.lang.String vlutFct,
                                    DicomObject pLut,
                                    boolean inverse,
                                    short[] pval2out,
                                    java.lang.Integer pixelPaddingValue,
                                    java.lang.Integer pixelPaddingRange)
Create LUT for given i/o range, Rescale Slope/Intercept, Window Center/Width and non-linear Presentation LUT. Apply no Window if Window Width = 0.

If pval2out is not null, the output will be weighted according this function, where the highest input value (p-value) maps to array index length-1 and the highest output value (2^outBits-1) is represented by 0xFFFF. Length of pval2out must be equal to 2^inBits, with inBits in the range [8, 16].

Parameters:
inBits - number of significant bits within input values
signed - specifies if input values are signed or unsigned
outBits - bit depth of output range
slope - Rescale Slope (0028,1053)
intercept - Rescale Intercept (0028,1052)
center - Window Center (0028,1050)
width - Window Width (0028,1051) or 0 (= no Window specified)
vlutFct - VOI LUT Function (0028,1056)
pLut - item of Presentation LUT Sequence (2050,0010)
inverse - specifies if output shall be inverted
pval2out - p-value to output map or null
pixelPaddingValue - pixel padding value (0028, 0120) or null
pixelPaddingRange - pixel padding range limit (0028, 0121) or null
Returns:
created LUT

createLut

@Deprecated
public static LookupTable createLut(int inBits,
                                               boolean signed,
                                               int outBits,
                                               float slope,
                                               float intercept,
                                               float center,
                                               float width,
                                               java.lang.String vlutFct,
                                               DicomObject pLut,
                                               boolean inverse,
                                               short[] pval2out)
Deprecated. Please use createLut(int, boolean, int, float, float, float, float, String, DicomObject, boolean, short[], Integer, Integer)
Create LUT for given i/o range, Rescale Slope/Intercept, Window Center/Width and non-linear Presentation LUT. Apply no Window if Window Width = 0.

If pval2out is not null, the output will be weighted according this function, where the highest input value (p-value) maps to array index length-1 and the highest output value (2^outBits-1) is represented by 0xFFFF. Length of pval2out must be equal to 2^inBits, with inBits in the range [8, 16].

Parameters:
inBits - number of significant bits within input values
signed - specifies if input values are signed or unsigned
outBits - bit depth of output range
slope - Rescale Slope (0028,1053)
intercept - Rescale Intercept (0028,1052)
center - Window Center (0028,1050)
width - Window Width (0028,1051) or 0 (= no Window specified)
vlutFct - VOI LUT Function (0028,1056)
pLut - item of Presentation LUT Sequence (2050,0010)
inverse - specifies if output shall be inverted
pval2out - p-value to output map or null
Returns:
created LUT

createLut

public static LookupTable createLut(int inBits,
                                    boolean signed,
                                    int outBits,
                                    DicomObject mLut,
                                    DicomObject voiLut,
                                    boolean inverse,
                                    short[] pval2out,
                                    java.lang.Integer pixelPaddingValue,
                                    java.lang.Integer pixelPaddingRange)
Create LUT for given i/o range, non-linear Modality LUT and non-linear VOI LUT.

If pval2out is not null, the output will be weighted according this function, where the highest input value (p-value) maps to array index length-1 and the highest output value (2^outBits-1) is represented by 0xFFFF. Length of pval2out must be equal to 2^inBits, with inBits in the range [8, 16].

Parameters:
inBits - number of significant bits within input values
signed - specifies if input values are signed or unsigned
outBits - bit depth of output range
mLut - item of Modality LUT Sequence (0028,3000)
voiLut - item of VOI LUT Sequence (0028,3010)
inverse - specifies if output shall be inverted
pval2out - p-value to output map or null
pixelPaddingValue - pixel padding value (0028, 0120) or null
pixelPaddingRange - pixel padding range limit (0028, 0121) or null
Returns:
created LUT

createLut

public static LookupTable createLut(int inBits,
                                    boolean signed,
                                    int outBits,
                                    float slope,
                                    float intercept,
                                    DicomObject voiLut,
                                    DicomObject pLut,
                                    boolean inverse,
                                    short[] pval2out,
                                    java.lang.Integer pixelPaddingValue,
                                    java.lang.Integer pixelPaddingRange)
Create LUT for given i/o range, Rescale Slope/Intercept, non-linear VOI LUT and non-linear Presentation LUT.

If pval2out is not null, the output will be weighted according this function, where the highest input value (p-value) maps to array index length-1 and the highest output value (2^outBits-1) is represented by 0xFFFF. Length of pval2out must be equal to 2^inBits, with inBits in the range [8, 16].

Parameters:
inBits - number of significant bits within input values
signed - specifies if input values are signed or unsigned
outBits - bit depth of output range
slope - Rescale Slope (0028,1053)
intercept - Rescale Intercept (0028,1052)
voiLut - item of VOI LUT Sequence (0028,3010)
pLut - item of Presentation LUT Sequence (2050,0010)
inverse - specifies if output shall be inverted
pval2out - p-value to output map or null
pixelPaddingValue - pixel padding value (0028, 0120) or null
pixelPaddingRange - pixel padding range limit (0028, 0121) or null
Returns:
created LUT

createLut

public static LookupTable createLut(int inBits,
                                    boolean signed,
                                    int outBits,
                                    DicomObject mLut,
                                    float center,
                                    float width,
                                    java.lang.String vlutFct,
                                    DicomObject pLut,
                                    boolean inverse,
                                    short[] pval2out,
                                    java.lang.Integer pixelPaddingValue,
                                    java.lang.Integer pixelPaddingRange)
Create LUT for given i/o range, non-linear Modality LUT, Window Center/Width and non-linear Presentation LUT. Apply no Window if Window Width = 0.

If pval2out is not null, the output will be weighted according this function, where the highest input value (p-value) maps to array index length-1 and the highest output value (2^outBits-1) is represented by 0xFFFF. Length of pval2out must be equal to 2^inBits, with inBits in the range [8, 16].

Parameters:
inBits - number of significant bits within input values
signed - specifies if input values are signed or unsigned
outBits - bit depth of output range
mLut - item of Modality LUT Sequence (0028,3000)
center - Window Center (0028,1050)
width - Window Width (0028,1051) or 0 (= no Window specified)
vlutFct - VOI LUT Function (0028,1056)
pLut - item of Presentation LUT Sequence (2050,0010)
inverse - specifies if output shall be inverted
pval2out - p-value to output map or null
pixelPaddingValue - pixel padding value (0028, 0120) or null
pixelPaddingRange - pixel padding range limit (0028, 0121) or null
Returns:
created LUT

createLut

public static LookupTable createLut(int inBits,
                                    boolean signed,
                                    int outBits,
                                    DicomObject mLut,
                                    DicomObject voiLut,
                                    DicomObject pLut,
                                    boolean inverse,
                                    short[] pval2out,
                                    java.lang.Integer pixelPaddingValue,
                                    java.lang.Integer pixelPaddingRange)
Create LUT for given i/o range, non-linear Modality LUT, non-linear VOI LUT and non-linear Presentation LUT.

If pval2out is not null, the output will be weighted according this function, where the highest input value (p-value) maps to array index length-1 and the highest output value (2^outBits-1) is represented by 0xFFFF. Length of pval2out must be equal to 2^inBits, with inBits in the range [8, 16].

Parameters:
inBits - number of significant bits within input values
signed - specifies if input values are signed or unsigned
outBits - bit depth of output range
mLut - item of Modality LUT Sequence (0028,3000)
voiLut - item of VOI LUT Sequence (0028,3010)
pLut - item of Presentation LUT Sequence (2050,0010)
inverse - specifies if output shall be inverted
pval2out - p-value to output map or null
pixelPaddingValue - pixel padding value (0028, 0120) or null
pixelPaddingRange - pixel padding range limit (0028, 0121) or null
Returns:
created LUT

createLutForImage

public static LookupTable createLutForImage(DicomObject img,
                                            int outBits,
                                            short[] pval2out)
Create LUT for given DICOM image and output range. If the image specifies multiple non-linear VOI LUTs, the VOI LUT specified by the first item of the VOI LUT Sequence (0028,3010) will be applied. If the image does not specify any non-linear VOI LUT, but multiple values for Window Center/Width, the first Window Center/Width value will be applied.

If pval2out is not null, the output will be weighted according this function, where the highest input value (p-value) maps to array index length-1 and the highest output value (2^outBits-1) is represented by 0xFFFF. Length of pval2out must be equal to 2^inBits, with inBits in the range [8, 16].

Parameters:
img - DICOM image
outBits - bit depth of output range
pval2out - p-value to output map or null
Returns:
created LUT

createLutFromWL

@Deprecated
public static LookupTable createLutFromWL(DicomObject img,
                                                     DicomObject mLut,
                                                     float center,
                                                     float width,
                                                     java.lang.String vlutFct,
                                                     boolean inverse,
                                                     int outBits,
                                                     short[] pval2out)
Deprecated. Please use #createLut(DicomObject, DicomObject, float, float, String, boolean, int, short[], Integer, Integer)
Create LUT for given DICOM image, modality LUT, and Window Center/Width and output range. Apply no Window if Window Width = 0.

If pval2out is not null, the output will be weighted according this function, where the highest input value (p-value) maps to array index length-1 and the highest output value (2^outBits-1) is represented by 0xFFFF. Length of pval2out must be equal to 2^inBits, with inBits in the range [8, 16].

Parameters:
img - DICOM image
mLut - is the dicom object containing the modality LUT to apply
center - Window Center (0028,1050)
width - Window Width (0028,1051) or 0 (= no Window specified)
vlutFct - VOI LUT Function (0028,1056)
inverse - is true when the output should be inverted.
outBits - bit depth of output range
pval2out - p-value to output map or null
Returns:
created LUT

createLutFromWL

public static LookupTable createLutFromWL(DicomObject img,
                                          DicomObject mLut,
                                          float center,
                                          float width,
                                          java.lang.String vlutFct,
                                          boolean inverse,
                                          int outBits,
                                          short[] pval2out,
                                          java.lang.Integer pixelPaddingValue,
                                          java.lang.Integer pixelPaddingRange)
Create LUT for given DICOM image, modality LUT, and Window Center/Width and output range. Apply no Window if Window Width = 0.

If pval2out is not null, the output will be weighted according this function, where the highest input value (p-value) maps to array index length-1 and the highest output value (2^outBits-1) is represented by 0xFFFF. Length of pval2out must be equal to 2^inBits, with inBits in the range [8, 16].

Parameters:
img - DICOM image
mLut - is the dicom object containing the modality LUT to apply
center - Window Center (0028,1050)
width - Window Width (0028,1051) or 0 (= no Window specified)
vlutFct - VOI LUT Function (0028,1056)
inverse - is true when the output should be inverted.
outBits - bit depth of output range
pval2out - p-value to output map or null
pixelPaddingValue - pixel padding value (0028, 0120) or null
pixelPaddingRange - pixel padding range limit (0028, 0121) or null
Returns:
created LUT

createLutFromVOISequence

@Deprecated
public static LookupTable createLutFromVOISequence(DicomObject img,
                                                              DicomObject mLut,
                                                              DicomObject voiLut,
                                                              boolean inverse,
                                                              int outBits,
                                                              short[] pval2out)
Deprecated. Please use createLutFromVOISequence(DicomObject, DicomObject, DicomObject, boolean, int, short[], Integer, Integer)
Create LUT for given DICOM image, non-linear VOI LUT and output range.

If pval2out is not null, the output will be weighted according this function, where the highest input value (p-value) maps to array index length-1 and the highest output value (2^outBits-1) is represented by 0xFFFF. Length of pval2out must be equal to 2^inBits, with inBits in the range [8, 16].

Parameters:
img - DICOM image
mLut - contains the modality LUT information.
voiLut - item of VOI LUT Sequence (0028,3010)
outBits - bit depth of output range
pval2out - p-value to output map or null
Returns:
created LUT

createLutFromVOISequence

public static LookupTable createLutFromVOISequence(DicomObject img,
                                                   DicomObject mLut,
                                                   DicomObject voiLut,
                                                   boolean inverse,
                                                   int outBits,
                                                   short[] pval2out,
                                                   java.lang.Integer pixelPaddingValue,
                                                   java.lang.Integer pixelPaddingRange)
Create LUT for given DICOM image, non-linear VOI LUT and output range.

If pval2out is not null, the output will be weighted according this function, where the highest input value (p-value) maps to array index length-1 and the highest output value (2^outBits-1) is represented by 0xFFFF. Length of pval2out must be equal to 2^inBits, with inBits in the range [8, 16].

Parameters:
img - DICOM image
mLut - contains the modality LUT information.
voiLut - item of VOI LUT Sequence (0028,3010)
outBits - bit depth of output range
pval2out - p-value to output map or null
pixelPaddingValue - pixel padding value (0028, 0120) or null
pixelPaddingRange - pixel padding range limit (0028, 0121) or null
Returns:
created LUT

createLutForImageWithPR

public static LookupTable createLutForImageWithPR(DicomObject img,
                                                  DicomObject pr,
                                                  int frame,
                                                  float center,
                                                  float width,
                                                  java.lang.String vlutFct,
                                                  int outBits,
                                                  short[] pval2out)
Create LUT for given DICOM image with DICOM Presentation State and output range and possibly a window level over-ride.

If pval2out is not null, the output will be weighted according this function, where the highest input value (p-value) maps to array index length-1 and the highest output value (2^outBits-1) is represented by 0xFFFF. Length of pval2out must be equal to 2^inBits, with inBits in the range [8, 16].

Parameters:
img - DICOM image. Must not be null.
pr - DICOM Presentation State. If null, fall back to the image information.
frame - The frame number to use. Non-multi-frame objects can provide any value here, multi-frame objects must start this from frame 1 to frame n.
center - The window level center
width - The window level width
vlutFct - A function to use when applying the center/width. The center/width will only be used if this function is non-null.
outBits - bit depth of output range - typically 8, 10, 12 or 16
pval2out - p-value to output map or null
Returns:
created LUT

getIntPixelValue

public static java.lang.Integer getIntPixelValue(DicomObject ds,
                                                 int tag,
                                                 boolean signed,
                                                 int stored)
Gets a pixel value from the given field - the field can be a regular integer or it can be ob data.

Parameters:
ds -
tag -
Returns:

createLutForImage

public static LookupTable createLutForImage(DicomObject img,
                                            DicomObject mlutObj,
                                            DicomObject voiObj,
                                            DicomObject pLut,
                                            float center,
                                            float width,
                                            java.lang.String vlutFct,
                                            boolean inverse,
                                            int outBits,
                                            short[] pval2out)
Creates a LUT based on a set of provided objects. These can come from different places within images, so providing them separately is important, even thought the common use case will be that mlutObj, voiObj are the same as img. Allows a custom center/width/function to be applied that overrides the voi obj values.

Parameters:
img - The image dicom object header
mlutObj - The object containing the modality LUT information
voiObj - The object containing the VOI LUT information (or null if none)
pLut - The Presentation LUT Sequence (or null if none)
center - An over-riding window center
width - An over-riding window width
vlutFct - An over-riding VOI LUT Function. Must be non-null to override.
inverse - True if the image should be inverted.
outBits - The number of output bits after everything.
pval2out - A p-value to output DDL (digital driving levels).
Returns:

getMinMaxPixelPadding

public static java.lang.Integer[] getMinMaxPixelPadding(java.lang.Integer pixelPaddingValue,
                                                        java.lang.Integer pixelPaddingRange)


Copyright © 2011 dcm4che. All Rights Reserved.