Changeset 3365


Ignore:
Timestamp:
11/12/07 13:36:49 (12 years ago)
Author:
melissa
Message:

Added windowless importer - reads options from IJ_Prefs.txt, but doesn't allow these options to be changed.

Location:
trunk/loci/plugins
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/plugins/Colorizer.java

    r3362 r3365  
    5151  private boolean color; 
    5252  private int colorNdx; 
     53  private String mergeOption; 
    5354 
    5455  // -- PlugInFilter API methods -- 
     
    9495      color = Boolean.parseBoolean(Macro.getValue(arg, "colorize", "false")); 
    9596      colorNdx = Integer.parseInt(Macro.getValue(arg, "ndx", "0")); 
     97      mergeOption = Macro.getValue(arg, "merge_option", null); 
    9698    } 
    9799 
     
    171173        ImporterOptions options = new ImporterOptions(); 
    172174 
    173         if (options.promptMergeOption(planes1, planes2, planes3) == 
    174           ImporterOptions.STATUS_OK) 
    175         { 
    176           String option = options.getMergeOption(); 
    177           if (option.indexOf("2 channels") != -1) { 
     175        if (mergeOption == null) { 
     176          int status = options.promptMergeOption(planes1, planes2, planes3); 
     177          if (status == ImporterOptions.STATUS_OK) { 
     178            mergeOption = options.getMergeOption(); 
     179          } 
     180        } 
     181        if (mergeOption != null) { 
     182          if (mergeOption.indexOf("2 channels") != -1) { 
    178183            newImp = makeRGB(newImp, stack, 2); 
    179184          } 
    180           else if (option.indexOf("3 channels") != -1) { 
     185          else if (mergeOption.indexOf("3 channels") != -1) { 
    181186            newImp = makeRGB(newImp, stack, 3); 
    182187          } 
    183           else if (option.indexOf("4 channels") != -1) { 
     188          else if (mergeOption.indexOf("4 channels") != -1) { 
    184189            newImp = new CustomImage(imp, stackOrder, nSlices, 
    185190              nTimes * planes3, 4, true); 
     
    189194    } 
    190195 
     196    newImp.setTitle(imp.getTitle()); 
    191197    newImp.setDimensions(newImp.getStackSize() / (nSlices * nTimes), 
    192198      nSlices, nTimes); 
  • trunk/loci/plugins/Importer.java

    r3362 r3365  
    8383    String id = options.getId(); 
    8484    boolean quiet = options.isQuiet(); 
     85    boolean windowless = options.isWindowless(); 
    8586 
    8687    Location idLoc = options.getIdLocation(); 
     
    117118    // -- Step 3: get parameter values -- 
    118119 
    119     status = options.promptOptions(); 
     120    if (!windowless) status = options.promptOptions(); 
    120121    if (!statusOk(status)) return; 
    121122 
     
    645646    if (mergeChannels) { 
    646647      IJ.runPlugIn("loci.plugins.Colorizer", "stack_order=" + stackOrder + 
    647         " merge=true"); 
     648        " merge=true merge_option=[" + options.getMergeOption() + "]"); 
    648649    } 
    649650 
  • trunk/loci/plugins/ImporterOptions.java

    r3362 r3365  
    3232import java.awt.event.ItemEvent; 
    3333import java.awt.event.ItemListener; 
    34 import java.util.Vector; 
     34import java.util.*; 
    3535import javax.swing.Box; 
    3636import javax.swing.JLabel; 
     
    105105  public static final String PREF_THUMBNAIL = "bioformats.forceThumbnails"; 
    106106  public static final String PREF_MERGE_OPTION = "bioformats.mergeOption"; 
     107  public static final String PREF_SERIES = "bioformats.series"; 
    107108 
    108109  // labels for user dialog; when trimmed these double as argument & macro keys 
     
    126127  public static final String LABEL_ID = "Open"; 
    127128  public static final String LABEL_MERGE_OPTION = "Merging Options"; 
     129  public static final String LABEL_WINDOWLESS = "windowless"; 
     130  public static final String LABEL_SERIES = "series"; 
    128131 
    129132  // -- Fields - GUI components -- 
     
    159162  private boolean autoscale; 
    160163  private boolean forceThumbnails; 
     164  private boolean windowless; 
    161165  private String mergeOption; 
     166  private String seriesString; 
    162167 
    163168  private String location; 
     
    185190  public boolean isForceThumbnails() { return forceThumbnails; } 
    186191  public boolean isAutoscale() { return autoscale; } 
     192  public boolean isWindowless() { return windowless; } 
    187193  public String getMergeOption() { return mergeOption; } 
    188194 
     
    220226  public void setForceThumbnails(boolean b) { forceThumbnails = b; } 
    221227  public void setAutoscale(boolean b) { autoscale = b; } 
     228  public void setWindowless(boolean b) { windowless = b; } 
    222229 
    223230  /** Loads default option values from IJ_Prefs.txt. */ 
     
    238245    autoscale = Prefs.get(PREF_AUTOSCALE, true); 
    239246    mergeOption = Prefs.get(PREF_MERGE_OPTION, MERGE_DEFAULT); 
     247    seriesString = Prefs.get(PREF_SERIES, "0"); 
    240248  } 
    241249 
     
    256264    Prefs.set(PREF_MERGE_OPTION, mergeOption); 
    257265    Prefs.set(PREF_AUTOSCALE, autoscale); 
     266    Prefs.set(PREF_SERIES, seriesString); 
    258267  } 
    259268 
     
    295304      mergeOption = Macro.getValue(arg, LABEL_MERGE_OPTION, mergeOption); 
    296305      autoscale = getMacroValue(arg, LABEL_AUTOSCALE, autoscale); 
     306      windowless = getMacroValue(arg, LABEL_WINDOWLESS, windowless); 
     307      seriesString = Macro.getValue(arg, LABEL_SERIES, "0"); 
    297308 
    298309      location = Macro.getValue(arg, LABEL_LOCATION, location); 
     
    423434 
    424435  public int promptMergeOption(int one, int two, int three) { 
     436    if (windowless) return STATUS_OK; 
    425437    GenericDialog gd = new GenericDialog("Merging Options..."); 
    426438 
     
    522534   */ 
    523535  public int promptFilePattern() { 
     536    if (windowless) return STATUS_OK; 
     537 
    524538    id = FilePattern.findPattern(idLoc); 
    525539 
     
    546560    String[] seriesLabels, boolean[] series) 
    547561  { 
     562    if (windowless) { 
     563      if (seriesString != null) { 
     564        if (seriesString.startsWith("[")) { 
     565          seriesString = seriesString.substring(1, seriesString.length() - 2); 
     566        } 
     567        Arrays.fill(series, false); 
     568        StringTokenizer tokens = new StringTokenizer(seriesString, " "); 
     569        while (tokens.hasMoreTokens()) { 
     570          String token = tokens.nextToken().trim(); 
     571          int n = Integer.parseInt(token); 
     572          if (n < series.length) series[n] = true; 
     573        } 
     574      } 
     575      return STATUS_OK; 
     576    } 
    548577    int seriesCount = r.getSeriesCount(); 
    549578 
     
    589618    if (gd.wasCanceled()) return STATUS_CANCELED; 
    590619 
    591     for (int i=0; i<seriesCount; i++) series[i] = gd.getNextBoolean(); 
     620    seriesString = "["; 
     621    for (int i=0; i<seriesCount; i++) { 
     622      series[i] = gd.getNextBoolean(); 
     623      if (series[i]) { 
     624        seriesString += i + " "; 
     625      } 
     626    } 
     627    seriesString += "]"; 
    592628 
    593629    if (concatenate) { 
  • trunk/loci/plugins/plugins.config

    r3362 r3365  
    2626Plugins>LOCI, "Stack Slicer", loci.plugins.Slicer("") 
    2727Plugins>LOCI, "4D Data Browser", loci.plugins.LociImporter("location=[Local machine] group=true view=[4D Data Browser]") 
    28 Plugins>LOCI, "Bio-Formats Importer", loci.plugins.LociImporter("location=[Local machine]") 
     28Plugins>LOCI, "Bio-Formats Importer (windowless)", loci.plugins.LociImporter("location=[Local machine] windowless=true ") 
     29Plugins>LOCI, "Bio-Formats Importer", loci.plugins.LociImporter("location=[Local machine] windowless=false ") 
    2930Plugins>LOCI, "Bio-Formats Exporter", loci.plugins.LociExporter("") 
    3031Plugins>LOCI, "Bio-Formats Remote Importer", loci.plugins.LociImporter("location=[Internet]") 
Note: See TracChangeset for help on using the changeset viewer.