Changeset 7674 for trunk/projects
- Timestamp:
- 03/25/11 20:19:17 (9 years ago)
- Location:
- trunk/projects/slim-plugin/src/main/java/loci/slim
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/projects/slim-plugin/src/main/java/loci/slim/DecayGraph.java
r7672 r7674 74 74 public class DecayGraph implements IStartStopProportionListener { 75 75 static final int HORZ_TWEAK = 4; 76 static final Color DECAY_COLOR = Color.BLUE; 77 static final Color FITTED_COLOR = Color.MAGENTA; 76 static final Color IRF_COLOR = Color.GRAY; 77 static final Color DECAY_COLOR = Color.GRAY.darker(); 78 static final Color FITTED_COLOR = Color.RED; 78 79 static final Color BACK_COLOR = Color.WHITE; 79 80 static final Color START_COLOR = Color.BLUE.darker(); 80 81 static final Color STOP_COLOR = Color.RED.darker(); 81 82 static final Color BASE_COLOR = Color.GREEN.darker(); 83 static final Color RESIDUAL_COLOR = Color.BLACK; 82 84 JFrame m_frame; 83 85 int m_start; … … 212 214 decayRenderer.setSeriesShape(2, new Ellipse2D.Float(2.0f, 2.0f, 2.0f, 2.0f)); // 1.5, 3.0 look ugly! 213 215 214 decayRenderer.setSeriesPaint(0, Color.green);215 decayRenderer.setSeriesPaint(1, Color.red);216 decayRenderer.setSeriesPaint(2, Color.darkGray);216 decayRenderer.setSeriesPaint(0, IRF_COLOR); 217 decayRenderer.setSeriesPaint(1, FITTED_COLOR); 218 decayRenderer.setSeriesPaint(2, DECAY_COLOR); 217 219 218 220 m_decaySubPlot = new XYPlot(m_decayDataset, null, photonAxis, decayRenderer); … … 228 230 XYSplineRenderer residualRenderer = new XYSplineRenderer(); 229 231 residualRenderer.setSeriesShapesVisible(0, false); 230 residualRenderer.setSeriesPaint(0, Color.black);232 residualRenderer.setSeriesPaint(0, RESIDUAL_COLOR); 231 233 XYPlot residualSubPlot = new XYPlot(m_residualDataset, null, residualAxis, residualRenderer); 232 234 residualSubPlot.setDomainCrosshairVisible(true); … … 259 261 if (null != irf) { 260 262 for (int i = 0; i < bins; ++i) { 263 // logarithmic plots can't handle <= 0 261 264 if (irf[i] > 0.0) { 262 265 series1.add(xCurrent, irf[i]); 266 } 267 else { 268 series1.add(xCurrent, null); 263 269 } 264 270 xCurrent += timeInc; … … 280 286 // yes, show fitted curve and residuals 281 287 yFitted = data.getYFitted()[i]; 282 // logarithmic plots can't handle <= 0 .0288 // logarithmic plots can't handle <= 0 283 289 if (yFitted > 0.0) { 284 290 series2.add(xCurrent, yFitted); -
trunk/projects/slim-plugin/src/main/java/loci/slim/Excitation.java
r7671 r7674 44 44 private final String m_fileName; 45 45 private final float[] m_values; 46 private final float m_timeInc; 46 47 private int m_start; 47 48 private int m_stop; … … 54 55 * @param values 55 56 */ 56 public Excitation(String fileName, float[] values ) {57 public Excitation(String fileName, float[] values, float timeInc) { 57 58 m_fileName = fileName; 58 59 m_values = values; 60 m_timeInc = timeInc; 59 61 } 60 62 … … 75 77 public float[] getValues() { 76 78 return m_values; 79 } 80 81 /** 82 * Gets the horizontal time increment for the excitation curve. 83 * 84 * @return 85 */ 86 public float getTimeInc() { 87 return m_timeInc; 77 88 } 78 89 -
trunk/projects/slim-plugin/src/main/java/loci/slim/ExcitationFileHandler.java
r7671 r7674 77 77 } 78 78 79 public Excitation loadExcitation(String fileName ) {79 public Excitation loadExcitation(String fileName, float timeInc) { 80 80 Excitation excitation = null; 81 81 float values[] = null; … … 90 90 } 91 91 if (null != values) { 92 excitation = new Excitation(fileName, values );92 excitation = new Excitation(fileName, values, timeInc); 93 93 } 94 94 return excitation; 95 95 } 96 96 97 public Excitation createExcitation(String fileName, float[] values ) {97 public Excitation createExcitation(String fileName, float[] values, float timeInc) { 98 98 Excitation excitation = null; 99 99 boolean success = false; … … 108 108 } 109 109 if (success) { 110 excitation = new Excitation(fileName, values );110 excitation = new Excitation(fileName, values, timeInc); 111 111 } 112 112 return excitation; -
trunk/projects/slim-plugin/src/main/java/loci/slim/GrayScaleImage.java
r7668 r7674 68 68 private byte[] m_saveOutPixels[]; 69 69 70 public GrayScaleImage(String title, Image<T> image) { 70 public GrayScaleImage(Image<T> image) { 71 String title = image.getName(); 72 int spaceIndex = title.indexOf(" "); 73 if (0 < spaceIndex) { 74 title = title.substring(0, spaceIndex); 75 } 71 76 int dimensions[] = image.getDimensions(); 72 77 //for (int i = 0; i < dimensions.length; ++i) { -
trunk/projects/slim-plugin/src/main/java/loci/slim/SLIMProcessor.java
r7672 r7674 286 286 */ 287 287 public boolean loadExcitation(String fileName) { 288 Excitation excitation = ExcitationFileHandler.getInstance().loadExcitation(fileName );288 Excitation excitation = ExcitationFileHandler.getInstance().loadExcitation(fileName, m_timeRange); 289 289 return updateExcitation(uiPanel, excitation); 290 290 } … … 297 297 */ 298 298 public boolean createExcitation(String fileName) { 299 int channel = m_grayScaleImage.getChannel(); 299 int channel = 0; 300 if (null != m_grayScaleImage) { 301 channel = m_grayScaleImage.getChannel(); 302 } 300 303 int x = uiPanel.getX(); 301 304 int y = uiPanel.getY(); … … 304 307 values[b] = (float) getData(m_cursor, channel, x, y, b); 305 308 } 306 Excitation excitation = ExcitationFileHandler.getInstance().createExcitation(fileName, values );309 Excitation excitation = ExcitationFileHandler.getInstance().createExcitation(fileName, values, m_timeRange); 307 310 return updateExcitation(uiPanel, excitation); 308 311 } … … 325 328 326 329 // create a grayscale image from the data 327 m_grayScaleImage = new GrayScaleImage( "TITLE",m_image);330 m_grayScaleImage = new GrayScaleImage(m_image); 328 331 m_grayScaleImage.setListener( 329 332 new ISelectListener() { … … 403 406 404 407 // sum selected channel 408 int channel = 0; 409 if (null != m_grayScaleImage) { 410 channel = m_grayScaleImage.getChannel(); 411 } 405 412 double[] decay = new double[m_timeBins]; 406 413 for (int i = 0; i < decay.length; ++i) { … … 410 417 for (int x = 0; x < m_width; ++x) { 411 418 for (int b = 0; b < m_timeBins; ++b) { 412 decay[b] += getData(m_cursor, m_channel, x, y, b);419 decay[b] += getData(m_cursor, channel, x, y, b); 413 420 } 414 421 } … … 681 688 double yCount[]; 682 689 double yFitted[]; 683 684 // sum up all the photons for all the pixels 685 curveFitData = new CurveFitData(); 686 curveFitData.setParams(params); 687 yCount = new double[m_timeBins]; 688 for (int b = 0; b < m_timeBins; ++b) { 689 yCount[b] = 0.0; 690 } 691 int photons = 0; 692 int pixels = 0; 693 if (-1 == m_channel) { 694 // sum all of the channels 695 for (int channel = 0; channel < m_channels; ++channel) { 696 for (int y = 0; y < m_height; ++y) { 697 for (int x = 0; x < m_width; ++x) { 698 for (int b = 0; b < m_timeBins; ++b) { 699 double count = getData(m_cursor, channel, x, y, b); 700 yCount[b] += count; 701 photons += (int) count; 702 } 703 ++pixels; 704 } 705 } 706 } 707 } 708 else { 709 // sum selected channel 690 691 // loop over all channels or just the current one 692 for (int channel : getChannelIndices(m_fitAllChannels, m_channel, m_channels)) { 693 curveFitData = new CurveFitData(); 694 curveFitData.setParams(params.clone()); //TODO NO NO NO s/b either from UI or fitted point or fitted whole image 695 yCount = new double[m_timeBins]; 696 for (int b = 0; b < m_timeBins; ++b) { 697 yCount[b] = 0.0; 698 } 699 700 // count photons and pixels 701 int photons = 0; 702 int pixels = 0; 703 704 // sum this channel 710 705 for (int y = 0; y < m_height; ++y) { 711 706 for (int x = 0; x < m_width; ++x) { … … 717 712 ++pixels; 718 713 } 719 } 720 } 721 System.out.println("Summed photons " + photons + " Summed pixels " + pixels); 722 723 curveFitData.setYCount(yCount); 724 yFitted = new double[m_timeBins]; 725 curveFitData.setYFitted(yFitted); 726 //int nominalChannel = (-1 == m_channel) ? channel : 0; 727 curveFitData.setChannel(0); 728 curveFitData.setX(0); 729 curveFitData.setY(0); 730 curveFitDataList.add(curveFitData); 714 } 715 curveFitData.setYCount(yCount); 716 yFitted = new double[m_timeBins]; 717 curveFitData.setYFitted(yFitted); 718 719 // use zero for current channel if it's the only one 720 int nominalChannel = m_fitAllChannels ? channel : 0; 721 curveFitData.setChannel(nominalChannel); 722 curveFitData.setX(0); 723 curveFitData.setY(0); 724 curveFitData.setPixels(pixels); 725 curveFitDataList.add(curveFitData); 726 } 731 727 732 728 // do the fit … … 735 731 736 732 // show decay and update UI parameters 733 int visibleChannel = m_fitAllChannels ? m_channel : 0; 737 734 double[] irf = null; 738 735 if (null != m_excitationPanel) { 739 irf = m_excitationPanel.getValues(); 740 } 741 showDecayGraph("Summed ", uiPanel, irf, dataArray, 0); 742 uiPanel.setParameters(dataArray[0].getParams()); 736 // get the IRF curve scaled for total number of fitted pixels 737 irf = m_excitationPanel.getValues(dataArray[visibleChannel].getPixels()); 738 } 739 String title = "Summed"; 740 if (1 < m_channels) { 741 title += " Channel " + (m_channel + 1); 742 } 743 showDecayGraph(title, uiPanel, irf, dataArray[visibleChannel]); 744 uiPanel.setParameters(dataArray[visibleChannel].getParams()); 743 745 744 746 // get the results 745 //int channels = (-1 == m_channel) ? m_channels : 1; //TODO s/b summed for each channel, rather than summing all channels together???747 int channels = m_fitAllChannels ? m_channels : 1; 746 748 //fittedPixels = makeImage(channels, 1, 1, uiPanel.getParameterCount()); //TODO ImgLib bug if you use 1, 1, 1, 4; see "imglibBug()" below. 747 fittedPixels = makeImage( 2, 2, 2, uiPanel.getParameterCount()); //TODO this is a workaround; unused pixels will remain NaNs749 fittedPixels = makeImage(channels + 1, 2, 2, uiPanel.getParameterCount()); //TODO this is a workaround; unused pixels will remain NaNs 748 750 LocalizableByDimCursor<DoubleType> resultsCursor = fittedPixels.createLocalizableByDimCursor(); 749 751 setFittedParamsFromData(resultsCursor, dataArray); … … 763 765 double yCount[]; 764 766 double yFitted[]; 765 766 int roiNumber = 1; 767 int channel = (-1 == m_channel) ? 0 : m_channel; //TODO better than crashing; need a better channel strategy 768 int outputX = 0; 769 for (Roi roi: getRois()) { 770 curveFitData = new CurveFitData(); 771 curveFitData.setParams(params.clone()); 772 yCount = new double[m_timeBins]; 773 for (int b = 0; b < m_timeBins; ++b) { 774 yCount[b] = 0.0; 775 } 776 Rectangle bounds = roi.getBounds(); 777 for (int x = 0; x < bounds.width; ++x) { 778 for (int y = 0; y < bounds.height; ++y) { 779 if (roi.contains(bounds.x + x, bounds.y + y)) { 780 for (int b = 0; b < m_timeBins; ++b) { 781 yCount[b] += getData(m_cursor, channel, x, y, b); 767 768 // loop over all channels or just the current one 769 for (int channel : getChannelIndices(m_fitAllChannels, m_channel, m_channels)) { 770 int roiNumber = 1; 771 for (Roi roi: getRois()) { 772 curveFitData = new CurveFitData(); 773 curveFitData.setParams(params.clone()); 774 yCount = new double[m_timeBins]; 775 for (int b = 0; b < m_timeBins; ++b) { 776 yCount[b] = 0.0; 777 } 778 Rectangle bounds = roi.getBounds(); 779 int pixels = 0; 780 for (int x = 0; x < bounds.width; ++x) { 781 for (int y = 0; y < bounds.height; ++y) { 782 if (roi.contains(bounds.x + x, bounds.y + y)) { 783 ++pixels; 784 for (int b = 0; b < m_timeBins; ++b) { 785 yCount[b] += getData(m_cursor, channel, x, y, b); 786 } 782 787 } 783 788 } 784 789 } 785 } 786 curveFitData.setYCount(yCount); 787 yFitted = new double[m_timeBins]; 788 curveFitData.setYFitted(yFitted); 789 curveFitData.setChannel(0); 790 curveFitData.setX(outputX++); 791 curveFitData.setY(0); 792 curveFitDataList.add(curveFitData); 793 ++roiNumber; 794 } 795 790 curveFitData.setYCount(yCount); 791 yFitted = new double[m_timeBins]; 792 curveFitData.setYFitted(yFitted); 793 794 // use zero for current channel if it's the only one 795 int nominalChannel = m_fitAllChannels ? channel : 0; 796 curveFitData.setChannel(nominalChannel); 797 curveFitData.setX(roiNumber - 1); 798 curveFitData.setY(0); 799 curveFitData.setPixels(pixels); 800 curveFitDataList.add(curveFitData); 801 802 ++roiNumber; 803 } 804 } 805 796 806 // do the fit 797 807 ICurveFitData dataArray[] = curveFitDataList.toArray(new ICurveFitData[0]); … … 799 809 800 810 // show the decay graphs 801 double[] irf = null;802 if (null != m_excitationPanel) {803 irf = m_excitationPanel.getValues();804 }805 811 double min = Double.MAX_VALUE; 806 812 double max = Double.MIN_VALUE; 807 roiNumber = 1;813 int roiNumber = 1; 808 814 for (Roi roi: getRois()) { 809 showDecayGraph("Roi " + roiNumber, uiPanel, irf, dataArray, roiNumber - 1); 810 double lifetime = dataArray[roiNumber - 1].getParams()[3]; 815 int nominalChannel = m_fitAllChannels ? m_channel : 0; 816 int dataIndex = nominalChannel * getRois().length + (roiNumber - 1); 817 818 double[] irf = null; 819 if (null != m_excitationPanel) { 820 // get the IRF curve scaled for number of pixels in this ROI 821 irf = m_excitationPanel.getValues(dataArray[dataIndex].getPixels()); 822 } 823 String title = "Roi " + roiNumber; 824 if (1 < m_channels) { 825 title += " Channel " + (m_channel + 1); 826 } 827 showDecayGraph(title, uiPanel, irf, dataArray[dataIndex]); 828 double lifetime = dataArray[dataIndex].getParams()[3]; 811 829 if (lifetime < min) { 812 830 min = lifetime; … … 820 838 // show colorized lifetimes 821 839 ImageProcessor imageProcessor = new ColorProcessor(m_width, m_height); 822 ImagePlus imagePlus = new ImagePlus(" Fitted Lifetimes", imageProcessor);823 int i = 0;840 ImagePlus imagePlus = new ImagePlus("ROIs Fitted Lifetimes", imageProcessor); 841 roiNumber = 1; 824 842 for (Roi roi: getRois()) { 825 double lifetime = dataArray[i++].getParams()[3]; 843 int nominalChannel = m_fitAllChannels ? m_channel : 0; 844 int dataIndex = nominalChannel * getRois().length + (roiNumber - 1); 845 double lifetime = dataArray[dataIndex].getParams()[3]; 826 846 827 847 System.out.println("lifetime is " + lifetime); … … 839 859 } 840 860 } 861 ++roiNumber; 841 862 } 842 863 imagePlus.show(); … … 846 867 847 868 // get the results 848 //int channels = (-1 == m_channel) ? m_channels : 1; //TODO need a proper channel strategy869 int channels = m_fitAllChannels ? m_channels : 1; 849 870 //fittedPixels = makeImage(channels, 1, 1, uiPanel.getParameterCount()); //TODO ImgLib bug if you use 1, 1, 1, 4; see "imglibBug()" below. 850 fittedPixels = makeImage( 2, getRois().length + 1, 2, uiPanel.getParameterCount()); //TODO this is a workaround; unused pixels will remain NaNs871 fittedPixels = makeImage(channels + 1, getRois().length + 1, 2, uiPanel.getParameterCount()); //TODO this is a workaround; unused pixels will remain NaNs 851 872 LocalizableByDimCursor<DoubleType> resultsCursor = fittedPixels.createLocalizableByDimCursor(); 852 873 setFittedParamsFromData(resultsCursor, dataArray); … … 869 890 double yCount[]; 870 891 double yFitted[]; 871 for (int channel : getChannelIndices(m_channel, m_channels)) { 892 893 // loop over all channels or just the current one 894 for (int channel : getChannelIndices(m_fitAllChannels, m_channel, m_channels)) { 872 895 curveFitData = new CurveFitData(); 873 896 curveFitData.setParams(params.clone()); //TODO NO NO NO s/b either from UI or fitted point or fitted whole image … … 879 902 yFitted = new double[m_timeBins]; 880 903 curveFitData.setYFitted(yFitted); 881 int nominalChannel = (-1 == m_channel) ? channel : 0; 904 905 // use zero for current channel if it's the only one 906 int nominalChannel = m_fitAllChannels ? channel : 0; 882 907 curveFitData.setChannel(nominalChannel); 883 908 curveFitData.setX(0); 884 909 curveFitData.setY(0); 910 curveFitData.setPixels(1); 885 911 curveFitDataList.add(curveFitData); 886 912 } … … 890 916 getCurveFitter(uiPanel).fitData(dataArray, m_startBin, m_stopBin); 891 917 892 // show decay graph for visible channel //TODO need m_visibleChannel or the like918 // show decay graph for visible channel 893 919 double irf[] = null; 894 920 if (null != m_excitationPanel) { 895 irf = m_excitationPanel.getValues(); 896 } 897 showDecayGraph("Pixel " + x + " " + y, uiPanel, irf, dataArray, 0); 921 // get the IRF curve scaled for a single pixel 922 irf = m_excitationPanel.getValues(1); 923 } 924 String title = "Pixel " + x + " " + y; 925 if (1 < m_channels) { 926 title += " Channel " + (m_channel + 1); 927 } 928 int visibleChannel = 0; 929 if (m_fitAllChannels) { 930 visibleChannel = m_channel; 931 } 932 showDecayGraph(title, uiPanel, irf, dataArray[visibleChannel]); 898 933 899 934 // update UI parameters 900 uiPanel.setParameters(dataArray[ 0].getParams());935 uiPanel.setParameters(dataArray[visibleChannel].getParams()); 901 936 902 937 // get the results 903 int channels = (-1 == m_channel)? m_channels : 1;938 int channels = m_fitAllChannels ? m_channels : 1; 904 939 //fittedPixels = makeImage(channels, 1, 1, uiPanel.getParameterCount()); //TODO ImgLib bug if you use 1, 1, 1, 4; see "imglibBug()" below. 905 940 fittedPixels = makeImage(channels + 1, 2, 2, uiPanel.getParameterCount()); //TODO this is a workaround; unused pixels will remain NaNs … … 1095 1130 * Gets an array of channel indices to iterate over. 1096 1131 * 1097 * @param channel selected channel, or -1 for all channels 1132 * @param fitAllChannels 1133 * @param channel current channel 1098 1134 * @param channels number of channels 1099 1135 * @return 1100 1136 */ 1101 private int[] getChannelIndices( int channel, int channels) {1102 if ( -1 == channel) {1137 private int[] getChannelIndices(boolean fitAllChannels, int channel, int channels) { 1138 if (fitAllChannels) { 1103 1139 int[] channelIndices = new int[channels]; 1104 1140 for (int c = 0; c < channels; ++c) { … … 1479 1515 curveFitter.setFree(translateFree(uiPanel.getFunction(), uiPanel.getFree())); 1480 1516 if (null != m_excitationPanel) { 1481 curveFitter.setInstrumentResponse(m_excitationPanel.getValues()); 1517 // get the raw, unscaled IRF curve (will get scaled for number of pixels later) 1518 curveFitter.setInstrumentResponse(m_excitationPanel.getValues(1)); 1482 1519 } 1483 1520 return curveFitter; … … 1535 1572 * @param title 1536 1573 * @param uiPanel gets updates on dragged/start stop 1537 * @param dataArray array of fitted data 1538 * @param index to show 1539 */ 1540 private void showDecayGraph(String title, final IUserInterfacePanel uiPanel, double irf[], ICurveFitData dataArray[], int index) { 1541 if (index < dataArray.length) { 1542 DecayGraph decayGraph = new DecayGraph(title, m_startBin, m_stopBin, m_timeBins, m_timeRange, irf, dataArray[index]); 1543 decayGraph.setStartStopListener( 1544 new IStartStopListener() { 1545 public void setStartStop(int start, int stop) { 1546 uiPanel.setStart(start); 1547 uiPanel.setStop(stop); 1548 } 1549 } 1550 ); 1551 JFrame frame = decayGraph.getFrame(); 1552 frame.setLocationRelativeTo(uiPanel.getFrame()); 1553 frame.setVisible(true); 1554 frame.addFocusListener( 1555 new FocusListener() { 1556 public void focusGained(FocusEvent e) { 1557 System.out.println("focus gained " + e); 1558 } 1559 public void focusLost(FocusEvent e) { 1560 1561 } 1562 }); 1563 } 1574 * @param data fitted data 1575 */ 1576 private void showDecayGraph(String title, final IUserInterfacePanel uiPanel, double irf[], ICurveFitData data) { 1577 DecayGraph decayGraph = new DecayGraph(title, m_startBin, m_stopBin, m_timeBins, m_timeRange, irf, data); 1578 decayGraph.setStartStopListener( 1579 new IStartStopListener() { 1580 public void setStartStop(int start, int stop) { 1581 uiPanel.setStart(start); 1582 uiPanel.setStop(stop); 1583 } 1584 } 1585 ); 1586 JFrame frame = decayGraph.getFrame(); 1587 frame.setLocationRelativeTo(uiPanel.getFrame()); 1588 frame.setVisible(true); 1589 //TODO focus listener could show fit parameters in UI as you click on decay graph 1590 /*frame.addFocusListener( 1591 new FocusListener() { 1592 public void focusGained(FocusEvent e) { 1593 //System.out.println("focus gained " + e); 1594 } 1595 public void focusLost(FocusEvent e) { 1596 } 1597 });*/ 1564 1598 } 1565 1599 } -
trunk/projects/slim-plugin/src/main/java/loci/slim/ui/ExcitationGraph.java
r7671 r7674 75 75 public class ExcitationGraph implements IStartStopBaseProportionListener { 76 76 static final int HORZ_TWEAK = 0; //TODO this was necessary for the fitted decay graph: 4; 77 static final Color EXCITATION_COLOR = Color. BLACK;77 static final Color EXCITATION_COLOR = Color.GRAY; 78 78 static final Color BACK_COLOR = Color.WHITE; 79 79 static final Color START_COLOR = Color.BLUE.darker(); … … 111 111 */ 112 112 ExcitationGraph(final int start, final int stop, final float base, 113 final int bins, f inal double timeInc, float[] values) {113 final int bins, float[] values, final float timeInc) { 114 114 m_start = start; 115 115 m_stop = stop; -
trunk/projects/slim-plugin/src/main/java/loci/slim/ui/ExcitationPanel.java
r7672 r7674 74 74 public class ExcitationPanel extends JFrame { 75 75 private Excitation m_excitation; 76 private int m_start;77 private int m_stop;78 private int m_base;79 76 private JTextField m_fileField; 80 77 private JTextField m_startField; … … 93 90 float[] values = excitation.getValues(); 94 91 int bins = values.length; 95 int timeInc = 1;96 ExcitationGraph excitationGraph = new ExcitationGraph(start, stop, base, bins, timeInc, values);92 float timeInc = excitation.getTimeInc(); 93 ExcitationGraph excitationGraph = new ExcitationGraph(start, stop, base, bins, values, timeInc); 97 94 98 95 JPanel panel = new JPanel(new BorderLayout()); … … 115 112 this.setVisible(false); 116 113 } 117 118 public int getStart() {119 return m_start;120 }121 122 public int getStop() {123 return m_stop;124 }125 126 public int getBase() {127 return m_base;128 }129 114 130 public double[] getValues( ) {115 public double[] getValues(int pixels) { 131 116 float floatValues[] = m_excitation.getValues(); 117 for (float fV : floatValues) { 118 System.out.print(" " + fV); 119 } 120 System.out.println(""); 121 System.out.println("start " + m_excitation.getStart() + " stop " + m_excitation.getStop() + " base " + m_excitation.getBase()); 122 123 int start = m_excitation.getStart(); 124 int stop = m_excitation.getStop(); 125 float base = m_excitation.getBase(); 132 126 double[] values = new double[floatValues.length]; 133 127 for (int i = 0; i < values.length; ++i) { 134 if (i < m_start || i >= m_stop) {128 if (i < start || i > stop) { 135 129 values[i] = 0.0; 136 130 } 137 else if (floatValues[i] > m_base) { 138 values[i] = floatValues[i]; 131 else if (floatValues[i] > base) { 132 values[i] = pixels * floatValues[i]; 133 System.out.println("pixels " + pixels + " value " + values[i]); 139 134 } 140 135 else { … … 142 137 } 143 138 } 139 System.out.println(""); 144 140 return values; 145 141 }
Note: See TracChangeset
for help on using the changeset viewer.