Changeset 2610


Ignore:
Timestamp:
04/12/07 13:38:03 (13 years ago)
Author:
curtis
Message:

Auto-detect calibration values from converted OME-XML.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/visbio/data/DatasetPane.java

    r2587 r2610  
    3737import javax.swing.event.DocumentListener; 
    3838import loci.formats.*; 
     39import loci.formats.ome.OMEXMLMetadataStore; 
    3940import loci.visbio.VisBioFrame; 
    4041import loci.visbio.util.*; 
    41 import org.openmicroscopy.xml.OMENode; 
    4242import visad.util.Util; 
    4343 
     
    384384 
    385385    // get number of images and OME-XML metadata from the first file 
    386     OMENode ome = null; 
    387386    int numImages = 0; 
    388387    ImageReader reader = new ImageReader(); 
     388    OMEXMLMetadataStore store = new OMEXMLMetadataStore(); 
     389    reader.setMetadataStore(store); 
    389390    try { 
    390391      reader.setId(ids[0]);  
     
    406407    } 
    407408 
    408     // extract dimensional axis counts from OME-XML metadata 
     409    // get physical pixel sizes (if any) 
     410    Float pixX = store.getPixelSizeX(null); 
     411    Float pixY = store.getPixelSizeY(null); 
     412    Float pixZ = store.getPixelSizeZ(null); 
     413 
     414    // get dimensional axis lengths 
    409415    String dimOrder = null; 
     416    int sizeX = -1, sizeY = -1; 
    410417    int sizeZ = 1, sizeT = 1, sizeC = 1; 
    411418    try { 
    412       dimOrder = reader.getDimensionOrder(); 
     419      sizeX = reader.getSizeX(); 
     420      sizeY = reader.getSizeY(); 
    413421      sizeZ = reader.getSizeZ(); 
    414422      sizeT = reader.getSizeT(); 
    415423      sizeC = reader.getSizeC(); 
     424      dimOrder = reader.getDimensionOrder(); 
    416425    } 
    417426    catch (FormatException exc) { exc.printStackTrace(); } 
     
    614623    second.add(builder.getPanel()); 
    615624 
    616     // clear out micron information 
    617     micronWidth.setText(""); 
    618     micronHeight.setText(""); 
    619     micronStep.setText(""); 
    620     useMicrons.setSelected(false); 
    621     toggleMicronPanel(false); 
     625    // populate micron information 
     626    float mx = pixX == null ? Float.NaN : sizeX * pixX.floatValue(); 
     627    float my = pixY == null ? Float.NaN : sizeY * pixY.floatValue(); 
     628    float mz = pixZ == null ? Float.NaN : pixZ.floatValue(); 
     629    micronWidth.setText(mx == mx ? "" + mx : ""); 
     630    micronHeight.setText(my == my ? "" + my : ""); 
     631    micronStep.setText(mz == mz ? "" + mz : ""); 
     632    boolean enabled = mx == mx || my == my || mz == mz; 
     633    useMicrons.setSelected(enabled); 
     634    toggleMicronPanel(enabled); 
    622635 
    623636    Util.invoke(false, new Runnable() { 
Note: See TracChangeset for help on using the changeset viewer.