Ignore:
Timestamp:
12/21/11 23:32:51 (8 years ago)
Author:
aivar
Message:

SLIMPlugin: shows colorized range of values using 254 color palette.

Location:
trunk/projects/slim-plugin/src/main/java/imagej/slim/fitting
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/projects/slim-plugin/src/main/java/imagej/slim/fitting/AbstractBaseFittedImage.java

    r7845 r7848  
    1616import imagej.slim.histogram.HistogramDataChannel; 
    1717import imagej.slim.histogram.HistogramTool; 
     18import imagej.slim.histogram.PaletteFix; 
    1819 
    1920/** 
     
    3738        HistogramDataChannel histogramDataChannel = new HistogramDataChannel(_values); 
    3839        HistogramDataChannel[] histogramDataChannels = new HistogramDataChannel[] { histogramDataChannel }; 
    39         _histogramData = new HistogramData(title, histogramDataChannels); 
     40        _histogramData = new HistogramData(this, title, histogramDataChannels); 
    4041        _image = new FloatProcessor(x, y); 
    4142        _image.setColorModel(imagej.slim.histogram.HistogramTool.getIndexColorModel()); 
     
    103104    /** 
    104105     * Recalculates the image histogram and resets the palette.  Called 
    105      * periodically during the fit. 
     106     * periodically during the fit.  Redisplays the image. 
    106107     */ 
    107108    public void recalcHistogram() { 
     
    109110 
    110111        if (null != minMaxLUT) { 
    111             // update palette bounds 
    112             _image.setMinAndMax(minMaxLUT[0], minMaxLUT[1]); 
    113             System.out.println("min max " + minMaxLUT[0] + " " +  minMaxLUT[1]); 
     112            System.out.println("Internal redisplay " + minMaxLUT[0] + " " + minMaxLUT[1]); 
     113            //TODO horrible kludge here!!!  But why on earth would these be zero? 
     114            //TODO #2 wound up enabling this again, otherwise you don't get any images except current image 
     115            if (true) { // 0 != minMaxLUT[0] && 0 != minMaxLUT[1]) { 
     116                redisplay(minMaxLUT); 
     117            } 
    114118        } 
    115119        else System.out.println("min max null"); 
    116 //        System.out.println("min max " + minMax[0] + " " + minMax[1]); 
    117         // etc. 
    118         _imagePlus.setProcessor(_image.duplicate()); 
    119          
    120120         
    121121        System.out.println("RECALC " + numInvalid(_values)); 
    122122    } 
    123      
     123 
     124    /** 
     125     * Called from the histogram tool.  Redisplays the image after LUT ranges 
     126     * have changed. 
     127     */ 
     128    public void redisplay() { 
     129        System.out.println("public redisplay"); 
     130        double[] minMaxLUT = _histogramData.getMinMaxLUT(); 
     131        redisplay(minMaxLUT); 
     132    } 
     133 
     134    /* 
     135     * Redisplay the image with new LUT range. 
     136     */ 
     137    private void redisplay(double[] minMaxLUT) { 
     138        minMaxLUT = PaletteFix.adjustMinMax(minMaxLUT[0], minMaxLUT[1]); 
     139        _image.setMinAndMax(minMaxLUT[0], minMaxLUT[1]); 
     140        System.out.println("SETTING MIN AND MAX LUT TO " + minMaxLUT[0] + " " + minMaxLUT[1]); 
     141        _imagePlus.setProcessor(_image.duplicate()); 
     142    } 
    124143     
    125144    private int numInvalid(double[][] values) { 
  • trunk/projects/slim-plugin/src/main/java/imagej/slim/fitting/IFittedImage.java

    r7842 r7848  
    1212/** 
    1313 * 
    14  * @author Sivar Grislis 
     14 * @author Aivar Grislis 
    1515 */ 
    1616public interface IFittedImage { 
     
    7777 
    7878    /** 
     79     * Redisplays the image. 
     80     */ 
     81    public void redisplay(); 
     82 
     83    /** 
    7984     * Given the array of fitted parameters, get the value for this image. 
    8085     *  
Note: See TracChangeset for help on using the changeset viewer.