- Timestamp:
- 12/21/11 23:32:51 (8 years ago)
- Location:
- trunk/projects/slim-plugin/src/main/java/imagej/slim
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/projects/slim-plugin/src/main/java/imagej/slim/fitting/AbstractBaseFittedImage.java
r7845 r7848 16 16 import imagej.slim.histogram.HistogramDataChannel; 17 17 import imagej.slim.histogram.HistogramTool; 18 import imagej.slim.histogram.PaletteFix; 18 19 19 20 /** … … 37 38 HistogramDataChannel histogramDataChannel = new HistogramDataChannel(_values); 38 39 HistogramDataChannel[] histogramDataChannels = new HistogramDataChannel[] { histogramDataChannel }; 39 _histogramData = new HistogramData(t itle, histogramDataChannels);40 _histogramData = new HistogramData(this, title, histogramDataChannels); 40 41 _image = new FloatProcessor(x, y); 41 42 _image.setColorModel(imagej.slim.histogram.HistogramTool.getIndexColorModel()); … … 103 104 /** 104 105 * Recalculates the image histogram and resets the palette. Called 105 * periodically during the fit. 106 * periodically during the fit. Redisplays the image. 106 107 */ 107 108 public void recalcHistogram() { … … 109 110 110 111 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 } 114 118 } 115 119 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 120 120 121 121 System.out.println("RECALC " + numInvalid(_values)); 122 122 } 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 } 124 143 125 144 private int numInvalid(double[][] values) { -
trunk/projects/slim-plugin/src/main/java/imagej/slim/fitting/IFittedImage.java
r7842 r7848 12 12 /** 13 13 * 14 * @author Sivar Grislis14 * @author Aivar Grislis 15 15 */ 16 16 public interface IFittedImage { … … 77 77 78 78 /** 79 * Redisplays the image. 80 */ 81 public void redisplay(); 82 83 /** 79 84 * Given the array of fitted parameters, get the value for this image. 80 85 * -
trunk/projects/slim-plugin/src/main/java/imagej/slim/histogram/HistogramData.java
r7847 r7848 4 4 */ 5 5 package imagej.slim.histogram; 6 7 import imagej.slim.fitting.IFittedImage; 6 8 7 9 /** … … 12 14 */ 13 15 public class HistogramData { 16 private IFittedImage _image; 14 17 private String _title; 15 18 private HistogramDataChannel[] _channel; … … 29 32 * @param channel 30 33 */ 31 public HistogramData(String title, HistogramDataChannel[] channel) { 34 public HistogramData(IFittedImage image, String title, 35 HistogramDataChannel[] channel) { 36 _image = image; 32 37 _title = title; 33 38 _channel = channel; … … 244 249 return new double[] { minLUT, maxLUT }; 245 250 } 251 252 public void redisplay() { 253 _image.redisplay(); 254 } 246 255 247 256 public int[] binValues(int bins) { -
trunk/projects/slim-plugin/src/main/java/imagej/slim/histogram/HistogramTool.java
r7847 r7848 193 193 _histogramPanel.setBins(bins); 194 194 _colorBarPanel.setMinMax(minView, maxView, minLUT, maxLUT); 195 //TODO changed is currently called from two places: 196 // i) the HistogramData listener will call it periodically during the 197 // fit. 198 // ii) if the user types in a new LUT range this gets called. 199 // iii) in the future more UI interactions will wind up here 200 // 201 _histogramData.redisplay(); 195 202 } 196 203 } … … 204 211 public void minMaxChanged(double minView, double maxView, 205 212 double minLUT, double maxLUT) { 213 System.out.println("CHANGED " + minView + " " + maxView + ", " + minLUT + " " + maxLUT); 206 214 changed(minView, maxView, minLUT, maxLUT); 207 215 } … … 336 344 _histogramData.setAutoRange(autoRange); 337 345 } 338 // turn on/off the cursors 339 // they are usually at -1 & 255 340 // but if you are autoranging & showing all channels 341 // they need to be calculated 342 // autorange off, stuff shouldn't change right away 343 // autorange on, should calculate new bounds 346 347 if (autoRange) { 348 _histogramPanel.setCursors(null, null); 349 //TODO calculate new bounds 350 } 351 else { 352 //TODO if you are autoranging, not combining channels, but showing 353 // all channels, these cursors would need to be calculated 354 _histogramPanel.setCursors(INSET, INSET + WIDTH - 1); //TODO I was expecting INSET-1 here?? 355 } 344 356 } 345 357
Note: See TracChangeset
for help on using the changeset viewer.