Changeset 5673
- Timestamp:
- 10/10/08 11:46:07 (6 weeks ago)
- Location:
- branches/Beta3.1/SRC/org/openmicroscopy/shoola
- Files:
-
- 14 modified
-
agents/measurement/view/MeasurementViewer.java (modified) (1 diff)
-
agents/measurement/view/MeasurementViewerComponent.java (modified) (2 diffs)
-
agents/measurement/view/MeasurementViewerControl.java (modified) (8 diffs)
-
agents/measurement/view/MeasurementViewerModel.java (modified) (1 diff)
-
env/rnd/roi/PointIterator.java (modified) (3 diffs)
-
env/rnd/roi/ROIAnalyser.java (modified) (3 diffs)
-
util/roi/figures/MeasureBezierFigure.java (modified) (2 diffs)
-
util/roi/figures/MeasureEllipseFigure.java (modified) (2 diffs)
-
util/roi/figures/MeasureLineConnectionFigure.java (modified) (2 diffs)
-
util/roi/figures/MeasureLineFigure.java (modified) (2 diffs)
-
util/roi/figures/MeasurePointFigure.java (modified) (2 diffs)
-
util/roi/figures/MeasureRectangleFigure.java (modified) (2 diffs)
-
util/roi/figures/MeasureTextFigure.java (modified) (3 diffs)
-
util/roi/figures/ROIFigure.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/Beta3.1/SRC/org/openmicroscopy/shoola/agents/measurement/view/MeasurementViewer.java
r5616 r5673 241 241 * @param shape The list of ROIShapes to analyse. Mustn't be <code>null</code>. 242 242 */ 243 public void analyseShapeList( ArrayList<ROIShape> shape);243 public void analyseShapeList(List<ROIShape> shape); 244 244 245 245 -
branches/Beta3.1/SRC/org/openmicroscopy/shoola/agents/measurement/view/MeasurementViewerComponent.java
r5616 r5673 650 650 * @see MeasurementViewer#analyseShapeList(ArrayList) 651 651 */ 652 public void analyseShapeList( ArrayList<ROIShape> shapeList)652 public void analyseShapeList(List<ROIShape> shapeList) 653 653 { 654 654 if (shapeList == null) … … 664 664 665 665 case ANALYSE_SHAPE: 666 model.cancel(); 667 break; 666 //model.cancel(); 667 //break; 668 return; 668 669 } 669 670 if (model.getActiveChannels().size() == 0) return; -
branches/Beta3.1/SRC/org/openmicroscopy/shoola/agents/measurement/view/MeasurementViewerControl.java
r5541 r5673 28 28 import java.awt.event.KeyEvent; 29 29 import java.awt.event.KeyListener; 30 import java.awt.event.MouseAdapter; 31 import java.awt.event.MouseEvent; 30 32 import java.awt.event.WindowAdapter; 31 33 import java.awt.event.WindowEvent; … … 37 39 import java.util.HashMap; 38 40 import java.util.Iterator; 41 import java.util.List; 39 42 import java.util.Map; 40 43 import java.util.TreeMap; … … 62 65 import org.openmicroscopy.shoola.agents.measurement.actions.ShowROIAssistant; 63 66 import org.openmicroscopy.shoola.agents.measurement.actions.UnitsAction; 67 import org.openmicroscopy.shoola.util.roi.figures.MeasureLineFigure; 68 import org.openmicroscopy.shoola.util.roi.figures.MeasurePointFigure; 64 69 import org.openmicroscopy.shoola.util.roi.figures.MeasureTextFigure; 65 70 import org.openmicroscopy.shoola.util.roi.figures.ROIFigure; … … 161 166 162 167 /** 168 * Sets the status of the currently selected Region of Interest. 169 * 170 * @param status The value to set. 171 */ 172 private void setROIFigureStatus(int status) 173 { 174 Collection<Figure> selectedFigures = 175 view.getDrawingView().getSelectedFigures(); 176 if (selectedFigures.size() != 1) return; 177 Iterator<Figure> i = selectedFigures.iterator(); 178 Figure fig; 179 ROIFigure roiFigure; 180 while (i.hasNext()) { 181 fig = i.next(); 182 if (fig instanceof ROIFigure) { 183 roiFigure = (ROIFigure) fig; 184 roiFigure.setStatus(status); 185 handleFigureChange(roiFigure); 186 } 187 } 188 } 189 190 /** 191 * Handles the selection of new Region of Interest. 192 * 193 * @param figure The value to handle. 194 */ 195 private void handleFigureChange(ROIFigure figure) 196 { 197 //TODO clean that code 198 if ((figure instanceof MeasureLineFigure) || 199 (figure instanceof MeasurePointFigure)) { 200 figure.calculateMeasurements(); 201 view.refreshResultsTable(); 202 model.setDataChanged(); 203 if (!view.inDataView()) return; 204 ROIShape shape = figure.getROIShape(); 205 List<ROIShape> shapeList = new ArrayList<ROIShape>(); 206 ROI roi = shape.getROI(); 207 TreeMap<Coord3D, ROIShape> shapeMap = roi.getShapes(); 208 Iterator<Coord3D> shapeIterator = shapeMap.keySet().iterator(); 209 while (shapeIterator.hasNext()) 210 shapeList.add(shapeMap.get(shapeIterator.next())); 211 212 if (shapeList.size() != 0) 213 model.analyseShapeList(shapeList); 214 return; 215 } 216 217 if (figure.getStatus() != ROIFigure.IDLE) return; 218 figure.calculateMeasurements(); 219 view.refreshResultsTable(); 220 model.setDataChanged(); 221 if (!view.inDataView()) return; 222 ROIShape shape = figure.getROIShape(); 223 List<ROIShape> shapeList = new ArrayList<ROIShape>(); 224 ROI roi = shape.getROI(); 225 TreeMap<Coord3D, ROIShape> shapeMap = roi.getShapes(); 226 Iterator<Coord3D> shapeIterator = shapeMap.keySet().iterator(); 227 while (shapeIterator.hasNext()) 228 shapeList.add(shapeMap.get(shapeIterator.next())); 229 230 if (shapeList.size() != 0) 231 model.analyseShapeList(shapeList); 232 } 233 234 /** 163 235 * Creates a new instance. 164 236 * The {@link #initialize(MeasurementViewer, MeasurementViewerUI) initialize} … … 205 277 view.addWindowFocusListener(this); } 206 278 }); 279 view.getDrawingView().addMouseListener(new MouseAdapter() { 280 281 public void mouseReleased(MouseEvent e) 282 { 283 setROIFigureStatus(ROIFigure.IDLE); 284 } 285 286 public void mousePressed(MouseEvent e) 287 { 288 setROIFigureStatus(ROIFigure.MOVING); 289 } 290 291 }); 292 207 293 } 208 294 … … 319 405 Figure f = e.getFigure(); 320 406 if (!(f instanceof ROIFigure)) return; 407 321 408 ROIFigure roiFigure = (ROIFigure) f; 409 roiFigure.setStatus(ROIFigure.MOVING); 322 410 view.addROI(roiFigure); 323 411 roiFigure.addFigureListener(this); … … 325 413 if (!view.inDataView()) return; 326 414 ROIShape shape = roiFigure.getROIShape(); 327 if (view.inDataView()) 328 { 329 ArrayList<ROIShape> shapeList = new ArrayList<ROIShape>(); 330 ROI roi = shape.getROI(); 331 TreeMap<Coord3D, ROIShape> shapeMap = roi.getShapes(); 332 Iterator<Coord3D> shapeIterator = shapeMap.keySet().iterator(); 333 while (shapeIterator.hasNext()) 334 shapeList.add(shapeMap.get(shapeIterator.next())); 335 if (shapeList.size() != 0) model.analyseShapeList(shapeList); 415 List<ROIShape> shapeList = new ArrayList<ROIShape>(); 416 ROI roi = shape.getROI(); 417 TreeMap<Coord3D, ROIShape> shapeMap = roi.getShapes(); 418 Iterator<Coord3D> shapeIterator = shapeMap.keySet().iterator(); 419 while (shapeIterator.hasNext()) 420 shapeList.add(shapeMap.get(shapeIterator.next())); 421 if (shapeList.size() == 0) return; 422 if ((f instanceof MeasureLineFigure) || 423 (f instanceof MeasurePointFigure)) { 424 roiFigure.setStatus(ROIFigure.IDLE); 425 model.analyseShapeList(shapeList); 336 426 } 337 427 } … … 401 491 if (f instanceof ROIFigure) { 402 492 ROIFigure roiFigure = (ROIFigure) f; 403 roiFigure.calculateMeasurements(); 404 view.refreshResultsTable(); 405 model.setDataChanged(); 406 if (view.inDataView()) { 407 408 ROIShape shape = roiFigure.getROIShape(); 409 ArrayList<ROIShape> shapeList = new ArrayList<ROIShape>(); 410 ROI roi = shape.getROI(); 411 TreeMap<Coord3D, ROIShape> shapeMap = roi.getShapes(); 412 Iterator<Coord3D> shapeIterator = shapeMap.keySet().iterator(); 413 while (shapeIterator.hasNext()) 414 shapeList.add(shapeMap.get(shapeIterator.next())); 415 416 if (shapeList.size() != 0) 417 model.analyseShapeList(shapeList); 418 } 493 handleFigureChange(roiFigure); 419 494 } 420 495 } -
branches/Beta3.1/SRC/org/openmicroscopy/shoola/agents/measurement/view/MeasurementViewerModel.java
r5508 r5673 810 810 * @param shapeList The shapelist to analyse. Mustn't be <code>null</code>. 811 811 */ 812 void fireAnalyzeShape(ArrayList<ROIShape> shapeList) 813 { 814 if(getState() == MeasurementViewer.ANALYSE_SHAPE) 815 return; 812 void fireAnalyzeShape(List<ROIShape> shapeList) 813 { 816 814 state = MeasurementViewer.ANALYSE_SHAPE; 817 815 List channels = new ArrayList(activeChannels.size()); -
branches/Beta3.1/SRC/org/openmicroscopy/shoola/env/rnd/roi/PointIterator.java
r5004 r5673 270 270 * 271 271 * @param shape The shape to analyse. Mustn't be <code>null</code>. 272 * @param points The points contained within the Region of Interest. 272 273 * @param w The selected channel. 273 274 * @throws DataSourceException If an error occurs while retrieving plane 274 275 * data from the pixels source. 275 276 */ 276 public void iterate(ROIShape shape, int w)277 public void iterate(ROIShape shape, PlanePoint2D[] points, int w) 277 278 throws DataSourceException 278 279 { … … 280 281 if (w < 0 || w >= sizeC) 281 282 throw new NullPointerException("Channel not valid."); 282 ROIFigure selection2D;283 PlanePoint2D[] points;284 283 notifyIterationStart(); 285 284 try { //Iterate in ZWT order and notify observers. … … 287 286 int t = shape.getT(); 288 287 if (z >= 0 && z < sizeZ && t >= 0 && t < sizeT) { 289 selection2D = shape.getFigure();290 points = selection2D.getPoints();291 288 notifyPlaneStart(z, w, t, points.length); 292 289 Plane2D data = source.getPlane(z, t, w); -
branches/Beta3.1/SRC/org/openmicroscopy/shoola/env/rnd/roi/ROIAnalyser.java
r5004 r5673 35 35 import org.openmicroscopy.shoola.env.rnd.data.DataSink; 36 36 import org.openmicroscopy.shoola.env.rnd.data.DataSourceException; 37 import org.openmicroscopy.shoola.util.math.geom2D.PlanePoint2D; 37 38 import org.openmicroscopy.shoola.util.roi.model.ROIShape; 38 39 … … 152 153 stats = new HashMap<Integer, ROIShapeStats>(n); 153 154 j = channels.iterator(); 155 PlanePoint2D[] points = shape.getFigure().getPoints(); 154 156 while (j.hasNext()) { 155 157 w = (Integer) j.next(); … … 157 159 computer = new ROIShapeStats(); 158 160 runner.register(computer); 159 runner.iterate(shape, w.intValue());161 runner.iterate(shape, points, w.intValue()); 160 162 runner.remove(computer); 161 163 stats.put(w, computer); -
branches/Beta3.1/SRC/org/openmicroscopy/shoola/util/roi/figures/MeasureBezierFigure.java
r5545 r5673 96 96 private MeasurementUnits units; 97 97 98 private int status; 99 98 100 /** Create an instance of the bezier figure. */ 99 101 public MeasureBezierFigure() … … 534 536 } 535 537 538 public void setStatus(int status) { this.status = status; } 539 540 public int getStatus() { return status; } 541 536 542 } 537 543 -
branches/Beta3.1/SRC/org/openmicroscopy/shoola/util/roi/figures/MeasureEllipseFigure.java
r5502 r5673 78 78 private MeasurementUnits units; 79 79 80 private int status; 81 80 82 /** Creates a new instance. */ 81 83 public MeasureEllipseFigure() … … 507 509 } 508 510 511 public void setStatus(int status) { this.status = status; } 512 513 public int getStatus() { return status; } 514 515 509 516 } -
branches/Beta3.1/SRC/org/openmicroscopy/shoola/util/roi/figures/MeasureLineConnectionFigure.java
r5194 r5673 87 87 /** The Measurement units, and values of the image. */ 88 88 private MeasurementUnits units; 89 90 private int status; 89 91 90 92 /** … … 489 491 } 490 492 493 public void setStatus(int status) { this.status = status; } 494 495 public int getStatus() { return status; } 496 491 497 } 492 498 -
branches/Beta3.1/SRC/org/openmicroscopy/shoola/util/roi/figures/MeasureLineFigure.java
r5194 r5673 92 92 /** The Measurement units, and values of the image. */ 93 93 private MeasurementUnits units; 94 95 private int status; 94 96 95 97 /** … … 504 506 } 505 507 508 public void setStatus(int status) { this.status = status; } 509 510 public int getStatus() { return status; } 511 506 512 } 507 513 -
branches/Beta3.1/SRC/org/openmicroscopy/shoola/util/roi/figures/MeasurePointFigure.java
r5009 r5673 75 75 /** The Measurement units, and values of the image. */ 76 76 private MeasurementUnits units; 77 78 private int status; 77 79 78 80 /** … … 341 343 } 342 344 345 public void setStatus(int status) { this.status = status; } 346 347 public int getStatus() { return status; } 348 343 349 } 344 350 -
branches/Beta3.1/SRC/org/openmicroscopy/shoola/util/roi/figures/MeasureRectangleFigure.java
r5009 r5673 79 79 private MeasurementUnits units; 80 80 81 private int status; 82 81 83 /** Creates a new instance. */ 82 84 public MeasureRectangleFigure() … … 375 377 } 376 378 379 public void setStatus(int status) { this.status = status; } 380 381 public int getStatus() { return status; } 382 383 377 384 } 378 385 -
branches/Beta3.1/SRC/org/openmicroscopy/shoola/util/roi/figures/MeasureTextFigure.java
r5194 r5673 65 65 private MeasurementUnits units; 66 66 67 private int status; 68 67 69 /** Creates a new instance. Default value <code>(0, 0) </code>.*/ 68 70 public MeasureTextFigure() … … 85 87 shape = null; 86 88 roi = null; 89 status = IDLE; 87 90 } 88 91 … … 140 143 public PlanePoint2D[] getPoints() { return null; } 141 144 145 public void setStatus(int status) { this.status = status; } 146 147 public int getStatus() { return status; } 148 142 149 } 143 150 -
branches/Beta3.1/SRC/org/openmicroscopy/shoola/util/roi/figures/ROIFigure.java
r5009 r5673 52 52 { 53 53 54 /** Identified the <code>IDLE</code> status. */ 55 public static final int IDLE = 0; 56 57 /** Identified the <code>MOVING</code> status. */ 58 public static final int MOVING = 1; 59 54 60 /** 55 61 * Sets the measurement units of the ROIFigure. … … 109 115 public PlanePoint2D[] getPoints(); 110 116 117 /** 118 * Sets the status of the figure. 119 * 120 * @param status The value to set. 121 */ 122 public void setStatus(int status); 123 124 /** 125 * Returns the status of the figure. 126 * 127 * @return See above. 128 */ 129 public int getStatus(); 130 111 131 } 112 132
