public LookupTable createLUT(int outBits) { LookupTable lut = combineModalityVOILUT(presentationLUT != null ? log2(presentationLUT.length()) : outBits); if (presentationLUT != null) { lut = lut.combine(presentationLUT.adjustOutBits(outBits)); } else if (inverse) lut.inverse(); return lut; }
private LookupTable combineModalityVOILUT(int outBits) { float m = rescaleSlope; float b = rescaleIntercept; LookupTable modalityLUT = this.modalityLUT; LookupTable lut = this.voiLUT; if (lut == null) { float c = windowCenter; float w = windowWidth; if (w == 0 && modalityLUT != null) return modalityLUT.adjustOutBits(outBits); int size, offset; StoredValue inBits = modalityLUT != null ? new StoredValue.Unsigned(modalityLUT.outBits) : storedValue; if (w != 0) { size = Math.max(2,Math.abs(Math.round(w/m))); offset = Math.round((c-b)/m) - size/2; } else { offset = inBits.minValue(); size = inBits.maxValue() - inBits.minValue() + 1; } lut = outBits > 8 ? new ShortLookupTable(inBits, outBits, offset, size, m < 0) : new ByteLookupTable(inBits, outBits, offset, size, m < 0); } else { //TODO consider m+b lut = lut.adjustOutBits(outBits); } return modalityLUT != null ? modalityLUT.combine(lut) : lut; }
public LookupTable createLUT(int outBits) { LookupTable lut = combineModalityVOILUT(presentationLUT != null ? log2(presentationLUT.length()) : outBits); if (presentationLUT != null) { lut = lut.combine(presentationLUT.adjustOutBits(outBits)); } else if (inverse) lut.inverse(); return lut; }
private LookupTable combineModalityVOILUT(int outBits) { float m = rescaleSlope; float b = rescaleIntercept; LookupTable modalityLUT = this.modalityLUT; LookupTable lut = this.voiLUT; if (lut == null) { float c = windowCenter; float w = windowWidth; if (w == 0 && modalityLUT != null) return modalityLUT.adjustOutBits(outBits); int size, offset; StoredValue inBits = modalityLUT != null ? new StoredValue.Unsigned(modalityLUT.outBits) : storedValue; if (w != 0) { size = Math.max(2,Math.abs(Math.round(w/m))); offset = Math.round((c-b)/m) - size/2; } else { offset = inBits.minValue(); size = inBits.maxValue() - inBits.minValue() + 1; } lut = outBits > 8 ? new ShortLookupTable(inBits, outBits, offset, size, m < 0) : new ByteLookupTable(inBits, outBits, offset, size, m < 0); } else { //TODO consider m+b lut = lut.adjustOutBits(outBits); } return modalityLUT != null ? modalityLUT.combine(lut) : lut; }