Ignore:
Timestamp:
02/13/12 09:55:09 (8 years ago)
Author:
aivar
Message:

Fixed some channel bugs; started Estimator.

Location:
trunk/projects/slim-plugin/src/main/java/loci/slim/histogram
Files:
1 added
11 copied

Legend:

Unmodified
Added
Removed
  • trunk/projects/slim-plugin/src/main/java/loci/slim/histogram/ColorBarPanel.java

    r7847 r7889  
    3333*/ 
    3434 
    35 package imagej.slim.histogram; 
     35package loci.slim.histogram; 
    3636 
    3737import java.awt.Color; 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/histogram/DoubleFormatter.java

    r7847 r7889  
    33 * and open the template in the editor. 
    44 */ 
    5 package imagej.slim.histogram; 
     5package loci.slim.histogram; 
    66 
    77import java.math.BigDecimal; 
     
    4747     */ 
    4848    public String getText() { 
     49        int index = _text.indexOf("-"); 
     50        if (index > 0) { 
     51            if ('E' != _text.charAt(index - 1)) { 
     52                ij.IJ.log("Funny text " + _text); 
     53            } 
     54        } 
    4955        return _text; 
    5056    } 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/histogram/HistogramData.java

    r7887 r7889  
    33 * and open the template in the editor. 
    44 */ 
    5 package imagej.slim.histogram; 
    6  
    7 import imagej.slim.fitting.images.IColorizedImage; 
     5package loci.slim.histogram; 
     6 
     7import loci.slim.fitting.images.IColorizedImage; 
    88 
    99/** 
     
    4343        _channel = channel; 
    4444        _autoRange = true; 
    45         _combineChannels = true; 
    46         _displayChannels = true; 
     45        _combineChannels = hasChannels(); 
     46        _displayChannels = hasChannels(); 
    4747        _channelIndex = 0; 
    48         _minView = _maxView = 0.0f; 
    49         _minLUT = _maxLUT = 0.0f; 
    50         _minData = _maxData = 0.0f; 
     48        _minView = _maxView = 0.0; 
     49        _minLUT  = _maxLUT  = 0.0; 
     50        _minData = _maxData = 0.0; 
    5151        _minDataCurrent = _maxDataCurrent = 0.0; 
    5252        _listener = null; 
     
    141141    public void setDisplayChannels(boolean displayChannels) { 
    142142        _displayChannels = displayChannels; 
     143    } 
     144 
     145    /** 
     146     * Returns whether or not histogram has channels. 
     147     *  
     148     * @return  
     149     */ 
     150    public boolean hasChannels() { 
     151        return _channel.length > 1; 
    143152    } 
    144153 
     
    288297            minMaxData = _channel[_channelIndex].findMinMax(); 
    289298            minData = minDataCurrent = minMaxData[0]; 
    290             maxData = minDataCurrent = minMaxData[1]; 
     299            maxData = maxDataCurrent = minMaxData[1]; 
    291300        } 
    292301 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/histogram/HistogramDataChannel.java

    r7887 r7889  
    33 * and open the template in the editor. 
    44 */ 
    5 package imagej.slim.histogram; 
     5package loci.slim.histogram; 
    66 
    77/** 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/histogram/HistogramPanel.java

    r7886 r7889  
    33 * and open the template in the editor. 
    44 */ 
    5 package imagej.slim.histogram; 
     5package loci.slim.histogram; 
    66 
    77import java.awt.Color; 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/histogram/HistogramTool.java

    r7886 r7889  
    33 * and open the template in the editor. 
    44 */ 
    5 package imagej.slim.histogram; 
     5package loci.slim.histogram; 
    66 
    77import java.awt.BorderLayout; 
     
    155155         
    156156        _histogramPanel.setBins(histogramData.binValues(WIDTH)); 
    157         System.out.println("minMaxLUT is " + minMaxLUT[0] + " " + minMaxLUT[1]); 
    158         System.out.println("so cursosr are " + cursorPixelFromValue(false, minMaxLUT[0]) + " " + cursorPixelFromValue(false, minMaxLUT[1])); 
    159157        _histogramPanel.setCursors(cursorPixelFromValue(false, minMaxLUT[0]), cursorPixelFromValue(false, minMaxLUT[1])); //TODO ARG true, maxLUT)); in this case adding 1 to max is too much! 
    160158  
     
    162160        _uiPanel.setCombineChannels(histogramData.getCombineChannels()); 
    163161        _uiPanel.setDisplayChannels(histogramData.getDisplayChannels()); 
     162        _uiPanel.enableChannels(histogramData.hasChannels());         
    164163        _uiPanel.setMinMaxLUT(minMaxLUT[0], minMaxLUT[1]); 
    165164         
     
    198197            double max = minMaxView[1]; 
    199198            int pixel = (int)(PaletteFix.getSize() * (value - min) / (max - min)); 
    200             System.out.println("valueToPixel(" + value + ") -> " + pixel); 
    201199            return pixel; 
    202200        } 
     
    267265        public void setMinMaxLUTPixels(int min, int max) { 
    268266            killTimer(); 
    269  System.out.println("setMinMaxLUTPixels(" + min + "," + max + ")"); 
     267 
    270268            // get new minimum and maximum values for LUT 
    271269            double minLUT = pixelToValue(min); 
    272270            double maxLUT = pixelToValue(max + 1); 
    273              
    274  System.out.println("setMinMaxLUTPixels values are " + minLUT + " " + maxLUT); 
    275   
    276  System.out.println("maxLut for max + 1 would be " + pixelToValue(max + 1)); 
    277  System.out.println("minLUT for min = 0 would be " + pixelToValue(0)); 
    278271             
    279272            // set min and max on UI panel 
     
    438431            synchronized (_synchObject) { 
    439432                _histogramData.setDisplayChannels(displayChannels); 
     433                 
     434                // get updated histogram data and show it                  
     435                int[] bins = _histogramData.binValues(PaletteFix.ADJUSTED_SIZE); 
     436                _histogramPanel.setBins(bins); 
    440437            } 
    441438            //TODO 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/histogram/IHistogramDataListener.java

    r7838 r7889  
    44 */ 
    55 
    6 package imagej.slim.histogram; 
     6package loci.slim.histogram; 
    77 
    88/** 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/histogram/IHistogramPanelListener.java

    r7847 r7889  
    44 */ 
    55 
    6 package imagej.slim.histogram; 
     6package loci.slim.histogram; 
    77 
    88/** 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/histogram/IUIPanelListener.java

    r7847 r7889  
    44 */ 
    55 
    6 package imagej.slim.histogram; 
     6package loci.slim.histogram; 
    77 
    88/** 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/histogram/PaletteFix.java

    r7879 r7889  
    44 */ 
    55 
    6 package imagej.slim.histogram; 
     6package loci.slim.histogram; 
    77 
    88import java.awt.Color; 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/histogram/UIPanel.java

    r7887 r7889  
    33 * and open the template in the editor. 
    44 */ 
    5 package imagej.slim.histogram; 
     5package loci.slim.histogram; 
    66 
    77import java.awt.event.ActionEvent; 
     
    136136 
    137137        _displayChannelsCheckBox = 
    138             new JCheckBox("Display Channels", _displayChannels); 
     138            new JCheckBox("Display All Channels", _displayChannels); 
    139139        _displayChannelsCheckBox.addItemListener( 
    140140            new ItemListener() { 
     
    184184        _displayChannelsCheckBox.setSelected(displayChannels); 
    185185    } 
     186     
     187    public void enableChannels(boolean enable) { 
     188        _combineChannelsCheckBox.setEnabled(enable); 
     189        _displayChannelsCheckBox.setEnabled(enable); 
     190    } 
    186191 
    187192    /** 
Note: See TracChangeset for help on using the changeset viewer.