Search in sources :

Example 51 with FRAPStudy

use of cbit.vcell.microscopy.FRAPStudy in project vcell by virtualcell.

the class VirtualFrapLoader method loadVFRAP.

// the function is called when activate in VCell or as standalone.
public static void loadVFRAP(final String[] args, final boolean bStandalone, final DocumentWindowManager documentWindowManager) {
    try {
        File wd = null;
        if (args == null || args.length == 0) {
            wd = ResourceUtil.getUserHomeDir();
        } else {
            wd = new File(args[0]);
        }
        final File workingDirectory = wd;
        SwingUtilities.invokeLater(new Runnable() {

            public void run() {
                LocalWorkspace localWorkspace = new LocalWorkspace(workingDirectory);
                FRAPSingleWorkspace frapWorkspace = new FRAPSingleWorkspace();
                FRAPBatchRunWorkspace batchRunWorkspace = new FRAPBatchRunWorkspace();
                // Check swing availability
                String vers = System.getProperty("java.version");
                if (vers.compareTo("1.1.2") < 0) {
                    System.out.println("!!!WARNING: Swing must be run with a 1.1.2 or higher version JVM!!!");
                }
                /* Set Look and Feel */
                try {
                    UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
                } catch (Exception e) {
                    throw new RuntimeException(e.getMessage(), e);
                }
                // set up file choosers
                openVFRAPFileChooser = new LWFileChooser();
                openVFRAPFileChooser.setDialogTitle("Open Virtual FRAP document (.vfrap)");
                openVFRAPFileChooser.setCurrentDirectory(new File(localWorkspace.getDefaultWorkspaceDirectory()));
                openVFRAPFileChooser.addChoosableFileFilter(filter_vfrap);
                openVFRAPFileChooser.setAcceptAllFileFilterUsed(false);
                openVFRAPBatchRunChooser = new LWFileChooser();
                openVFRAPBatchRunChooser.setDialogTitle("Open Virtual FRAP batchrun document (.vfbatch)");
                openVFRAPBatchRunChooser.setCurrentDirectory(new File(localWorkspace.getDefaultWorkspaceDirectory()));
                openVFRAPBatchRunChooser.addChoosableFileFilter(filter_vfbatch);
                openVFRAPBatchRunChooser.setAcceptAllFileFilterUsed(false);
                loadFRAPImageFileChooser = new LWFileChooser();
                loadFRAPImageFileChooser.setDialogTitle("Load FRAP image file");
                loadFRAPImageFileChooser.setCurrentDirectory(new File(localWorkspace.getDefaultWorkspaceDirectory()));
                loadFRAPImageFileChooser.addChoosableFileFilter(filter_tif);
                loadFRAPImageFileChooser.addChoosableFileFilter(filter_lsm);
                addDataFileChooser_batchRun = new LWFileChooser();
                addDataFileChooser_batchRun.setDialogTitle("Add a Virtual FRAP docmument or FRAP image file to batchrun");
                addDataFileChooser_batchRun.setCurrentDirectory(new File(localWorkspace.getDefaultWorkspaceDirectory()));
                addDataFileChooser_batchRun.addChoosableFileFilter(filter_vfrap);
                addDataFileChooser_batchRun.addChoosableFileFilter(filter_tif);
                addDataFileChooser_batchRun.addChoosableFileFilter(filter_lsm);
                saveFileChooser = new LWFileChooser();
                saveFileChooser.setDialogTitle("Save Virtual FRAP document (.vfrap)");
                saveFileChooser.addChoosableFileFilter(filter_vfrap);
                saveFileChooser.setCurrentDirectory(new File(localWorkspace.getDefaultWorkspaceDirectory()));
                saveAsMatFileChooser = new LWFileChooser();
                saveAsMatFileChooser.setDialogTitle("Save image data to matlab file (.mat)");
                saveAsMatFileChooser.addChoosableFileFilter(filter_mat);
                saveAsMatFileChooser.setCurrentDirectory(new File(localWorkspace.getDefaultWorkspaceDirectory()));
                saveFileChooser_batchRun = new LWFileChooser();
                saveFileChooser_batchRun.setDialogTitle("Save Virtual FRAP batchrun document (.vfbatch)");
                saveFileChooser_batchRun.addChoosableFileFilter(filter_vfbatch);
                saveFileChooser_batchRun.setCurrentDirectory(new File(localWorkspace.getDefaultWorkspaceDirectory()));
                saveFileChooser_batchRunSaveSingleFileAs = new LWFileChooser();
                saveFileChooser_batchRunSaveSingleFileAs.addChoosableFileFilter(filter_vfrap);
                saveFileChooser_batchRunSaveSingleFileAs.setCurrentDirectory(new File(localWorkspace.getDefaultWorkspaceDirectory()));
                multiOpenFileChooser = new LWFileChooser();
                multiOpenFileChooser.setDialogTitle("Open FRAP image series");
                multiOpenFileChooser.setCurrentDirectory(new File(localWorkspace.getDefaultWorkspaceDirectory()));
                multiOpenFileChooser.addChoosableFileFilter(filter_tif);
                multiOpenFileChooser.setMultiSelectionEnabled(true);
                saveMovieFileChooser = new LWFileChooser();
                saveMovieFileChooser.setDialogTitle("Save to quick time movie (.mov)");
                saveMovieFileChooser.addChoosableFileFilter(filter_qt);
                saveMovieFileChooser.setAcceptAllFileFilterUsed(false);
                saveMovieFileChooser.setCurrentDirectory(new File(localWorkspace.getDefaultWorkspaceDirectory()));
                if (mf == null) {
                    mf = new VirtualFrapMainFrame(localWorkspace, frapWorkspace, batchRunWorkspace, bStandalone, documentWindowManager);
                }
                // System.out.println(mf.getLocation().x + "---"+mf.getLocation().y);
                mf.setMainFrameTitle("");
                mf.setVisible(true);
                // initialize FRAPStudy
                FRAPStudy fStudy = new FRAPStudy();
                frapWorkspace.setFrapStudy(fStudy, true);
                try {
                    Thread.sleep(30);
                } catch (InterruptedException e) {
                }
            }
        });
    } catch (Exception e) {
        e.printStackTrace(System.out);
    }
}
Also used : LocalWorkspace(cbit.vcell.microscopy.LocalWorkspace) LWFileChooser(org.vcell.client.logicalwindow.LWFileChooser) FRAPStudy(cbit.vcell.microscopy.FRAPStudy) FRAPSingleWorkspace(cbit.vcell.microscopy.FRAPSingleWorkspace) File(java.io.File) FRAPBatchRunWorkspace(cbit.vcell.microscopy.batchrun.FRAPBatchRunWorkspace)

Aggregations

FRAPStudy (cbit.vcell.microscopy.FRAPStudy)51 Hashtable (java.util.Hashtable)19 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)18 File (java.io.File)17 ArrayList (java.util.ArrayList)13 Parameter (cbit.vcell.opt.Parameter)11 Point (java.awt.Point)8 FRAPModel (cbit.vcell.microscopy.FRAPModel)7 UserCancelException (org.vcell.util.UserCancelException)7 ImageException (cbit.image.ImageException)6 MicroscopyXmlReader (cbit.vcell.microscopy.MicroscopyXmlReader)5 FRAPData (cbit.vcell.microscopy.FRAPData)4 FRAPOptData (cbit.vcell.microscopy.FRAPOptData)4 FRAPOptFunctions (cbit.vcell.microscopy.FRAPOptFunctions)4 FileNotFoundException (java.io.FileNotFoundException)4 IOException (java.io.IOException)4 CannotUndoException (javax.swing.undo.CannotUndoException)4 PDEDataManager (cbit.vcell.simdata.PDEDataManager)3 Simulation (cbit.vcell.solver.Simulation)3 Wizard (org.vcell.wizard.Wizard)3