private int index(int pixel) { int index = inBits.valueOf(pixel) - offset; return Math.min(Math.max(0, index), lut.length-1); }
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; }
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; }
private int index(int pixel) { int index = inBits.valueOf(pixel) - offset; return Math.min(Math.max(0, index), lut.length-1); }
private int index(int pixel) { int index = inBits.valueOf(pixel) - offset; return Math.min(Math.max(0, index), lut.length-1); }
private int index(int pixel) { int index = inBits.valueOf(pixel) - offset; return Math.min(Math.max(0, index), lut.length-1); }
private int[] calcMinMax(StoredValue storedValue, ComponentSampleModel sm, short[] data) { int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; int w = sm.getWidth(); int h = sm.getHeight(); int stride = sm.getScanlineStride(); for (int y = 0; y < h; y++) for (int i = y * stride, end = i + w; i < end;) { int val = storedValue.valueOf(data[i++]); if (val < min) min = val; if (val > max) max = val; } return new int[] { min, max }; }
private int[] calcMinMax(StoredValue storedValue, ComponentSampleModel sm, byte[] data) { int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; int w = sm.getWidth(); int h = sm.getHeight(); int stride = sm.getScanlineStride(); for (int y = 0; y < h; y++) for (int i = y * stride, end = i + w; i < end;) { int val = storedValue.valueOf(data[i++]); if (val < min) min = val; if (val > max) max = val; } return new int[] { min, max }; }
private int[] calcMinMax(StoredValue storedValue, ComponentSampleModel sm, byte[] data) { int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; int w = sm.getWidth(); int h = sm.getHeight(); int stride = sm.getScanlineStride(); for (int y = 0; y < h; y++) for (int i = y * stride, end = i + w; i < end;) { int val = storedValue.valueOf(data[i++]); if (val < min) min = val; if (val > max) max = val; } return new int[] { min, max }; }
private int[] calcMinMax(StoredValue storedValue, ComponentSampleModel sm, short[] data) { int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; int w = sm.getWidth(); int h = sm.getHeight(); int stride = sm.getScanlineStride(); for (int y = 0; y < h; y++) for (int i = y * stride, end = i + w; i < end;) { int val = storedValue.valueOf(data[i++]); if (val < min) min = val; if (val > max) max = val; } return new int[] { min, max }; }
: Raster.createWritableRaster(sm, null); Attributes imgAttrs = metadata.getAttributes(); StoredValue sv = StoredValue.valueOf(imgAttrs); LookupTableFactory lutParam = new LookupTableFactory(sv); DicomImageReadParam dParam = param instanceof DicomImageReadParam