• Views
  • Iteration Report
  • My Iteration Report
  •  
OMERO.clients
  • Login
  • Help/Guide
  • About Trac
  • Preferences
  • Wiki
  • Timeline
  • Roadmap
  • Browse Source
  • View Tickets
  • Search

Context Navigation

  • ← Previous Changeset
  • Next Changeset →

Changeset 5619

Show
Ignore:
Timestamp:
09/19/08 13:16:18 (2 months ago)
Author:
jburel
Message:

Added option to turn channels on/off from the projection window directly

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  
    118118                                handle = ivView.renderProjected(ref.getPixelsID(),  
    119119                                                ref.getStartZ(), ref.getEndZ(), ref.getStepping(),  
    120                                                 ref.getAlgorithm(), this); 
     120                                                ref.getAlgorithm(), ref.getChannels(),  
     121                                                this); 
    121122                                break; 
    122123                        case PROJECTION: 
  • trunk/SRC/org/openmicroscopy/shoola/agents/imviewer/util/ChannelButton.java

    r5177 r5619  
    159159        }); 
    160160        setToolTipText(DESCRIPTION); 
    161         //timer = new Timer(DOUBLE_CLICK_THRESHOLD, this); 
    162         //timer.setCoalesce(true); 
    163161    } 
    164162     
  • trunk/SRC/org/openmicroscopy/shoola/agents/imviewer/util/proj/ProjectionDialog.java

    r5609 r5619  
    3131import java.awt.Dimension; 
    3232import java.awt.image.BufferedImage; 
     33import java.util.ArrayList; 
    3334import java.util.Collection; 
    3435import java.util.HashMap; 
    … …  
    4243import javax.swing.JButton; 
    4344import javax.swing.JComboBox; 
     45import javax.swing.JComponent; 
    4446import javax.swing.JDialog; 
    4547import javax.swing.JFrame; 
    … …  
    4749import javax.swing.JPanel; 
    4850import javax.swing.JProgressBar; 
     51import javax.swing.JScrollPane; 
    4952import javax.swing.JSpinner; 
    5053import javax.swing.SpinnerNumberModel; 
    … …  
    5558//Application-internal dependencies 
    5659import org.openmicroscopy.shoola.agents.imviewer.IconManager; 
     60import org.openmicroscopy.shoola.agents.imviewer.util.ChannelButton; 
    5761import org.openmicroscopy.shoola.agents.imviewer.view.ImViewer; 
    5862import org.openmicroscopy.shoola.util.ui.TitlePanel; 
    … …  
    8993        public static final String              LOAD_DATASETS_PROPERTY = "loadDatasets"; 
    9094         
     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. */ 
    91100        private static final Map<Integer, String>       PROJECTIONS; 
    92101         
    … …  
    139148        private boolean                                 applySettings; 
    140149         
     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     
    141156    /** Reference to the control. */ 
    142157        private ProjectionDialogControl controller; 
    … …  
    159174                int index = types.getSelectedIndex(); 
    160175                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); 
    161185        } 
    162186         
    … …  
    168192        private void initComponents(Color background) 
    169193        { 
     194                channelButtons = new ArrayList<ChannelButton>(); 
    170195                frequency = new JSpinner(new SpinnerNumberModel(1, 1, maxZ, 1)); 
    171196                textualSlider = new TextualTwoKnobsSlider(1, maxZ); 
    … …  
    230255        } 
    231256         
     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     
    232279        /**  
    233280         * Builds and lays out the main component of the dialog. 
    … …  
    263310        bar.add(Box.createVerticalStrut(10)); 
    264311        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; 
    266321        } 
    267322         
    … …  
    311366         * @param imageName       The name of the original image. 
    312367         * @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. 
    314369         */ 
    315370        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) 
    318372        { 
    319373                super(owner); 
    … …  
    324378                this.imageName = imageName; 
    325379                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; 
    326393                buildGUI(); 
    327394                Dimension d = new Dimension(imageWidth, imageHeight); 
    … …  
    354421         */ 
    355422        String getPixelsType() { return pixelsType; } 
    356  
     423         
    357424        /** Projects and previews. */ 
    358425        void preview() 
    359426        { 
     427                preview = true; 
    360428                enableButtons(false); 
    361429                setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); 
    … …  
    364432                statusLabel.setText("Projecting..."); 
    365433                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(); 
    367454        } 
    368455         
    … …  
    408495         *                                              <code>false</code> otherwise. 
    409496         */ 
    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) 
    412499        { 
    413500                fillProjectionRef(); 
    414501                ref.setImageDescription("Projection type: "+ 
    415502                                PROJECTIONS.get(ref.getType())); 
    416                 ref.setAllChannels(allChannels); 
    417503                ref.setDatasets(datasets); 
    418504                ref.setImageName(name); 
  • trunk/SRC/org/openmicroscopy/shoola/agents/imviewer/util/proj/ProjectionDialogControl.java

    r5592 r5619  
    2929import java.awt.event.ActionEvent; 
    3030import java.awt.event.ActionListener; 
     31import java.beans.PropertyChangeEvent; 
     32import java.beans.PropertyChangeListener; 
    3133import java.util.Collection; 
     34import java.util.Iterator; 
     35import java.util.Map; 
    3236 
    3337//Third-party libraries 
    3438 
    3539//Application-internal dependencies 
     40import org.openmicroscopy.shoola.agents.imviewer.util.ChannelButton; 
    3641import org.openmicroscopy.shoola.util.ui.UIUtilities; 
    3742 
    … …  
    5055 */ 
    5156class ProjectionDialogControl  
    52         implements ActionListener 
     57        implements ActionListener, PropertyChangeListener 
    5358{ 
    5459         
    … …  
    101106                } 
    102107        } 
     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        } 
    103129     
    104130} 
  • trunk/SRC/org/openmicroscopy/shoola/agents/imviewer/util/proj/ProjectionRef.java

    r5609 r5619  
    2525 
    2626//Java imports 
     27import java.util.ArrayList; 
    2728import java.util.List; 
    2829 
    … …  
    7778         
    7879        /** 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; 
    8684         
    8785        /** Creates a new instance.  */ 
    … …  
    8987        { 
    9088                setStepping(1); 
     89                channels = new ArrayList<Integer>(); 
    9190        } 
    9291         
    … …  
    117116                setStepping(frequence); 
    118117                setType(type); 
     118                channels = new ArrayList<Integer>(); 
    119119        } 
    120120 
    … …  
    201201         
    202202        /** 
    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; } 
    211208         
    212209        /** 
    … …  
    232229         
    233230        /** 
    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; } 
    240236         
    241237        /** 
  • trunk/SRC/org/openmicroscopy/shoola/agents/imviewer/util/proj/ProjectionSavingDialog.java

    r5598 r5619  
    162162                                datasets.add(selection.get(box)); 
    163163                } 
    164                 boolean all = true; 
    165                 if (activeChannels.isSelected()) all = false; 
    166164                int maxT = model.getMaxT(); 
    167165                int startT = 0, endT = 0; 
    … …  
    176174                        if (type.equals(pixelsType)) type = null; 
    177175                } 
    178                 model.project(datasets, nameField.getText(), all, startT, endT, type, 
     176                model.project(datasets, nameField.getText(), startT, endT, type, 
    179177                                rndSettingsBox.isSelected()); 
    180178                close(); 
    … …  
    296294                JPanel p = new JPanel(); 
    297295                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()); 
    300298                if (timeSelection != null) { 
    301299                        p.add(buildTimeRangePanel()); 
  • trunk/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ControlPane.java

    r5609 r5619  
    3232import java.awt.event.MouseWheelListener; 
    3333import java.util.ArrayList; 
    34 import java.util.HashSet; 
    3534import java.util.Iterator; 
    3635import java.util.List; 
    37 import java.util.Set; 
    38  
    3936import javax.swing.Box; 
    4037import javax.swing.BoxLayout; 
    … …  
    149146     
    150147    /** One  {@link ChannelButton} per channel. */ 
    151     private Set<ChannelButton>          channelButtons; 
     148    private List<ChannelButton>         channelButtons; 
    152149 
    153150    /** One  {@link ChannelButton} per channel. */ 
    154     private Set<ChannelButton>          channelButtonsGrid; 
     151    private List<ChannelButton>         channelButtonsGrid; 
    155152    
    156153    /** Button to play movie across channel. */ 
    … …  
    269266    private void initComponents() 
    270267    { 
    271         channelButtons = new HashSet<ChannelButton>(); 
    272         channelButtonsGrid = new HashSet<ChannelButton>(); 
     268        channelButtons = new ArrayList<ChannelButton>(); 
     269        channelButtonsGrid = new ArrayList<ChannelButton>(); 
    273270 
    274271        zSlider = new OneKnobSlider(OneKnobSlider.VERTICAL, 0, 1, 0); 
    … …  
    514511        ChannelMetadata[] data = model.getChannelData(); 
    515512        ChannelButton button; 
    516         ChannelMetadata d; 
    517513        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); 
    528520            p.add(Box.createRigidArea(VBOX)); 
    529         } 
    530          
     521                } 
     522        
    531523        JPanel controls = new JPanel(); 
    532524        double size[][] = {{TableLayout.PREFERRED},  
    … …  
    564556    } 
    565557   
     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     */ 
    566564    private void setSliderMax(JSlider slider, int max) 
    567565    { 
    … …  
    594592    } 
    595593     
    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; 
    628605        ChannelMetadata d; 
    629         buttons.add(Box.createRigidArea(VBOX)); 
    630         boolean gs = model.getColorModel().equals(ImViewer.GREY_SCALE_MODEL); 
    631606        for (int k = 0; k < data.length; k++) { 
    632607            d = data[k]; 
    … …  
    634609                    model.getChannelColor(k), k, model.isChannelActive(k)); 
    635610            if (gs) button.setGrayedOut(gs); 
    636             button.addPropertyChangeListener(controller); 
    637611            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.