- Timestamp:
- 03/21/11 20:26:18 (9 years ago)
- Location:
- trunk/projects/slim-plugin/src/main/java/loci/slim
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/projects/slim-plugin/src/main/java/loci/slim/SLIMProcessor.java
r7658 r7663 578 578 */ 579 579 private Image<DoubleType> fitSummed(IUserInterfacePanel uiPanel) { 580 Image<DoubleType> fittedPixels = null; 580 581 double params[] = uiPanel.getParameters(); //TODO go cumulative 581 582 … … 626 627 yFitted = new double[m_timeBins]; 627 628 curveFitData.setYFitted(yFitted); 629 //int nominalChannel = (-1 == m_channel) ? channel : 0; 630 curveFitData.setChannel(0); 631 curveFitData.setX(0); 632 curveFitData.setY(0); 628 633 curveFitDataList.add(curveFitData); 629 634 … … 635 640 showDecayGraph("Summed ", uiPanel, dataArray, 0); 636 641 uiPanel.setParameters(dataArray[0].getParams()); 637 return null; 642 643 // get the results 644 //int channels = (-1 == m_channel) ? m_channels : 1; //TODO s/b summed for each channel, rather than summing all channels together??? 645 //fittedPixels = makeImage(channels, 1, 1, uiPanel.getParameterCount()); //TODO ImgLib bug if you use 1, 1, 1, 4; see "imglibBug()" below. 646 fittedPixels = makeImage(2, 2, 2, uiPanel.getParameterCount()); //TODO this is a workaround; unused pixels will remain NaNs 647 LocalizableByDimCursor<DoubleType> resultsCursor = fittedPixels.createLocalizableByDimCursor(); 648 setFittedParamsFromData(resultsCursor, dataArray); 649 return fittedPixels; 638 650 } 639 651 … … 642 654 */ 643 655 private Image<DoubleType> fitROIs(IUserInterfacePanel uiPanel) { 656 Image<DoubleType> fittedPixels = null; 644 657 double params[] = uiPanel.getParameters(); 645 658 … … 651 664 652 665 int roiNumber = 1; 666 int channel = (-1 == m_channel) ? 0 : m_channel; //TODO better than crashing; need a better channel strategy 667 int outputX = 0; 653 668 for (Roi roi: getRois()) { 654 669 curveFitData = new CurveFitData(); … … 662 677 for (int y = 0; y < bounds.height; ++y) { 663 678 if (roi.contains(bounds.x + x, bounds.y + y)) { 664 System.out.println("roi " + roiNumber + " x " + x + " Y " + y);665 679 for (int b = 0; b < m_timeBins; ++b) { 666 yCount[b] += getData(m_cursor, m_channel, x, y, b);680 yCount[b] += getData(m_cursor, channel, x, y, b); 667 681 } 668 682 } … … 672 686 yFitted = new double[m_timeBins]; 673 687 curveFitData.setYFitted(yFitted); 688 curveFitData.setChannel(0); 689 curveFitData.setX(outputX++); 690 curveFitData.setY(0); 674 691 curveFitDataList.add(curveFitData); 675 692 ++roiNumber; … … 722 739 // update UI parameters 723 740 uiPanel.setParameters(dataArray[0].getParams()); //TODO, just picked first ROI here! 724 return null; 741 742 // get the results 743 //int channels = (-1 == m_channel) ? m_channels : 1; //TODO need a proper channel strategy 744 //fittedPixels = makeImage(channels, 1, 1, uiPanel.getParameterCount()); //TODO ImgLib bug if you use 1, 1, 1, 4; see "imglibBug()" below. 745 fittedPixels = makeImage(2, getRois().length + 1, 2, uiPanel.getParameterCount()); //TODO this is a workaround; unused pixels will remain NaNs 746 LocalizableByDimCursor<DoubleType> resultsCursor = fittedPixels.createLocalizableByDimCursor(); 747 setFittedParamsFromData(resultsCursor, dataArray); 748 return fittedPixels; 725 749 } 726 750 … … 736 760 // build the data 737 761 ArrayList<ICurveFitData> curveFitDataList = new ArrayList<ICurveFitData>(); 738 double params[] = uiPanel.getParameters(); //TODO NO NO NO762 double params[] = uiPanel.getParameters(); //TODO wrong; params should possibly come from already fitted data 739 763 ICurveFitData curveFitData; 740 764 double yCount[]; … … 742 766 for (int channel : getChannelIndices(m_channel, m_channels)) { 743 767 curveFitData = new CurveFitData(); 744 curveFitData.setParams(params ); //TODO NO NO NO s/b either from UI or fitted point or fitted whole image768 curveFitData.setParams(params.clone()); //TODO NO NO NO s/b either from UI or fitted point or fitted whole image 745 769 yCount = new double[m_timeBins]; 746 770 for (int b = 0; b < m_timeBins; ++b) { … … 750 774 yFitted = new double[m_timeBins]; 751 775 curveFitData.setYFitted(yFitted); 752 int nominalChannel = (-1 == m_channel) ? channel : 1;776 int nominalChannel = (-1 == m_channel) ? channel : 0; 753 777 curveFitData.setChannel(nominalChannel); 754 778 curveFitData.setX(0); … … 771 795 //fittedPixels = makeImage(channels, 1, 1, uiPanel.getParameterCount()); //TODO ImgLib bug if you use 1, 1, 1, 4; see "imglibBug()" below. 772 796 fittedPixels = makeImage(channels + 1, 2, 2, uiPanel.getParameterCount()); //TODO this is a workaround; unused pixels will remain NaNs 773 774 797 LocalizableByDimCursor<DoubleType> resultsCursor = fittedPixels.createLocalizableByDimCursor(); 775 798 setFittedParamsFromData(resultsCursor, dataArray); … … 777 800 } 778 801 802 /* 803 * Demonstrates a bug with ImgLib: 804 * //TODO fix it! 805 */ 779 806 private void imglibBug() { 780 807 int dim[] = { 1, 1, 1, 4 }; -
trunk/projects/slim-plugin/src/main/java/loci/slim/analysis/plugins/ExportToText.java
r7658 r7663 93 93 94 94 // write headers 95 if (channels > 1) {95 if (channels > 2) { //TODO s/b 1; workaround for ImgLib bug -> always get 2 channels 96 96 writeChannelHeader(); 97 97 } … … 138 138 //TODO distinguish between not fitted and error in fit! 139 139 if (!Double.isNaN(paramArray[0])) { 140 if (channels > 1) {140 if (channels > 2) { //TODO see above; this is a hacky workaround for a bug; s/b " > 1" 141 141 writeChannel(c + 1); 142 142 } … … 150 150 writeROI(x + 1); 151 151 writeParams(function, paramArray); 152 break; 152 153 case EACH: 153 154 writeXY(x, y); … … 247 248 248 249 private void writeROI(int roi) throws IOException { 249 m_fileWriter.write( roi + '\t');250 m_fileWriter.write("" + roi + '\t'); 250 251 } 251 252
Note: See TracChangeset
for help on using the changeset viewer.