Changeset 7639 for trunk/projects/flow-cytometry
- Timestamp:
- 03/05/11 15:29:21 (9 years ago)
- Location:
- trunk/projects/flow-cytometry/src/main/java/loci/apps/flow
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/projects/flow-cytometry/src/main/java/loci/apps/flow/Detector.java
r6933 r7639 93 93 //IJ.run("Haar wavelet filter", "k1=3 k2=3 k3=3 std=1.6"); 94 94 95 d.findParticles( (ByteProcessor)Detector.imp3.getProcessor());95 d.findParticles(Detector.imp3.getProcessor()); 96 96 d.crunchArray(); 97 97 displayImage(d.floodArray); … … 180 180 } 181 181 182 private int fillParticles(int[][] floodArr ay) {182 private int fillParticles(int[][] floodArr) { 183 183 int num = 2; 184 184 for (int i=0; i<size; i++) { 185 185 for (int j=0; j<size; j++) { 186 if (floodArr ay[i][j]==0) continue;187 if (floodArr ay[i][j]==1) {186 if (floodArr[i][j]==0) continue; 187 if (floodArr[i][j]==1) { 188 188 //System.out.println("Starting flood fill "+num+" at ("+i+", "+j+")"); 189 heuristicFloodFill(floodArr ay, i, j, num++);189 heuristicFloodFill(floodArr, i, j, num++); 190 190 } 191 191 } -
trunk/projects/flow-cytometry/src/main/java/loci/apps/flow/FlowCytometry.java
r6933 r7639 72 72 import loci.formats.FormatException; 73 73 import loci.formats.ImageWriter; 74 import loci.formats.MetadataTools;75 74 import loci.formats.ome.OMEXMLMetadata; 76 75 import loci.formats.services.OMEXMLService; 77 78 import ome.xml.model.enums. *;79 import ome.xml.model. primitives.*;80 76 import ome.xml.model.enums.DimensionOrder; 77 import ome.xml.model.enums.EnumerationException; 78 import ome.xml.model.enums.PixelType; 79 import ome.xml.model.primitives.PositiveInteger; 81 80 import visad.DataReferenceImpl; 82 81 import visad.Display; … … 210 209 } 211 210 else if (nSlices == 2) { 212 ImageWindow stackwin = ((ImageWindow) imp.getWindow());211 ImageWindow stackwin = imp.getWindow(); 213 212 scroll = (Scrollbar) stackwin.getComponent(1); 214 213 215 214 AdjustmentListener l = new AdjustmentListener() { 215 @SuppressWarnings("synthetic-access") 216 @Override 216 217 public void adjustmentValueChanged(AdjustmentEvent arg0) { 217 218 try { … … 239 240 // getData(imp.getCurrentSlice(), cumulative, intensity, fn)); 240 241 } 241 catch (RemoteException e) {} 242 catch (VisADException e) {} 242 catch (RemoteException e) { 243 // ignore exceptions 244 } 245 catch (VisADException e) { 246 // ignore exceptions 247 } 243 248 } 244 249 }; … … 333 338 334 339 ItemListener CBitemListener = new ItemListener() { 340 @SuppressWarnings("synthetic-access") 341 @Override 335 342 public void itemStateChanged(ItemEvent itemEvent) { 336 343 cumulative = itemEvent.getStateChange() == ItemEvent.SELECTED; … … 339 346 imp.getCurrentSlice(), cumulative, intensity, fn)); 340 347 FlowCytometry.display.reDisplayAll(); 341 } catch (RemoteException e) {} catch (VisADException e) {} 348 } 349 catch (RemoteException e) { 350 // ignore exceptions 351 } 352 catch (VisADException e) { 353 // ignore exceptions 354 } 342 355 } 343 356 }; … … 462 475 omexmlMeta = service.createOMEXMLMetadata(); 463 476 } 464 catch (DependencyException e) { exc = e; } 465 catch (ServiceException e) { exc = e; } 466 467 if (exc != null) { 468 IJ.log("Could not create OMEXMLMetadataStore: " + exc.getMessage()); 469 exc = null; 477 catch (DependencyException e) { 478 throw new FormatException("Could not create OMEXMLMetadataStore", exc); 479 } 480 catch (ServiceException e) { 481 throw new FormatException("Could not create OMEXMLMetadataStore", exc); 470 482 } 471 483 … … 480 492 omexmlMeta.setPixelsType(PixelType.fromString("uint8"), 0); 481 493 } 482 catch (EnumerationException e) { } 494 catch (EnumerationException e) { 495 throw new FormatException(e); 496 } 483 497 omexmlMeta.setPixelsBinDataBigEndian(Boolean.FALSE, 0, 0); 484 498 try { 485 499 omexmlMeta.setPixelsDimensionOrder(DimensionOrder.fromString("XYTZC"), 0); 486 500 } 487 catch (EnumerationException e) { } 501 catch (EnumerationException e) { 502 throw new FormatException(e); 503 } 488 504 omexmlMeta.setExperimenterFirstName(s_Name, 0); 489 505 … … 618 634 //Do something with the x-position and flow rate here. 619 635 620 if (nMatches > 2) return true; 621 else return false; 636 return nMatches > 2; 622 637 } 623 638 … … 657 672 double totalArea=0, totalIntensity=0; 658 673 for (int j=0; j<rt.getCounter(); j++) { 659 double area = rt.getValue("Area", j);660 totalArea += area;661 totalIntensity += (rt.getValue("Mean", j))* area;674 double jArea = rt.getValue("Area", j); 675 totalArea += jArea; 676 totalIntensity += (rt.getValue("Mean", j))*jArea; 662 677 } 663 678 if (totalArea > maxArea) maxArea = totalArea; … … 683 698 684 699 if (minX !=0) return minX; 685 else { 686 switch (xAxis) { 687 case AREA_AXIS: 688 return (minArea - 0.05*areaRange); 689 case INTENSITY_AXIS: 690 return MIN_INTENSITY; 691 default: 692 return (minArea - 0.05*areaRange); 693 } 700 switch (xAxis) { 701 case AREA_AXIS: 702 return (minArea - 0.05*areaRange); 703 case INTENSITY_AXIS: 704 return MIN_INTENSITY; 705 default: 706 return (minArea - 0.05*areaRange); 694 707 } 695 708 } … … 699 712 700 713 if (maxX !=0) return maxX; 701 else { 702 switch (xAxis) { 703 case AREA_AXIS: 704 return (maxArea+0.05*areaRange); 705 case INTENSITY_AXIS: 706 return MAX_INTENSITY; 707 default: 708 return (maxArea+0.05*areaRange); 709 } 714 switch (xAxis) { 715 case AREA_AXIS: 716 return (maxArea+0.05*areaRange); 717 case INTENSITY_AXIS: 718 return MAX_INTENSITY; 719 default: 720 return (maxArea+0.05*areaRange); 710 721 } 711 722 } … … 716 727 717 728 if (minY !=0) return minY; 718 else { 719 switch(yAxis) { 720 case AREA_AXIS: 721 retval = (minArea - 0.05*areaRange); 722 break; 723 case INTENSITY_AXIS: 724 retval = MIN_INTENSITY; 725 break; 726 default: 727 retval = (minArea - 0.05*areaRange); 728 break; 729 } 729 switch(yAxis) { 730 case AREA_AXIS: 731 retval = (minArea - 0.05*areaRange); 732 break; 733 case INTENSITY_AXIS: 734 retval = MIN_INTENSITY; 735 break; 736 default: 737 retval = (minArea - 0.05*areaRange); 738 break; 730 739 } 731 740 … … 735 744 return 0; 736 745 } 737 elsereturn Math.log(retval);738 } 739 elsereturn retval;746 return Math.log(retval); 747 } 748 return retval; 740 749 } 741 750 … … 745 754 746 755 if (maxY !=0) return maxY; 747 else { 748 switch (yAxis) { 749 case AREA_AXIS: 750 retval = (maxArea+0.05*areaRange); 751 break; 752 case INTENSITY_AXIS: 753 retval = MAX_INTENSITY; 754 break; 755 default: 756 retval = (maxArea+0.05*areaRange); 757 break; 758 } 756 switch (yAxis) { 757 case AREA_AXIS: 758 retval = (maxArea+0.05*areaRange); 759 break; 760 case INTENSITY_AXIS: 761 retval = MAX_INTENSITY; 762 break; 763 default: 764 retval = (maxArea+0.05*areaRange); 765 break; 759 766 } 760 767 761 768 if (b_logY) { 762 769 if (retval < 0) return 0; 763 elsereturn Math.log(retval);764 } 765 elsereturn retval;770 return Math.log(retval); 771 } 772 return retval; 766 773 } 767 774 … … 799 806 } 800 807 801 public static FlatField newestGetData(int slice, boolean cumul ative,802 RealType x, FunctionType f n)808 public static FlatField newestGetData(int slice, boolean cumul, 809 RealType x, FunctionType funcType) 803 810 { 804 811 //slice is NOT zero-indexed. 805 812 double[] xArray, yArray; 806 813 int beginSlice=0, endSlice=slice-1; 807 if (!cumul ative) beginSlice = slice-1;814 if (!cumul) beginSlice = slice-1; 808 815 int beginIndex = Integer.MAX_VALUE; 809 816 int endIndex = Integer.MIN_VALUE; … … 902 909 if (xArray.length > 0) try { 903 910 xSet = new List1DDoubleSet(xArray, x, null, null); 904 ff = new FlatField(f n, xSet);911 ff = new FlatField(funcType, xSet); 905 912 double[][] ff_vals = new double[1][xArray.length]; 906 913 ff_vals[0] = yArray; … … 917 924 918 925 public static FlatField newGetData(int slice, 919 boolean cumul ative, RealType x, FunctionType fn)926 boolean cumul, RealType x, FunctionType funcType) 920 927 { 921 928 //slice is NOT zero-indexed. 922 929 double[] xArray, yArray; 923 930 int beginIndex=0, endIndex; 924 if (!cumul ative) beginIndex = slice-1;931 if (!cumul) beginIndex = slice-1; 925 932 endIndex = slice-1; 926 933 xArray = new double[endIndex - beginIndex + 1]; … … 945 952 if (endIndex >= beginIndex) try { 946 953 xSet = new List1DDoubleSet(xArray, x, null, null); 947 ff = new FlatField(f n, xSet);954 ff = new FlatField(funcType, xSet); 948 955 double[][] ff_vals = new double[1][xArray.length]; 949 956 ff_vals[0] = yArray; … … 960 967 961 968 public static FlatField getData(int slice, 962 boolean cumul ative, RealType x, FunctionType fn)969 boolean cumul, RealType x, FunctionType funcType) 963 970 { 964 971 double[] xArray, yArray; 965 972 int beginIndex=0, endIndex; 966 if (!cumul ative) beginIndex = sliceBegin.get(slice);973 if (!cumul) beginIndex = sliceBegin.get(slice); 967 974 endIndex = sliceEnd.get(slice); 968 975 xArray = new double[endIndex - beginIndex + 1]; … … 985 992 try { 986 993 intensitySet = new List1DDoubleSet(xArray, x, null, null); 987 ff = new FlatField(f n, intensitySet);994 ff = new FlatField(funcType, intensitySet); 988 995 double[][] ff_vals = new double[1][xArray.length]; 989 996 ff_vals[0] = yArray; … … 1028 1035 1029 1036 public static void processFile(String filename) throws IOException { 1030 ImagePlus im p= IJ.openImage(filename);1031 ImageStack stack = imp.getStack(); //TODO : Handle exception here.1032 int size = im p.getWidth();1037 ImagePlus imagePlus = IJ.openImage(filename); 1038 ImageStack imageStack = imagePlus.getStack(); // TODO: handle exception 1039 int size = imagePlus.getWidth(); 1033 1040 1034 1041 double PixelsPerMicron = Double.valueOf(IJ.getString( … … 1038 1045 // Close the other open windows 1039 1046 if (frame != null) frame.dispose(); 1040 i f (imp != null) imp.close();1047 imagePlus.close(); 1041 1048 1042 1049 init(size, size, PixelsPerMicron); 1043 1050 showParticles(true); 1044 for (int i=1; i<= stack.getSize(); i++) {1045 byte[] imageData = (byte[]) stack.getPixels(i);1051 for (int i=1; i<=imageStack.getSize(); i++) { 1052 byte[] imageData = (byte[]) imageStack.getPixels(i); 1046 1053 incrementSlices(); 1047 1054 showImage(size, size, imageData); -
trunk/projects/flow-cytometry/src/main/java/loci/apps/flow/Particle.java
r6933 r7639 116 116 public int getMeanIntensity() { 117 117 if (pixelArea==0) return 0; 118 elsereturn totalIntensity/pixelArea;118 return totalIntensity/pixelArea; 119 119 } 120 120
Note: See TracChangeset
for help on using the changeset viewer.