Changeset 7018


Ignore:
Timestamp:
10/02/10 12:25:06 (9 years ago)
Author:
melissa
Message:

Sets the Calibration.*Origin values to equal the stage position (if present). See #570.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/loci-plugins/src/loci/plugins/in/Calibrator.java

    r6881 r7018  
    7474    if (td != null) tcal = td.floatValue(); 
    7575 
     76    double xPosition = Double.NaN; 
     77    double yPosition = Double.NaN; 
     78    double zPosition = Double.NaN; 
     79    if (meta.getPlaneCount(series) > 0) { 
     80      Double posX = meta.getPlanePositionX(series, 0); 
     81      Double posY = meta.getPlanePositionY(series, 0); 
     82      Double posZ = meta.getPlanePositionZ(series, 0); 
     83      if (posX != null) xPosition = posX.doubleValue(); 
     84      if (posY != null) yPosition = posY.doubleValue(); 
     85      if (posZ != null) zPosition = posZ.doubleValue(); 
     86    } 
     87 
    7688    boolean xcalPresent = !Double.isNaN(xcal); 
    7789    boolean ycalPresent = !Double.isNaN(ycal); 
     
    93105    tcalPresent = !Double.isNaN(tcal); 
    94106    final boolean hasSpatial = xcalPresent || ycalPresent || zcalPresent; 
    95     final boolean hasCalibration = hasSpatial || ycalPresent; 
     107    final boolean hasStageData = 
     108      !Double.isNaN(xPosition) || !Double.isNaN(yPosition); 
     109    final boolean hasCalibration = hasSpatial || ycalPresent || hasStageData; 
    96110 
    97111    if (hasCalibration) { 
     
    103117      if (zcalPresent) cal.pixelDepth = zcal; 
    104118      if (tcalPresent) cal.frameInterval = tcal; 
     119      if (!Double.isNaN(xPosition) && xcalPresent) { 
     120        cal.xOrigin = xPosition * (1 / xcal); 
     121      } 
     122      if (!Double.isNaN(yPosition) && ycalPresent) { 
     123        cal.yOrigin = yPosition * (1 / ycal); 
     124      } 
     125      if (!Double.isNaN(zPosition) && zcalPresent) { 
     126        cal.zOrigin = zPosition * (1 / zcal); 
     127      } 
    105128      imp.setCalibration(cal); 
    106129    } 
Note: See TracChangeset for help on using the changeset viewer.