• 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 Change
  • Next Change →

Changeset 5528 for trunk/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerComponent.java

Show
Ignore:
Timestamp:
07/04/08 13:41:43 (5 months ago)
Author:
jburel
Message:

First implementation of the projection.
The preview is only available for now.

Files:
1 modified

  • trunk/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerComponent.java (modified) (7 diffs)

Legend:

Unmodified
Added
Removed
  • trunk/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerComponent.java

    r5525 r5528  
    3535import java.awt.image.BufferedImage; 
    3636import java.util.ArrayList; 
     37import java.util.Collection; 
    3738import java.util.HashMap; 
    3839import java.util.Iterator; 
     40import java.util.LinkedHashMap; 
    3941import java.util.List; 
    4042import java.util.Map; 
    … …  
    6062import org.openmicroscopy.shoola.agents.imviewer.util.HistoryItem; 
    6163import org.openmicroscopy.shoola.agents.imviewer.util.PreferencesDialog; 
     64import org.openmicroscopy.shoola.agents.imviewer.util.proj.ProjectionDialog; 
     65import org.openmicroscopy.shoola.agents.imviewer.util.proj.ProjectionRef; 
    6266import org.openmicroscopy.shoola.agents.imviewer.util.UnitBarSizeDialog; 
    6367import org.openmicroscopy.shoola.agents.imviewer.util.player.MoviePlayerDialog; 
    … …  
    8084import org.openmicroscopy.shoola.util.ui.component.AbstractComponent; 
    8185import pojos.ExperimenterData; 
     86import pojos.ImageData; 
    8287 
    8388/**  
    … …  
    116121        static final String                                             ANNOTATION = "The annotations"; 
    117122         
    118         /** The message if rendering setting to annotation. */ 
    119         static final String                                             RATING = "The rating"; 
    120          
    121123        /** The Model sub-component. */ 
    122124        private ImViewerModel                           model; 
    … …  
    149151        private boolean                                                 saveBeforeCopy; 
    150152 
     153        /** The possible projections options. */ 
     154        private Map<Integer, String>                    projections; 
     155         
     156        /** The projection dialog. */ 
     157        private ProjectionDialog                                projection; 
     158         
    151159        /** Creates an history item. */ 
    152160        private void createHistoryItem() 
    … …  
    733741                                        pref.isHistory()) { 
    734742                                        if (image != null) 
    735                                                 view.setRestoreSize(image.getWidth(), image.getHeight()); 
     743                                                view.setRestoreSize(image.getWidth(),  
     744                                                                image.getHeight()); 
    736745                                        //boolean oldValue = view.isHistoryShown(); 
    737746                                        view.showHistory(true); 
    … …  
    23992408        } 
    24002409 
     2410        /**  
     2411         * Implemented as specified by the {@link ImViewer} interface. 
     2412         * @see ImViewer#showProjection() 
     2413         */ 
     2414        public void showProjection() 
     2415        { 
     2416                if (model.getState() == DISCARDED) 
     2417                        throw new IllegalArgumentException("This method cannot be invoked" + 
     2418                                        " in the DISCARDED state."); 
     2419                if (projections == null) { 
     2420                        projections = new LinkedHashMap<Integer, String>(); 
     2421                        projections.put(RenderingControl.MAX_INTENSITY,  
     2422                                        "Maximum Intensity"); 
     2423                        projections.put(RenderingControl.MEAN_INTENSITY,  
     2424                                        "Mean Intensity"); 
     2425                        projections.put(RenderingControl.SUM_INTENSITY,  
     2426                                        "Sum Intensity"); 
     2427                } 
     2428                if (projection == null) { 
     2429                        projection = new ProjectionDialog(view, projections, 
     2430                                                                        model.getMaxZ()+1,  
     2431                                                                        model.getBrowser().getBackgroundColor(), 
     2432                                                                        model.getImageName(),  
     2433                                                                        model.getOriginalImage()); 
     2434                        projection.addPropertyChangeListener(controller); 
     2435                        projection.setProjectedImage(model.getOriginalImage()); 
     2436                        UIUtilities.incrementRelativeToAndShow(view.getBounds(),  
     2437                                        projection); 
     2438                } else { 
     2439                        projection.setVisible(true); 
     2440                } 
     2441        } 
     2442 
     2443        /**  
     2444         * Implemented as specified by the {@link ImViewer} interface. 
     2445         * @see ImViewer#projectImage(ProjectionRef) 
     2446         */ 
     2447        public void projectImage(ProjectionRef ref) 
     2448        { 
     2449                if (model.getState() == DISCARDED) 
     2450                        throw new IllegalArgumentException("This method cannot be invoked" + 
     2451                                        " in the DISCARDED state."); 
     2452                if (projection == null) return; 
     2453                if (!projection.isVisible()) return; 
     2454                UserNotifier un = ImViewerAgent.getRegistry().getUserNotifier(); 
     2455                un.notifyInfo("Projection preview", "Not yet implemented"); 
     2456                projection.setVisible(false); 
     2457                projection.dispose(); 
     2458                projection = null; 
     2459                //model.fireProjectImage(ref); 
     2460        } 
     2461 
     2462        /**  
     2463         * Implemented as specified by the {@link ImViewer} interface. 
     2464         * @see ImViewer#setRenderProjected(BufferedImage) 
     2465         */ 
     2466        public void setRenderProjected(BufferedImage image) 
     2467        { 
     2468                if (image == null) { 
     2469                        UserNotifier un = ImViewerAgent.getRegistry().getUserNotifier(); 
     2470                        un.notifyInfo("Projection preview", "An error has occurred " + 
     2471                                        "while projecting the data."); 
     2472                } 
     2473                projection.setProjectedImage(image); 
     2474        } 
     2475         
     2476        /**  
     2477         * Implemented as specified by the {@link ImViewer} interface. 
     2478         * @see ImViewer#projectionPreview(ProjectionRef) 
     2479         */ 
     2480        public void projectionPreview(ProjectionRef ref) 
     2481        { 
     2482                if (model.getState() == DISCARDED) 
     2483                        throw new IllegalArgumentException("This method cannot be invoked" + 
     2484                                        " in the DISCARDED state."); 
     2485                if (projection == null) return; 
     2486                if (!projection.isVisible()) return; 
     2487                 
     2488                /* 
     2489                BufferedImage img = null; 
     2490                try { 
     2491                        img = model.renderProjected(ref.getStartZ(), ref.getEndZ(),  
     2492                                                                        ref.getStepping(), ref.getType()); 
     2493                } catch (Exception e) { 
     2494                        projection.setProjectedImage(null); 
     2495                        UserNotifier un = ImViewerAgent.getRegistry().getUserNotifier(); 
     2496                        un.notifyInfo("Projection preview", "An error has occurred " + 
     2497                                        "while projecting the data."); 
     2498                } 
     2499                projection.setProjectedImage(img); 
     2500                */ 
     2501                model.fireRenderProjected(ref); 
     2502        } 
     2503 
     2504        /**  
     2505         * Implemented as specified by the {@link ImViewer} interface. 
     2506         * @see ImViewer#setContainers(Collection) 
     2507         */ 
     2508        public void setContainers(Collection containers) 
     2509        { 
     2510                if (model.getState() == DISCARDED) 
     2511                        throw new IllegalArgumentException("This method cannot be invoked" + 
     2512                                        " in the DISCARDED state."); 
     2513                if (projection == null) return; 
     2514                if (!projection.isVisible()) return; 
     2515                projection.setContainers(containers); 
     2516        } 
     2517 
     2518        /**  
     2519         * Implemented as specified by the {@link ImViewer} interface. 
     2520         * @see ImViewer#loadContainers() 
     2521         */ 
     2522        public void loadContainers() 
     2523        { 
     2524                if (model.getState() == DISCARDED) 
     2525                        throw new IllegalArgumentException("This method cannot be invoked" + 
     2526                                        " in the DISCARDED state."); 
     2527                if (projection == null) return; 
     2528                if (!projection.isVisible()) return; 
     2529                model.fireContainersLoading(); 
     2530        } 
     2531 
     2532        /**  
     2533         * Implemented as specified by the {@link ImViewer} interface. 
     2534         * @see ImViewer#setProjectedImage(ImageData) 
     2535         */ 
     2536        public void setProjectedImage(ImageData image) 
     2537        { 
     2538                UserNotifier un = ImViewerAgent.getRegistry().getUserNotifier(); 
     2539                String message; 
     2540                if (image == null)  
     2541                        message = "An error has occurred while creating the " + 
     2542                                        "projected image."; 
     2543                else message = "The image, "+image.getName() +" has been successfully " 
     2544                       +"created"; 
     2545                un.notifyInfo("Projection", message); 
     2546                projection.setVisible(false); 
     2547                projection.dispose(); 
     2548                projection = null; 
     2549        } 
     2550 
    24012551} 

Download in other formats:

  • Unified Diff
  • Zip Archive

Trac Powered

Powered by Trac 0.11
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/