Beispiel #1
0
 public void resetDisplayRange() {
   if (getType() == GRAY16 && getDefault16bitRange() != 0) {
     int defaultRange = getDefault16bitRange();
     for (int i = 1; i <= getNChannels(); i++) {
       LUT lut = getChannelLut(i);
       lut.min = 0;
       lut.max = Math.pow(2, defaultRange) - 1;
       if (getWindow() != null) setChannelLut(lut, i);
     }
   } else {
     ip.resetMinAndMax();
     int c = getChannelIndex();
     lut[c].min = ip.getMin();
     lut[c].max = ip.getMax();
   }
 }
Beispiel #2
0
 /* Sets the LUT of the specified channel using a clone of 'table'. */
 public synchronized void setChannelLut(LUT table, int channel) {
   int channels = getNChannels();
   if (lut == null) setupLuts(channels);
   if (channel < 1 || channel > lut.length)
     throw new IllegalArgumentException("Channel out of range");
   lut[channel - 1] = (LUT) table.clone();
   if (getWindow() != null && channel == getChannel()) getProcessor().setLut(lut[channel - 1]);
   if (cip != null && cip.length >= channel && cip[channel - 1] != null)
     cip[channel - 1].setLut(lut[channel - 1]);
   else cip = null;
   customLuts = true;
 }
Beispiel #3
0
 void setupLuts(int channels) {
   if (lut == null || lut.length < channels) {
     if (displayRanges != null && channels != displayRanges.length / 2) displayRanges = null;
     if (displayRanges == null && ip.getMin() == 0.0 && ip.getMax() == 0.0) ip.resetMinAndMax();
     lut = new LUT[channels];
     LUT lut2 = channels > MAX_CHANNELS ? createLutFromColor(Color.white) : null;
     for (int i = 0; i < channels; ++i) {
       if (channelLuts != null && i < channelLuts.length) {
         lut[i] = createLutFromBytes(channelLuts[i]);
         customLuts = true;
       } else if (i < MAX_CHANNELS) lut[i] = createLutFromColor(colors[i]);
       else lut[i] = (LUT) lut2.clone();
       if (displayRanges != null) {
         lut[i].min = displayRanges[i * 2];
         lut[i].max = displayRanges[i * 2 + 1];
       } else {
         lut[i].min = ip.getMin();
         lut[i].max = ip.getMax();
       }
     }
     displayRanges = null;
   }
 }
Beispiel #4
0
 public LUT createLutFromColor(Color color) {
   return LUT.createLutFromColor(color);
 }