Changeset 5619
- Timestamp:
- 09/19/08 13:16:18 (2 months ago)
- Location:
- trunk
- Files:
-
- 22 modified
-
SRC/org/openmicroscopy/shoola/agents/imviewer/ProjectionSaver.java (modified) (1 diff)
-
SRC/org/openmicroscopy/shoola/agents/imviewer/util/ChannelButton.java (modified) (1 diff)
-
SRC/org/openmicroscopy/shoola/agents/imviewer/util/proj/ProjectionDialog.java (modified) (15 diffs)
-
SRC/org/openmicroscopy/shoola/agents/imviewer/util/proj/ProjectionDialogControl.java (modified) (3 diffs)
-
SRC/org/openmicroscopy/shoola/agents/imviewer/util/proj/ProjectionRef.java (modified) (6 diffs)
-
SRC/org/openmicroscopy/shoola/agents/imviewer/util/proj/ProjectionSavingDialog.java (modified) (3 diffs)
-
SRC/org/openmicroscopy/shoola/agents/imviewer/view/ControlPane.java (modified) (7 diffs)
-
SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerComponent.java (modified) (1 diff)
-
SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerControl.java (modified) (2 diffs)
-
SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerModel.java (modified) (6 diffs)
-
SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerUI.java (modified) (2 diffs)
-
SRC/org/openmicroscopy/shoola/env/data/OmeroImageService.java (modified) (2 diffs)
-
SRC/org/openmicroscopy/shoola/env/data/OmeroImageServiceImpl.java (modified) (2 diffs)
-
SRC/org/openmicroscopy/shoola/env/data/OmeroMetadataServiceImpl.java (modified) (1 diff)
-
SRC/org/openmicroscopy/shoola/env/data/model/ProjectionParam.java (modified) (1 diff)
-
SRC/org/openmicroscopy/shoola/env/data/views/ImageDataView.java (modified) (1 diff)
-
SRC/org/openmicroscopy/shoola/env/data/views/ImageDataViewImpl.java (modified) (1 diff)
-
SRC/org/openmicroscopy/shoola/env/data/views/calls/ProjectionSaver.java (modified) (4 diffs)
-
SRC/org/openmicroscopy/shoola/env/rnd/PixelsServicesFactory.java (modified) (3 diffs)
-
SRC/org/openmicroscopy/shoola/env/rnd/RenderingControl.java (modified) (3 diffs)
-
SRC/org/openmicroscopy/shoola/env/rnd/RenderingControlProxy.java (modified) (2 diffs)
-
TEST/org/openmicroscopy/shoola/env/data/NullRenderingService.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/org/openmicroscopy/shoola/agents/imviewer/ProjectionSaver.java
r5592 r5619 118 118 handle = ivView.renderProjected(ref.getPixelsID(), 119 119 ref.getStartZ(), ref.getEndZ(), ref.getStepping(), 120 ref.getAlgorithm(), this); 120 ref.getAlgorithm(), ref.getChannels(), 121 this); 121 122 break; 122 123 case PROJECTION: -
trunk/SRC/org/openmicroscopy/shoola/agents/imviewer/util/ChannelButton.java
r5177 r5619 159 159 }); 160 160 setToolTipText(DESCRIPTION); 161 //timer = new Timer(DOUBLE_CLICK_THRESHOLD, this);162 //timer.setCoalesce(true);163 161 } 164 162 -
trunk/SRC/org/openmicroscopy/shoola/agents/imviewer/util/proj/ProjectionDialog.java
r5609 r5619 31 31 import java.awt.Dimension; 32 32 import java.awt.image.BufferedImage; 33 import java.util.ArrayList; 33 34 import java.util.Collection; 34 35 import java.util.HashMap; … … 42 43 import javax.swing.JButton; 43 44 import javax.swing.JComboBox; 45 import javax.swing.JComponent; 44 46 import javax.swing.JDialog; 45 47 import javax.swing.JFrame; … … 47 49 import javax.swing.JPanel; 48 50 import javax.swing.JProgressBar; 51 import javax.swing.JScrollPane; 49 52 import javax.swing.JSpinner; 50 53 import javax.swing.SpinnerNumberModel; … … 55 58 //Application-internal dependencies 56 59 import org.openmicroscopy.shoola.agents.imviewer.IconManager; 60 import org.openmicroscopy.shoola.agents.imviewer.util.ChannelButton; 57 61 import org.openmicroscopy.shoola.agents.imviewer.view.ImViewer; 58 62 import org.openmicroscopy.shoola.util.ui.TitlePanel; … … 89 93 public static final String LOAD_DATASETS_PROPERTY = "loadDatasets"; 90 94 95 /** Dimension of the box between the channel buttons. */ 96 private static final Dimension VBOX = new Dimension(1, 10); 97 98 99 /** The type of projections supported. */ 91 100 private static final Map<Integer, String> PROJECTIONS; 92 101 … … 139 148 private boolean applySettings; 140 149 150 /** One {@link ChannelButton} per channel. */ 151 private List<ChannelButton> channelButtons; 152 153 /** Flag indicating that a preview has been done. */ 154 private boolean preview; 155 141 156 /** Reference to the control. */ 142 157 private ProjectionDialogControl controller; … … 159 174 int index = types.getSelectedIndex(); 160 175 ref.setType(projectionType.get(index)); 176 Iterator<ChannelButton> i = channelButtons.iterator(); 177 ChannelButton button; 178 List<Integer> channels = new ArrayList<Integer>(); 179 while (i.hasNext()) { 180 button = i.next(); 181 if (button.isSelected()) 182 channels.add(button.getChannelIndex()); 183 } 184 ref.setChannels(channels); 161 185 } 162 186 … … 168 192 private void initComponents(Color background) 169 193 { 194 channelButtons = new ArrayList<ChannelButton>(); 170 195 frequency = new JSpinner(new SpinnerNumberModel(1, 1, maxZ, 1)); 171 196 textualSlider = new TextualTwoKnobsSlider(1, maxZ); … … 230 255 } 231 256 257 /** 258 * Creates a UI component hosting the {@link ChannelButton}s. 259 * 260 * @return See above. 261 */ 262 private JComponent buildChannelsPane() 263 { 264 JPanel p = new JPanel(); 265 p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); 266 ChannelButton button; 267 Iterator<ChannelButton> i = channelButtons.iterator(); 268 while (i.hasNext()) { 269 button = i.next(); 270 button.addPropertyChangeListener(controller); 271 p.add(button); 272 p.add(Box.createRigidArea(VBOX)); 273 } 274 if (channelButtons.size() > 10) 275 return UIUtilities.buildComponentPanelCenter(new JScrollPane(p)); 276 return UIUtilities.buildComponentPanelCenter(p); 277 } 278 232 279 /** 233 280 * Builds and lays out the main component of the dialog. … … 263 310 bar.add(Box.createVerticalStrut(10)); 264 311 bar.add(projectionButton); 265 return bar; 312 //bar.add(buildChannelsPane()); 313 314 JPanel content = new JPanel(); 315 double[][] tl = {{TableLayout.PREFERRED}, 316 {TableLayout.PREFERRED, TableLayout.FILL}}; 317 content.setLayout(new TableLayout(tl)); 318 content.add(bar, "0, 0"); 319 content.add(buildChannelsPane(), "0, 1"); 320 return content; 266 321 } 267 322 … … 311 366 * @param imageName The name of the original image. 312 367 * @param imageWidth The width of the original image. 313 * @param imageHeight The width of the original image.368 * @param imageHeight The width of the original image. 314 369 */ 315 370 public ProjectionDialog(JFrame owner, int maxZ, int maxT, String pixelsType, 316 Color background, String imageName, 317 int imageWidth, int imageHeight) 371 Color background, String imageName) 318 372 { 319 373 super(owner); … … 324 378 this.imageName = imageName; 325 379 initComponents(background); 380 } 381 382 /** 383 * 384 * @param imageWidth The width of the original image. 385 * @param imageHeight The width of the original image. 386 * @param channelButtons 387 */ 388 public void initialize(int imageWidth, int imageHeight, 389 List<ChannelButton> channelButtons) 390 { 391 if (channelButtons != null) 392 this.channelButtons = channelButtons; 326 393 buildGUI(); 327 394 Dimension d = new Dimension(imageWidth, imageHeight); … … 354 421 */ 355 422 String getPixelsType() { return pixelsType; } 356 423 357 424 /** Projects and previews. */ 358 425 void preview() 359 426 { 427 preview = true; 360 428 enableButtons(false); 361 429 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); … … 364 432 statusLabel.setText("Projecting..."); 365 433 firePropertyChange(PROJECTION_PREVIEW_PROPERTY, null, ref); 366 setModal(true); 434 //setModal(true); 435 } 436 437 /** 438 * Updates the controls when a new channel is selected or deselected. 439 * 440 * @param index The index of the channel. 441 * @param value Pass <code>true</code> to select the channel, 442 * <code>false</code> otherwise. 443 */ 444 void selectChannel(int index, boolean value) 445 { 446 Iterator<ChannelButton> i = channelButtons.iterator(); 447 ChannelButton button; 448 while (i.hasNext()) { 449 button = i.next(); 450 if (button.getChannelIndex() == index) 451 button.setSelected(value); 452 } 453 if (preview) preview(); 367 454 } 368 455 … … 408 495 * <code>false</code> otherwise. 409 496 */ 410 void project(List<DatasetData> datasets, String name, boolean allChannels,411 int startT, int endT,String pixelsType, boolean applySettings)497 void project(List<DatasetData> datasets, String name, int startT, int endT, 498 String pixelsType, boolean applySettings) 412 499 { 413 500 fillProjectionRef(); 414 501 ref.setImageDescription("Projection type: "+ 415 502 PROJECTIONS.get(ref.getType())); 416 ref.setAllChannels(allChannels);417 503 ref.setDatasets(datasets); 418 504 ref.setImageName(name); -
trunk/SRC/org/openmicroscopy/shoola/agents/imviewer/util/proj/ProjectionDialogControl.java
r5592 r5619 29 29 import java.awt.event.ActionEvent; 30 30 import java.awt.event.ActionListener; 31 import java.beans.PropertyChangeEvent; 32 import java.beans.PropertyChangeListener; 31 33 import java.util.Collection; 34 import java.util.Iterator; 35 import java.util.Map; 32 36 33 37 //Third-party libraries 34 38 35 39 //Application-internal dependencies 40 import org.openmicroscopy.shoola.agents.imviewer.util.ChannelButton; 36 41 import org.openmicroscopy.shoola.util.ui.UIUtilities; 37 42 … … 50 55 */ 51 56 class ProjectionDialogControl 52 implements ActionListener 57 implements ActionListener, PropertyChangeListener 53 58 { 54 59 … … 101 106 } 102 107 } 108 109 /** 110 * Resets the preview image if a preview has already been done. 111 * @see PropertyChangeListener#propertyChange(PropertyChangeEvent) 112 */ 113 public void propertyChange(PropertyChangeEvent evt) 114 { 115 String name = evt.getPropertyName(); 116 if (ChannelButton.CHANNEL_SELECTED_PROPERTY.equals(name)) { 117 Map map = (Map) evt.getNewValue(); 118 if (map == null) return; 119 if (map.size() != 1) return; 120 Iterator i = map.keySet().iterator(); 121 Integer index; 122 while (i.hasNext()) { 123 index = (Integer) i.next(); 124 model.selectChannel(index.intValue(), 125 ((Boolean) map.get(index)).booleanValue()); 126 } 127 } 128 } 103 129 104 130 } -
trunk/SRC/org/openmicroscopy/shoola/agents/imviewer/util/proj/ProjectionRef.java
r5609 r5619 25 25 26 26 //Java imports 27 import java.util.ArrayList; 27 28 import java.util.List; 28 29 … … 77 78 78 79 /** The description of the projected image. */ 79 private String description; 80 81 /** 82 * Project all channels if <code>true</code>, project the active channels 83 * if <code>false</code> 84 */ 85 private boolean allChannels; 80 private String description; 81 82 /** The collection of channels to project.*/ 83 private List<Integer> channels; 86 84 87 85 /** Creates a new instance. */ … … 89 87 { 90 88 setStepping(1); 89 channels = new ArrayList<Integer>(); 91 90 } 92 91 … … 117 116 setStepping(frequence); 118 117 setType(type); 118 channels = new ArrayList<Integer>(); 119 119 } 120 120 … … 201 201 202 202 /** 203 * Sets to <code>true</code> to project all channels, to <code>false</code> 204 * to projet the active channels. 205 * 206 * @param allChannels Pass code>true</code> to project all channels, 207 * <code>false</code> to projet the active channels. 208 * 209 */ 210 void setAllChannels(boolean allChannels) { this.allChannels = allChannels; } 203 * Sets the collection of channels to project. 204 * 205 * @param channels The value to set. 206 */ 207 void setChannels(List<Integer> channels) { this.channels = channels; } 211 208 212 209 /** … … 232 229 233 230 /** 234 * Returns <code>true</code> to project all channels, <code>false</code> 235 * to projet the active channels. 236 * 237 * @return See above. 238 */ 239 public boolean isAllChannels() { return allChannels; } 231 * Returns the collection of channels to project/preview. 232 * 233 * @return See above. 234 */ 235 public List<Integer> getChannels() { return channels; } 240 236 241 237 /** -
trunk/SRC/org/openmicroscopy/shoola/agents/imviewer/util/proj/ProjectionSavingDialog.java
r5598 r5619 162 162 datasets.add(selection.get(box)); 163 163 } 164 boolean all = true;165 if (activeChannels.isSelected()) all = false;166 164 int maxT = model.getMaxT(); 167 165 int startT = 0, endT = 0; … … 176 174 if (type.equals(pixelsType)) type = null; 177 175 } 178 model.project(datasets, nameField.getText(), all,startT, endT, type,176 model.project(datasets, nameField.getText(), startT, endT, type, 179 177 rndSettingsBox.isSelected()); 180 178 close(); … … 296 294 JPanel p = new JPanel(); 297 295 p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); 298 p.add(buildChannelsPanel());299 p.add(new JSeparator());296 //p.add(buildChannelsPanel()); 297 //p.add(new JSeparator()); 300 298 if (timeSelection != null) { 301 299 p.add(buildTimeRangePanel()); -
trunk/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ControlPane.java
r5609 r5619 32 32 import java.awt.event.MouseWheelListener; 33 33 import java.util.ArrayList; 34 import java.util.HashSet;35 34 import java.util.Iterator; 36 35 import java.util.List; 37 import java.util.Set;38 39 36 import javax.swing.Box; 40 37 import javax.swing.BoxLayout; … … 149 146 150 147 /** One {@link ChannelButton} per channel. */ 151 private Set<ChannelButton> channelButtons;148 private List<ChannelButton> channelButtons; 152 149 153 150 /** One {@link ChannelButton} per channel. */ 154 private Set<ChannelButton> channelButtonsGrid;151 private List<ChannelButton> channelButtonsGrid; 155 152 156 153 /** Button to play movie across channel. */ … … 269 266 private void initComponents() 270 267 { 271 channelButtons = new HashSet<ChannelButton>();272 channelButtonsGrid = new HashSet<ChannelButton>();268 channelButtons = new ArrayList<ChannelButton>(); 269 channelButtonsGrid = new ArrayList<ChannelButton>(); 273 270 274 271 zSlider = new OneKnobSlider(OneKnobSlider.VERTICAL, 0, 1, 0); … … 514 511 ChannelMetadata[] data = model.getChannelData(); 515 512 ChannelButton button; 516 ChannelMetadata d;517 513 p.add(Box.createRigidArea(VBOX)); 518 boolean gs = model.getColorModel().equals(ImViewer.GREY_SCALE_MODEL); 519 for (int k = 0; k < data.length; k++) { 520 d = data[k]; 521 button = new ChannelButton(""+d.getEmissionWavelength(), 522 model.getChannelColor(k), k, model.isChannelActive(k)); 523 if (gs) button.setGrayedOut(gs); 524 button.addPropertyChangeListener(controller); 525 button.setPreferredSize(ChannelButton.DEFAULT_MIN_SIZE); 526 channelButtons.add(button); 527 p.add(button); 514 channelButtons = createChannelButtons(); 515 Iterator<ChannelButton> i = channelButtons.iterator(); 516 while (i.hasNext()) { 517 button = i.next(); 518 button.addPropertyChangeListener(controller); 519 p.add(button); 528 520 p.add(Box.createRigidArea(VBOX)); 529 }530 521 } 522 531 523 JPanel controls = new JPanel(); 532 524 double size[][] = {{TableLayout.PREFERRED}, … … 564 556 } 565 557 558 /** 559 * Sets the maximum value of the slider. 560 * 561 * @param slider The slider to handle. 562 * @param max The maximum value to set. 563 */ 566 564 private void setSliderMax(JSlider slider, int max) 567 565 { … … 594 592 } 595 593 596 /** 597 * This method should be called straight after the metadata and the 598 * rendering settings are loaded. 599 */ 600 void buildComponent() 601 { 602 initializeValues(); 603 buildGUI(); 604 } 605 606 /** 607 * Returns the UI component hosting the z-section slider. 608 * 609 * @return See above. 610 */ 611 JPanel buildAnnotatorComponent() 612 { 613 return layoutSlider(zSliderAnnotator); 614 } 615 616 /** 617 * Builds the control panel displayed in the grid view. 618 * 619 * @return See above. 620 */ 621 JPanel buildGridComponent() 622 { 623 JPanel p = createZGridSliderPane(); 624 JPanel buttons = new JPanel(); 625 buttons.setLayout(new BoxLayout(buttons, BoxLayout.Y_AXIS)); 626 ChannelMetadata[] data = model.getChannelData(); 627 ChannelButton button; 594 /** 595 * Creates a collection of <code>ChannelButton</code>s. 596 * 597 * @return See above. 598 */ 599 List<ChannelButton> createChannelButtons() 600 { 601 List<ChannelButton> channelButtons = new ArrayList<ChannelButton>(); 602 ChannelMetadata[] data = model.getChannelData(); 603 boolean gs = model.getColorModel().equals(ImViewer.GREY_SCALE_MODEL); 604 ChannelButton button; 628 605 ChannelMetadata d; 629 buttons.add(Box.createRigidArea(VBOX));630 boolean gs = model.getColorModel().equals(ImViewer.GREY_SCALE_MODEL);631 606 for (int k = 0; k < data.length; k++) { 632 607 d = data[k]; … … 634 609 model.getChannelColor(k), k, model.isChannelActive(k)); 635 610 if (gs) button.setGrayedOut(gs); 636 button.addPropertyChangeListener(controller);637 611 button.setPreferredSize(ChannelButton.DEFAULT_MIN_SIZE); 638 channelButtonsGrid.add(button); 639 buttons.add(button); 612 channelButtons.add(button); 613 } 614 return channelButtons; 615 } 616 617 /** 618 * This method should be called straight after the metadata and the 619 * rendering settings are loaded. 620 */ 621 void buildComponent() 622 { 623 initializeValues(); 624 buildGUI(); 625 } 626 627 /** 628 * Returns the UI component hosting the z-section slider. 629 * 630 * @return See above. 631 */ 632 JPanel buildAnnotatorComponent() 633 { 634 return layoutSlider(zSliderAnnotator); 635 } 636 637 /** 638 * Builds the control panel displayed in the grid view.
